From 6cc8b14f04e6efd5a73b019fe299ee4d9a63b7d0 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Wed, 9 Jun 2021 16:08:26 -0400 Subject: [PATCH 1/3] ci: enable custom tagging of release docker image --- .github/workflows/publish-canary.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index 5669f25dabd7..db4912f5f624 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -2,7 +2,12 @@ name: Publish Packages (canary) on: # enable users to manually trigger with workflow_dispatch - workflow_dispatch: {} + workflow_dispatch: + inputs: + canaryImageName: + description: 'Docker Image Tag (keep empty for git hash) — DANGER: This can override public images, be careful!' + required: false + default: '0.0.0-rc-0' jobs: canary-publish: @@ -155,7 +160,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.message-relayer push: true - tags: ethereumoptimism/message-relayer:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/message-relayer:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} batch-submitter: name: Publish Batch Submitter Version ${{ needs.builder.outputs.batch-submitter }} @@ -181,7 +186,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.batch-submitter push: true - tags: ethereumoptimism/batch-submitter:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/batch-submitter:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} data-transport-layer: name: Publish Data Transport Layer Version ${{ needs.builder.outputs.data-transport-layer }} @@ -207,7 +212,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.data-transport-layer push: true - tags: ethereumoptimism/data-transport-layer:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/data-transport-layer:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} contracts: name: Publish Deployer Version ${{ needs.builder.outputs.contracts }} @@ -233,7 +238,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.deployer push: true - tags: ethereumoptimism/deployer:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/deployer:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} integration_tests: name: Publish Integration tests ${{ needs.builder.outputs.integration-tests }} @@ -259,4 +264,4 @@ jobs: context: . file: ./ops/docker/Dockerfile.integration-tests push: true - tags: ethereumoptimism/integration-tests:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/integration-tests:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} From 49e5160556e409da9e9eb1579f21ca989c06672b Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Wed, 9 Jun 2021 16:28:11 -0400 Subject: [PATCH 2/3] ci: refactor to add prerelease prefix for secuirty --- .github/workflows/publish-canary.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index db4912f5f624..a90fea7f1d01 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -4,8 +4,8 @@ on: # enable users to manually trigger with workflow_dispatch workflow_dispatch: inputs: - canaryImageName: - description: 'Docker Image Tag (keep empty for git hash) — DANGER: This can override public images, be careful!' + customImageName: + description: 'Cusotm Docker Image Tag (keep empty for git hash)' required: false default: '0.0.0-rc-0' @@ -71,6 +71,19 @@ jobs: run: | node ops/scripts/ci-versions.js ${{ toJSON(steps.changesets.outputs.publishedPackages) }} + - name: Docker Image Name + id: docker_image_name + run: | + if [ $CUSTOM_IMAGE_NAME == '' ] + then + echo "::set-output name=canary-docker-tag::$GITHUB_SHA_PREFIX" + else + echo "::set-output name=canary-docker-tag::prerelease-$CUSTOM_IMAGE_NAME" + fi + env: + GITHUB_SHA_PREFIX: ${{ GITHUB_SHA::8 }} + CUSTOM_IMAGE_NAME: ${{ github.event.inputs.customImageName }} + # The below code is duplicated, would be ideal if we could use a matrix with a # key/value being dynamically generated from the `publishedPackages` output @@ -160,7 +173,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.message-relayer push: true - tags: ethereumoptimism/message-relayer:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} + tags: ethereumoptimism/message-relayer:${{ steps.docker_image_name.outputs.canary-docker-tag }} batch-submitter: name: Publish Batch Submitter Version ${{ needs.builder.outputs.batch-submitter }} @@ -186,7 +199,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.batch-submitter push: true - tags: ethereumoptimism/batch-submitter:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} + tags: ethereumoptimism/batch-submitter:${{ steps.docker_image_name.outputs.canary-docker-tag }} data-transport-layer: name: Publish Data Transport Layer Version ${{ needs.builder.outputs.data-transport-layer }} @@ -212,7 +225,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.data-transport-layer push: true - tags: ethereumoptimism/data-transport-layer:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} + tags: ethereumoptimism/data-transport-layer:${{ steps.docker_image_name.outputs.canary-docker-tag }} contracts: name: Publish Deployer Version ${{ needs.builder.outputs.contracts }} @@ -238,7 +251,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.deployer push: true - tags: ethereumoptimism/deployer:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} + tags: ethereumoptimism/deployer:${{ steps.docker_image_name.outputs.canary-docker-tag }} integration_tests: name: Publish Integration tests ${{ needs.builder.outputs.integration-tests }} @@ -264,4 +277,4 @@ jobs: context: . file: ./ops/docker/Dockerfile.integration-tests push: true - tags: ethereumoptimism/integration-tests:${{ github.event.inputs.canaryImageName == '' && GITHUB_SHA::8 || github.event.inputs.canaryImageName }} + tags: ethereumoptimism/integration-tests:${{ steps.docker_image_name.outputs.canary-docker-tag }} From 3d5d78dd4e2f7a9956b522350ba95e0776a1cd87 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Wed, 9 Jun 2021 16:28:52 -0400 Subject: [PATCH 3/3] doc: typo --- .github/workflows/publish-canary.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index a90fea7f1d01..4bb0ff10cbc6 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: inputs: customImageName: - description: 'Cusotm Docker Image Tag (keep empty for git hash)' + description: 'Custom Docker Image Tag (keep empty for git hash)' required: false default: '0.0.0-rc-0'