Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
needs: prepare-matrix
if: needs.prepare-matrix.outputs.matrix != '{"service":[]}'
runs-on: athelas-rops-2c4g
environment: ${{ github.event.ref == 'refs/heads/main' && 'gcp-artifacts-rw' || 'gcp-artifacts-ro' }}
environment: ${{ github.event.ref == 'refs/heads/master' && 'gcp-artifacts-rw' || 'gcp-artifacts-ro' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The workflow triggers on the main branch but checks for master in its conditional logic, which will prevent Docker images from being published on push.
Severity: HIGH

Suggested Fix

Align the branch names. Either change the trigger branches in the on: block from main to master, or change the conditional checks from refs/heads/master to refs/heads/main to match the trigger.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/containers.yaml#L65

Potential issue: The workflow is configured to trigger on pushes to the `main` branch.
However, the conditional logic for setting the environment and publishing the image
checks if the branch is `refs/heads/master`. Because of this mismatch, when code is
pushed to `main`, the `publish_image` input will evaluate to `false` and the environment
will be set to read-only (`gcp-artifacts-ro`). As a result, Docker images will be built
but will silently fail to publish to the artifact registry.

Did we get this right? 👍 / 👎 to inform future reviews.

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
Expand All @@ -79,6 +79,6 @@ jobs:
cache_scope: main
gar_repository: ${{ matrix.service.name }}
gar_registry: us-central1-docker.pkg.dev/athelas-rcm/norm
publish_image: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
publish_image: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
ssh_key: ${{ secrets.COMMURE_LIBRARY_SECRET }}

Loading