From 05d3ca10cdda4a57feee464d589eb4159e070a1e Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Mon, 21 Nov 2022 16:19:46 +0000 Subject: [PATCH 01/14] GHA workflow to build complement images of key branches. --- .github/workflows/complement.yml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/complement.yml diff --git a/.github/workflows/complement.yml b/.github/workflows/complement.yml new file mode 100644 index 000000000000..0a36baaf5bc4 --- /dev/null +++ b/.github/workflows/complement.yml @@ -0,0 +1,36 @@ +# This task does not run complement tests, see tests.yaml instead. +# This task does not build docker images for synapse for use on docker hub, see docker.yaml instead + +name: Store complement synapse image in ghcr.io +on: + push: + branches: ["main", "develop", "michaelk/push_complement_image"] # TODO do not pass PR review with this in place. +jobs: + build: + name: Build and push complement image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout clean copy + uses: actions/checkout@v3 + - name: Login to registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Work out labels for complement image + id: meta + uses: docker/metadata-action@v1 + with: + images: ghcr.io/${{ github.repository }}/complement-synapse + - name: Build complement image + run: scripts-dev/complement.sh --build-only + - name: Tag and push generated image + run: | + for TAG in ${{ steps.meta.outputs.tags }}; do + docker tag complement-synapse:latest $TAG + docker push $TAG + done From 240087e1a3b65f3048b01aa1a4342becad205b78 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Mon, 21 Nov 2022 17:17:46 +0000 Subject: [PATCH 02/14] Add changelog.d --- changelog.d/14509.docker | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/14509.docker diff --git a/changelog.d/14509.docker b/changelog.d/14509.docker new file mode 100644 index 000000000000..ba8b02d0b655 --- /dev/null +++ b/changelog.d/14509.docker @@ -0,0 +1 @@ +Push complement-synapse docker images to ghcr.io repository. From d0a007f3c101802744cdcc470d5dc0d9f9953980 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Mon, 21 Nov 2022 16:19:46 +0000 Subject: [PATCH 03/14] GHA workflow to build complement images of key branches. --- .github/workflows/complement.yml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/complement.yml diff --git a/.github/workflows/complement.yml b/.github/workflows/complement.yml new file mode 100644 index 000000000000..0a36baaf5bc4 --- /dev/null +++ b/.github/workflows/complement.yml @@ -0,0 +1,36 @@ +# This task does not run complement tests, see tests.yaml instead. +# This task does not build docker images for synapse for use on docker hub, see docker.yaml instead + +name: Store complement synapse image in ghcr.io +on: + push: + branches: ["main", "develop", "michaelk/push_complement_image"] # TODO do not pass PR review with this in place. +jobs: + build: + name: Build and push complement image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout clean copy + uses: actions/checkout@v3 + - name: Login to registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Work out labels for complement image + id: meta + uses: docker/metadata-action@v1 + with: + images: ghcr.io/${{ github.repository }}/complement-synapse + - name: Build complement image + run: scripts-dev/complement.sh --build-only + - name: Tag and push generated image + run: | + for TAG in ${{ steps.meta.outputs.tags }}; do + docker tag complement-synapse:latest $TAG + docker push $TAG + done From 5fdeac3a8d63870d742074abdaca07c58986c015 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Mon, 21 Nov 2022 17:17:46 +0000 Subject: [PATCH 04/14] Add changelog.d --- changelog.d/14509.docker | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/14509.docker diff --git a/changelog.d/14509.docker b/changelog.d/14509.docker new file mode 100644 index 000000000000..ba8b02d0b655 --- /dev/null +++ b/changelog.d/14509.docker @@ -0,0 +1 @@ +Push complement-synapse docker images to ghcr.io repository. From 7f55ed7086ffff34f6a45502165999bb1e07338a Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Wed, 23 Nov 2022 15:29:10 +0000 Subject: [PATCH 05/14] Update complement.yml Remove special casing for michaelk branch. --- .github/workflows/complement.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/complement.yml b/.github/workflows/complement.yml index 0a36baaf5bc4..bf4f5cfe4140 100644 --- a/.github/workflows/complement.yml +++ b/.github/workflows/complement.yml @@ -4,7 +4,7 @@ name: Store complement synapse image in ghcr.io on: push: - branches: ["main", "develop", "michaelk/push_complement_image"] # TODO do not pass PR review with this in place. + branches: ["main", "develop"] jobs: build: name: Build and push complement image From c3575258b76b2323792c893267e0cb8a1b307de4 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Wed, 23 Nov 2022 15:56:15 +0000 Subject: [PATCH 06/14] Update complement.yml Should run on master, develop not main, develop --- .github/workflows/complement.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/complement.yml b/.github/workflows/complement.yml index bf4f5cfe4140..2d63fb34e1d3 100644 --- a/.github/workflows/complement.yml +++ b/.github/workflows/complement.yml @@ -4,7 +4,7 @@ name: Store complement synapse image in ghcr.io on: push: - branches: ["main", "develop"] + branches: ["master", "develop"] jobs: build: name: Build and push complement image From 3b2348d6a60692519a7285fbbf49a230970ff636 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Thu, 24 Nov 2022 15:20:52 +0000 Subject: [PATCH 07/14] Rename file to be more obvious --- .github/workflows/{complement.yml => push_complement_image.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{complement.yml => push_complement_image.yml} (100%) diff --git a/.github/workflows/complement.yml b/.github/workflows/push_complement_image.yml similarity index 100% rename from .github/workflows/complement.yml rename to .github/workflows/push_complement_image.yml From 45c5fd3147fd15f9799ca701df21a8afe2bdaf2f Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Thu, 24 Nov 2022 15:29:26 +0000 Subject: [PATCH 08/14] Merge did not go correctly. --- .github/workflows/complement.yml | 36 --------------------- .github/workflows/push_complement_image.yml | 2 +- 2 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 .github/workflows/complement.yml diff --git a/.github/workflows/complement.yml b/.github/workflows/complement.yml deleted file mode 100644 index 2d63fb34e1d3..000000000000 --- a/.github/workflows/complement.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This task does not run complement tests, see tests.yaml instead. -# This task does not build docker images for synapse for use on docker hub, see docker.yaml instead - -name: Store complement synapse image in ghcr.io -on: - push: - branches: ["master", "develop"] -jobs: - build: - name: Build and push complement image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout clean copy - uses: actions/checkout@v3 - - name: Login to registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Work out labels for complement image - id: meta - uses: docker/metadata-action@v1 - with: - images: ghcr.io/${{ github.repository }}/complement-synapse - - name: Build complement image - run: scripts-dev/complement.sh --build-only - - name: Tag and push generated image - run: | - for TAG in ${{ steps.meta.outputs.tags }}; do - docker tag complement-synapse:latest $TAG - docker push $TAG - done diff --git a/.github/workflows/push_complement_image.yml b/.github/workflows/push_complement_image.yml index 0a36baaf5bc4..2d63fb34e1d3 100644 --- a/.github/workflows/push_complement_image.yml +++ b/.github/workflows/push_complement_image.yml @@ -4,7 +4,7 @@ name: Store complement synapse image in ghcr.io on: push: - branches: ["main", "develop", "michaelk/push_complement_image"] # TODO do not pass PR review with this in place. + branches: ["master", "develop"] jobs: build: name: Build and push complement image From 5174c342f3438b4a604da8da2dd46512b35d37fd Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Fri, 25 Nov 2022 16:58:10 +0000 Subject: [PATCH 09/14] Setup 5am builds of develop, limit to one run at once. --- .github/workflows/push_complement_image.yml | 22 +++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push_complement_image.yml b/.github/workflows/push_complement_image.yml index 2d63fb34e1d3..ed08b5be3149 100644 --- a/.github/workflows/push_complement_image.yml +++ b/.github/workflows/push_complement_image.yml @@ -4,7 +4,17 @@ name: Store complement synapse image in ghcr.io on: push: - branches: ["master", "develop"] + branches: ["master"] + schedule: + - '* 5 * * *' + +# Only run this action once per pull request/branch; restart if a new commit arrives. +# C.f. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency +# and https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: name: Build and push complement image @@ -13,8 +23,16 @@ jobs: contents: read packages: write steps: - - name: Checkout clean copy + - name: Checkout clean copy of develop (scheduled build) uses: actions/checkout@v3 + if: 'github.event.type == "schedule"' + with: + ref: develop + - name: Checkout clean copy of master (on-push) + uses: actions/checkout@v3 + if: 'github.event.type != "schedule"' + with: + ref: master - name: Login to registry uses: docker/login-action@v1 with: From ac0013966240875745f66099ca6b405a266fb023 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 28 Nov 2022 12:21:32 +0000 Subject: [PATCH 10/14] Fix crontab---run once at 5AM, not very minute between 5 and 6 --- .github/workflows/push_complement_image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push_complement_image.yml b/.github/workflows/push_complement_image.yml index ed08b5be3149..42e0a5b865d1 100644 --- a/.github/workflows/push_complement_image.yml +++ b/.github/workflows/push_complement_image.yml @@ -6,7 +6,7 @@ on: push: branches: ["master"] schedule: - - '* 5 * * *' + - '0 5 * * *' # Only run this action once per pull request/branch; restart if a new commit arrives. # C.f. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency From 22abe0dfd382a6fe5b000ec3343018324e87371a Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 28 Nov 2022 12:28:03 +0000 Subject: [PATCH 11/14] Fix cron syntax again? --- .github/workflows/push_complement_image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push_complement_image.yml b/.github/workflows/push_complement_image.yml index 42e0a5b865d1..7553e57a91e0 100644 --- a/.github/workflows/push_complement_image.yml +++ b/.github/workflows/push_complement_image.yml @@ -6,7 +6,7 @@ on: push: branches: ["master"] schedule: - - '0 5 * * *' + - cron: '0 5 * * *' # Only run this action once per pull request/branch; restart if a new commit arrives. # C.f. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency From 7daa0537f4ba5627acba35de1346eecf3d492065 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 28 Nov 2022 12:40:33 +0000 Subject: [PATCH 12/14] Tweak workflow name --- .github/workflows/push_complement_image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push_complement_image.yml b/.github/workflows/push_complement_image.yml index 7553e57a91e0..3874bec76630 100644 --- a/.github/workflows/push_complement_image.yml +++ b/.github/workflows/push_complement_image.yml @@ -1,7 +1,7 @@ # This task does not run complement tests, see tests.yaml instead. # This task does not build docker images for synapse for use on docker hub, see docker.yaml instead -name: Store complement synapse image in ghcr.io +name: Store complement-synapse image in ghcr.io on: push: branches: ["master"] From 608e81491c1e18d8ccd6fbf5936a91e5267b3391 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 28 Nov 2022 12:41:44 +0000 Subject: [PATCH 13/14] Allow manual debug runs --- .github/workflows/push_complement_image.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push_complement_image.yml b/.github/workflows/push_complement_image.yml index 3874bec76630..ffedd8656e4f 100644 --- a/.github/workflows/push_complement_image.yml +++ b/.github/workflows/push_complement_image.yml @@ -7,6 +7,15 @@ on: branches: ["master"] schedule: - cron: '0 5 * * *' + workflow_dispatch: + inputs: + branch: + required: true + default: 'develop' + type: choice + options: + - develop + - master # Only run this action once per pull request/branch; restart if a new commit arrives. # C.f. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency @@ -23,6 +32,11 @@ jobs: contents: read packages: write steps: + - name: Checkout specific branch (debug build) + uses: actions/checkout@v3 + if: 'github.event.type == "workflow_dispatch"' + with: + ref: ${{ inputs.branch }} - name: Checkout clean copy of develop (scheduled build) uses: actions/checkout@v3 if: 'github.event.type == "schedule"' @@ -30,7 +44,7 @@ jobs: ref: develop - name: Checkout clean copy of master (on-push) uses: actions/checkout@v3 - if: 'github.event.type != "schedule"' + if: 'github.event.type == "push"' with: ref: master - name: Login to registry From 95c69437037534036773b4734dc61016ce6ffe49 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 28 Nov 2022 12:42:06 +0000 Subject: [PATCH 14/14] Tweak indentation Ctrl-Alt-L in PyCharm --- .github/workflows/push_complement_image.yml | 76 ++++++++++----------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/.github/workflows/push_complement_image.yml b/.github/workflows/push_complement_image.yml index ffedd8656e4f..937bbcbad06a 100644 --- a/.github/workflows/push_complement_image.yml +++ b/.github/workflows/push_complement_image.yml @@ -4,9 +4,9 @@ name: Store complement-synapse image in ghcr.io on: push: - branches: ["master"] - schedule: - - cron: '0 5 * * *' + branches: [ "master" ] + schedule: + - cron: '0 5 * * *' workflow_dispatch: inputs: branch: @@ -24,7 +24,7 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -jobs: +jobs: build: name: Build and push complement image runs-on: ubuntu-latest @@ -32,37 +32,37 @@ jobs: contents: read packages: write steps: - - name: Checkout specific branch (debug build) - uses: actions/checkout@v3 - if: 'github.event.type == "workflow_dispatch"' - with: - ref: ${{ inputs.branch }} - - name: Checkout clean copy of develop (scheduled build) - uses: actions/checkout@v3 - if: 'github.event.type == "schedule"' - with: - ref: develop - - name: Checkout clean copy of master (on-push) - uses: actions/checkout@v3 - if: 'github.event.type == "push"' - with: - ref: master - - name: Login to registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Work out labels for complement image - id: meta - uses: docker/metadata-action@v1 - with: - images: ghcr.io/${{ github.repository }}/complement-synapse - - name: Build complement image - run: scripts-dev/complement.sh --build-only - - name: Tag and push generated image - run: | - for TAG in ${{ steps.meta.outputs.tags }}; do - docker tag complement-synapse:latest $TAG - docker push $TAG - done + - name: Checkout specific branch (debug build) + uses: actions/checkout@v3 + if: 'github.event.type == "workflow_dispatch"' + with: + ref: ${{ inputs.branch }} + - name: Checkout clean copy of develop (scheduled build) + uses: actions/checkout@v3 + if: 'github.event.type == "schedule"' + with: + ref: develop + - name: Checkout clean copy of master (on-push) + uses: actions/checkout@v3 + if: 'github.event.type == "push"' + with: + ref: master + - name: Login to registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Work out labels for complement image + id: meta + uses: docker/metadata-action@v1 + with: + images: ghcr.io/${{ github.repository }}/complement-synapse + - name: Build complement image + run: scripts-dev/complement.sh --build-only + - name: Tag and push generated image + run: | + for TAG in ${{ steps.meta.outputs.tags }}; do + docker tag complement-synapse:latest $TAG + docker push $TAG + done