Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix GHA job for pushing the complement-synapse image #14573

Merged
merged 9 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .github/workflows/push_complement_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ jobs:
steps:
- name: Checkout specific branch (debug build)
uses: actions/checkout@v3
if: 'github.event.type == "workflow_dispatch"'
if: github.event_name == 'workflow_dispatch'
with:
ref: ${{ inputs.branch }}
- name: Checkout clean copy of develop (scheduled build)
uses: actions/checkout@v3
if: 'github.event.type == "schedule"'
if: github.event_name == 'schedule'
with:
ref: develop
- name: Checkout clean copy of master (on-push)
uses: actions/checkout@v3
if: 'github.event.type == "push"'
if: github.event_name == 'push'
with:
ref: master
- name: Login to registry
Expand All @@ -55,14 +55,20 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Work out labels for complement image
id: meta
uses: docker/metadata-action@v1
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}/complement-synapse
- name: Build complement image
tags: |
type=schedule,pattern=nightly,enable=${{ github.event_name == 'schedule'}}
type=raw,value=develop,enable=${{ github.event_name == 'schedule' || inputs.branch == 'develop' }}
type=raw,value=latest,enable=${{ github.event_name == 'push' || inputs.branch == 'master' }}
Comment on lines +63 to +64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type=raw,value=develop,enable=${{ github.event_name == 'schedule' || inputs.branch == 'develop' }}
type=raw,value=latest,enable=${{ github.event_name == 'push' || inputs.branch == 'master' }}
type=raw,value=develop,enable=${{ github.event_name == 'schedule' && inputs.branch == 'develop' }}
type=raw,value=latest,enable=${{ github.event_name == 'push' && inputs.branch == 'master' }}
type=raw,value=latest,enable=${{ github.event_name == 'push' && inputs.branch == 'main' }}

I think AND semantics are right here; in case we add more ways this can be run later. Also adding main in here to match the docker.yml setup?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe even only care about inputs.branch ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inputs.branch is only set when this workflow is triggered via workflow_dispatch---it corresponds to lines 12--18. So I think we need the OR here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the workflow_dispatch is only meant for testing's sake, I wouldn't expect to use it very often once it's working

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh gods, i hate github's events stuff sometimes :| You're right, we need the OR.

Though adding the main option might be useful for completeness?

type=sha,format=long
- name: Run scripts-dev/complement.sh to generate complement-synapse:latest 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
for TAG in ${{ join(fromJson(steps.meta.outputs.json).tags, ' ') }}; do
echo "tag and push $TAG"
docker tag complement-synapse $TAG
docker push $TAG
done
File renamed without changes.
1 change: 1 addition & 0 deletions changelog.d/14573.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Push complement-synapse docker images to ghcr.io repository.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the existing .docker readme to .misc. I think .docker is limited to "the" docker image that we expect server operators to use. This is an internal testing tool only.