Skip to content

chore(gocd): use GitHub App credentials - #351

Merged
oioki merged 5 commits into
masterfrom
chore/github-app-gocd
Oct 13, 2026
Merged

oioki merged 5 commits into
masterfrom
chore/github-app-gocd

Conversation

@joshuarli

Copy link
Copy Markdown
Member

Replace GoCD GitHub token references with GitHub App credentials.

  • Pass GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY to GoCD jobs.
  • Preserve legacy runtime compatibility where the existing helper supports it.

@joshuarli
joshuarli marked this pull request as ready for review September 3, 2026 23:20
Comment thread gocd/pipelines/reload.yaml
build-production:
runs-on: ubuntu-24.04
if: github.ref_name == github.event.repository.default_branch
if: github.event_name == 'pull_request' || github.ref_name == github.event.repository.default_branch

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 change allows pull requests to trigger a job that may overwrite the production :latest Docker image, as there is no condition to prevent this.
Severity: CRITICAL

Suggested Fix

Add a condition to the image push steps to ensure they only execute on pushes to the default branch, not on pull request events. For example, change the step's condition to if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch. This will prevent PRs from overwriting the production image.

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/image.yml#L12

Potential issue: The workflow condition was changed to `if: github.event_name ==
'pull_request' || github.ref_name == github.event.repository.default_branch`, allowing
the `build-production` job to run on pull requests. This job pushes to production Google
Artifact Registries and uses `tag_latest: true`. Because there is no explicit condition
to prevent pushes on pull request events, a build triggered by a PR could overwrite the
production `:latest` Docker image. This could result in an unvetted or unstable version
of the application being deployed to production.

@joshuarli
joshuarli enabled auto-merge (squash) October 6, 2026 21:44
@oioki
oioki disabled auto-merge October 13, 2026 17:07
@oioki
oioki merged commit 82c360b into master Oct 13, 2026
18 checks passed
@oioki
oioki deleted the chore/github-app-gocd branch October 13, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants