diff --git a/.github/main.workflow b/.github/main.workflow index a348439..e0ad56e 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -3,7 +3,13 @@ workflow "Deploy to Heroku" { resolves = ["release registry", "release hooks", "release reaper"] } +action "only master branch" { + uses = "actions/bin/filter@master" + args = "branch master" +} + action "heroku login" { + needs = "only master branch" uses = "actions/heroku@master" args = "container:login" secrets = ["HEROKU_API_KEY"] @@ -12,56 +18,56 @@ action "heroku login" { action "build registry" { uses = "actions/docker/cli@master" needs = "heroku login" - args = "build -t registry.heroku.com/replreg/web registry" + args = "build -t registry.heroku.com/ttlsh/web registry" } action "push registry" { uses = "actions/docker/cli@master" needs = "build registry" - args = "push registry.heroku.com/replreg/web" + args = "push registry.heroku.com/ttlsh/web" } action "release registry" { uses = "actions/heroku@master" needs = "push registry" - args = "container:release -a replreg web" + args = "container:release -a ttlsh web" secrets = ["HEROKU_API_KEY"] } action "build hooks" { uses = "actions/docker/cli@master" needs = "heroku login" - args = "build -f hooks/Dockerfile.hooks -t registry.heroku.com/replreg-hooks/web hooks" + args = "build -f hooks/Dockerfile.hooks -t registry.heroku.com/ttlsh-hooks/web hooks" } action "push hooks" { uses = "actions/docker/cli@master" needs = "build hooks" - args = "push registry.heroku.com/replreg-hooks/web" + args = "push registry.heroku.com/ttlsh-hooks/web" } action "release hooks" { uses = "actions/heroku@master" needs = "push hooks" - args = "container:release -a replreg-hooks web" + args = "container:release -a ttlsh-hooks web" secrets = ["HEROKU_API_KEY"] } action "build reaper" { uses = "actions/docker/cli@master" needs = "heroku login" - args = "build -f hooks/Dockerfile.reap -t registry.heroku.com/replreg-hooks/reap hooks" + args = "build -f hooks/Dockerfile.reap -t registry.heroku.com/ttlsh-hooks/reap hooks" } action "push reaper" { uses = "actions/docker/cli@master" needs = "build reaper" - args = "push registry.heroku.com/replreg-hooks/reap" + args = "push registry.heroku.com/ttlsh-hooks/reap" } action "release reaper" { uses = "actions/heroku@master" needs = "push reaper" - args = "container:release -a replreg-hooks reap" + args = "container:release -a ttlsh-hooks reap" secrets = ["HEROKU_API_KEY"] } diff --git a/README.md b/README.md index 021cf24..abdecbe 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# replreg +# ttl.sh An ephemeral container registry for CI workflows. -## What is replreg? +## What is ttl.sh? -replreg is an anonymous, expiring Docker container registry using the official Docker Registry image. This is a set of tools and configuration that can be used to delpoy the registry without authentication, but with self-expiring images. +ttl.sh is an anonymous, expiring Docker container registry using the official Docker Registry image. This is a set of tools and configuration that can be used to delpoy the registry without authentication, but with self-expiring images. diff --git a/cloudflare/package.json b/cloudflare/package.json index 25d37c8..3654f7b 100644 --- a/cloudflare/package.json +++ b/cloudflare/package.json @@ -1,21 +1,21 @@ { - "name": "replreg-cloudflare-worker", + "name": "ttlsh-cloudflare-worker", "version": "0.0.1", - "description": "Cloudflare Workers for replreg.is", + "description": "Cloudflare Workers for ttl.sh", "main": "index.js", "scripts": { "test": "make test" }, "repository": { "type": "git", - "url": "git+https://github.com/replicatedhq/replreg.git" + "url": "git+https://github.com/replicatedhq/ttl.sh.git" }, "author": "", "license": "Apache-2.0", "bugs": { - "url": "https://github.com/replicatedhq/replreg/issues" + "url": "https://github.com/replicatedhq/ttl.sh/issues" }, - "homepage": "https://github.com/replicatedhq/replreg#readme", + "homepage": "https://github.com/replicatedhq/ttl.sh#readme", "devDependencies": { "awesome-typescript-loader": "^5.2.1", "typescript": "^3.4.5", diff --git a/cloudflare/src/index.ts b/cloudflare/src/index.ts index 400dfba..e7595e1 100644 --- a/cloudflare/src/index.ts +++ b/cloudflare/src/index.ts @@ -13,7 +13,7 @@ async function proxyRequest(r: Request): Promise { if (!isRegistryRequest(r)) { return fetch(`https://friendly-goldstine-7897fc.netlify.com/${url.pathname}`); - } + } if (isCatalogRequest(r)) { return new Response(null, { @@ -21,10 +21,11 @@ async function proxyRequest(r: Request): Promise { }); } - const tagManifestParams = await tryParsePutTagRequest(r.method, url); - if (tagManifestParams) { - return handleTagManifestRequest(r, tagManifestParams); - } + // Removing this code for now. It causes Docker to exit with a 1 exit code :( + // const tagManifestParams = await tryParsePutTagRequest(r.method, url); + // if (tagManifestParams) { + // return handleTagManifestRequest(r, tagManifestParams); + // } return fetch(r); } @@ -43,4 +44,4 @@ interface FetchEvent extends Event { request: Request; respondWith(r: Promise | Response): Promise; -} \ No newline at end of file +} diff --git a/cloudflare/src/tag_manifest/handler.ts b/cloudflare/src/tag_manifest/handler.ts index 0d6714d..e0b3336 100644 --- a/cloudflare/src/tag_manifest/handler.ts +++ b/cloudflare/src/tag_manifest/handler.ts @@ -52,7 +52,7 @@ export async function handleTagManifestRequest(r: Request, params: TagManifestPa const teapotResponse = { "errors": [ { - "message": `\r \nimage replreg.is/${imageName} is available now and will be automatically deleted ${expirationFromTag(params.tag)}\n\nreplreg is contributed by Replicated (www.replicated.com)` + "message": `\r \nimage ttl.sh/${imageName} is available now and will be automatically deleted ${expirationFromTag(params.tag)}\n\ttl.sh is contributed by Replicated (www.replicated.com)` } ] }; diff --git a/hooks/Makefile b/hooks/Makefile index 2217fd4..2fc90ca 100644 --- a/hooks/Makefile +++ b/hooks/Makefile @@ -34,13 +34,13 @@ publish: publish-hooks publish-reap .PHONY: publish-hooks publish-hooks: test - docker build -f Dockerfile.hooks -t registry.heroku.com/replreg-hooks/web . - docker push registry.heroku.com/replreg-hooks/web - heroku container:release web -a replreg-hooks + docker build -f Dockerfile.hooks -t registry.heroku.com/ttlsh-hooks/web . + docker push registry.heroku.com/ttlsh-hooks/web + heroku container:release web -a ttlsh-hooks .PHONY: publish-reap publish-reap: test - docker build -f Dockerfile.reap -t registry.heroku.com/replreg-hooks/reap . - docker push registry.heroku.com/replreg-hooks/reap - heroku container:release reap -a replreg-hooks + docker build -f Dockerfile.reap -t registry.heroku.com/ttlsh-hooks/reap . + docker push registry.heroku.com/ttlsh-hooks/reap + heroku container:release reap -a ttlsh-hooks diff --git a/hooks/README.md b/hooks/README.md index 9b98269..d594d74 100644 --- a/hooks/README.md +++ b/hooks/README.md @@ -1,8 +1,8 @@ -# replreg hooks +# ttl.sh hooks -This is the hooks server that also has the reaper for replreg.is. +This is the hooks server that also has the reaper for ttl.sh. -The webhooks from the registry are terminated in [src/controllers/HookAPI.ts](https://github.com/replicatedhq/replreg/blob/master/hooks/src/controllers/HookAPI.ts). The reaper runs on a cron and executes [src/commands/reap.ts](https://github.com/replicatedhq/replreg/blob/master/hooks/src/commands/reap.ts). +The webhooks from the registry are terminated in [src/controllers/HookAPI.ts](https://github.com/replicatedhq/ttl.sh/blob/master/hooks/src/controllers/HookAPI.ts). The reaper runs on a cron and executes [src/commands/reap.ts](https://github.com/replicatedhq/ttl.sh/blob/master/hooks/src/commands/reap.ts). diff --git a/hooks/package.json b/hooks/package.json index b96e393..bc75dc1 100644 --- a/hooks/package.json +++ b/hooks/package.json @@ -1,7 +1,7 @@ { "name": "hooks", "version": "1.0.0", - "description": "replreg hooks", + "description": "ttlsh hooks", "license": "Apache-2.0", "main": "./build/server.js", "dependencies": { diff --git a/hooks/src/commands/reap.ts b/hooks/src/commands/reap.ts index 6d9ffb1..07fef3b 100644 --- a/hooks/src/commands/reap.ts +++ b/hooks/src/commands/reap.ts @@ -55,7 +55,7 @@ async function main(argv): Promise { // Get the manifest from the tag const getOptions = { method: "HEAD", - uri: `https://replreg.is/v2/${imageAndTag[0]}/manifests/${imageAndTag[1]}`, + uri: `https://ttl.sh/v2/${imageAndTag[0]}/manifests/${imageAndTag[1]}`, headers, resolveWithFullResponse: true, simple: false, @@ -68,7 +68,7 @@ async function main(argv): Promise { continue; } - const deleteURI = `https://replreg.is/v2/${imageAndTag[0]}/manifests/${getResponse.headers.etag.replace(/"/g,"")}`; + const deleteURI = `https://ttl.sh/v2/${imageAndTag[0]}/manifests/${getResponse.headers.etag.replace(/"/g,"")}`; // Remove from the registry const options = { diff --git a/hooks/src/logger.ts b/hooks/src/logger.ts index 450163a..5f2a3e3 100644 --- a/hooks/src/logger.ts +++ b/hooks/src/logger.ts @@ -3,7 +3,7 @@ import * as process from "process"; function initLogger(): any { const logOptions = { - name: process.env["LOG_NAME"] || "replreg", + name: process.env["LOG_NAME"] || "ttlsh", safe: true, prettyPrint: process.env["LOG_PRETTY"] || false, }; diff --git a/hooks/src/router.ts b/hooks/src/router.ts index 3f87ae0..095e54f 100644 --- a/hooks/src/router.ts +++ b/hooks/src/router.ts @@ -48,7 +48,7 @@ export const onSuccess = (res: express.Response, reqId: string, statusCodeGetter logger.warn(util.inspect(res)); } logger.info(`[${reqId}] => ${statusToSend} ${bodyToLog}`); - const respObj = res.status(statusToSend).type(contentType).set("X-Replreg-RequestId", reqId); + const respObj = res.status(statusToSend).type(contentType).set("X-Ttlsh-RequestId", reqId); if (result.filename) { respObj.attachment(result.filename); } @@ -61,7 +61,7 @@ export const onSuccess = (res: express.Response, reqId: string, statusCodeGetter } else { const statusToSend = (statusCodeGetter && statusCodeGetter()) || 200; logger.info(`[${reqId}] => ${statusToSend}`); - res.status(statusToSend).set("X-Replreg-RequestId", reqId).json(result); + res.status(statusToSend).set("X-Ttlsh-RequestId", reqId).json(result); } }; @@ -88,7 +88,7 @@ function handleFrameworkError(err: any, reqId: string, res: express.Response) { error: errMsg, invalid: err.invalid, }; - res.status(err.status).set("X-Replreg-RequestId", reqId).json(bodyToSend); + res.status(err.status).set("X-Ttlsh-RequestId", reqId).json(bodyToSend); } @@ -105,7 +105,7 @@ function handleUnexpectedError(err: any, reqId: string, res: express.Response) { logger.error("Middleware error, current response object is", util.inspect(res)); } logger.error(`[${reqId}] !! 500 ${err.stack || err.message || util.inspect(err)}`); - res.status(500).set("X-Replreg-RequestId", reqId).json(bodyToSend); + res.status(500).set("X-Ttlsh-RequestId", reqId).json(bodyToSend); } export const preRequest = (req: express.Request, reqId: string) => { diff --git a/registry/README.md b/registry/README.md index 2f3b8c6..fcaf5b4 100644 --- a/registry/README.md +++ b/registry/README.md @@ -1,4 +1,4 @@ -# replreg registry +# ttl.sh registry -This is the registry server that runs in replreg.is. It's a configured Docker registry, using the registry:2 image. There the confguration installs a hook into the registry, that will fire notifications when an image is pushed. The work to expire and delete images happens in the hook directory. +This is the registry server that runs in ttl.sh. It's a configured Docker registry, using the registry:2 image. There the confguration installs a hook into the registry, that will fire notifications when an image is pushed. The work to expire and delete images happens in the hook directory.