Skip to content

Add standalone last-deploy tag workflow - #114

Open
Raj Pawar(SRE/DevOps) (rajpawar02) wants to merge 1 commit into
mainfrom
add-last-deploy-tag-workflow
Open

Add standalone last-deploy tag workflow#114
Raj Pawar(SRE/DevOps) (rajpawar02) wants to merge 1 commit into
mainfrom
add-last-deploy-tag-workflow

Conversation

@rajpawar02

Copy link
Copy Markdown

Summary

  • Adds `update-deploy-tag.yml`: triggers on `workflow_run` after "Release" completes successfully, moving a `last-deploy-prod` tag to the released commit.
  • Reproduces the SRE-3491 tracking mechanism the shared `ecs-deployment.yml`/`terraform-ci-cd.yml` provide, standalone here since caterpillar has no ECS/AWS deployment (releases a Go binary + Docker Hub image) -- falls back to tagging on the release/build workflow.
  • Uses `GITHUB_TOKEN` rather than `GHA_RUNNER_TOKEN`: this repo is public, and `GHA_RUNNER_TOKEN` is an org secret scoped to private/internal repos only, so it isn't available here. `GITHUB_TOKEN` + `contents: write` is sufficient since this only pushes a tag within the same repo.

Part of SRE-3523.

Test plan

  • Merge to main, then push a `v*` release tag once and confirm `last-deploy-prod` moves to that commit (workflow_run triggers only fire off the default branch's copy of the workflow file, so this can't be tested pre-merge)

Reproduces the SRE-3491 last-deploy-<env> tagging mechanism as a
standalone workflow triggered after 'Release' completes, since
caterpillar has no ECS/AWS deployment -- it releases a Go binary +
Docker Hub image. Falls back to tagging on the build/release workflow
per SRE-3523's "if deployment not there then on build" guidance.

Uses GITHUB_TOKEN, not GHA_RUNNER_TOKEN: this repo is public and
GHA_RUNNER_TOKEN is an org secret scoped to private/internal repos
only. GITHUB_TOKEN + contents:write is sufficient for a same-repo
tag push.

Part of SRE-3523.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

As written, the workflow can move last-deploy-prod for successful non-release main builds because Release also runs on main pushes, so it needs an explicit guard to only retag on actual release tags.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a repository-local GitHub Actions workflow to maintain a moving “last deployed” tag, aligning caterpillar with the deploy-tracking mechanism used in other repos while avoiding dependencies on ECS/AWS-specific reusable workflows.

Changes:

  • Introduces a new workflow_run-triggered workflow that runs after the Release workflow completes successfully.
  • Uses GITHUB_TOKEN with contents: write to force-move the last-deploy-prod git tag to the released commit.
File summaries
File Description
.github/workflows/update-deploy-tag.yml Adds a workflow that updates the last-deploy-prod tag based on successful Release workflow runs.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +31 to +36
- name: Move last-deploy-prod tag
run: |
TAG_NAME="last-deploy-prod"
echo "Moving ${TAG_NAME} to ${{ github.event.workflow_run.head_sha }}"
git tag -f "$TAG_NAME" "${{ github.event.workflow_run.head_sha }}"
git push origin "refs/tags/$TAG_NAME" --force
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.

2 participants