Skip to content

feat: add git commit SHA metadata to all Nomad jobs#1993

Open
joe-lombrozo-s-bot[bot] wants to merge 5 commits intomainfrom
feature/add-git-commit-sha-to-nomad-jobs
Open

feat: add git commit SHA metadata to all Nomad jobs#1993
joe-lombrozo-s-bot[bot] wants to merge 5 commits intomainfrom
feature/add-git-commit-sha-to-nomad-jobs

Conversation

@joe-lombrozo-s-bot
Copy link

Summary

This change adds the git_commit_sha as metadata to all Nomad jobs deployed via Terraform. The commit SHA is passed from GitHub Actions workflows through Terraform variables down to the Nomad job specifications.

Changes

  • Updated deploy-infra.yml and deploy-job.yml workflows to export GIT_COMMIT_SHA
  • Added git_commit_sha to Makefile tf_vars
  • Added git_commit_sha variable to provider-gcp and nomad module variables
  • Added meta block with git_commit_sha to all Nomad job HCL files
  • Updated all module calls to pass git_commit_sha through

Benefits

This enables tracking which git commit is currently deployed for each Nomad job, which helps with:

  • Debugging deployment issues
  • Audit trails
  • Understanding which code version is running in production

Testing

  • Variables default to "unknown" to maintain backward compatibility
  • No breaking changes to existing deployments

This change adds the git_commit_sha as metadata to all Nomad jobs deployed
via Terraform. The commit SHA is passed from GitHub Actions workflows through
Terraform variables down to the Nomad job specifications.

Changes:
- Updated deploy-infra.yml and deploy-job.yml workflows to export GIT_COMMIT_SHA
- Added git_commit_sha to Makefile tf_vars
- Added git_commit_sha variable to provider-gcp and nomad module variables
- Added meta block with git_commit_sha to all Nomad job HCL files
- Updated all module calls to pass git_commit_sha through

This enables tracking which git commit is currently deployed for each Nomad job.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca7d58e982

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

github-actions bot and others added 4 commits February 25, 2026 16:03
Make git_commit_sha required in all job modules to catch missing
pass-throughs at plan time. The root provider-gcp/variables.tf still
has a default for when the env var isn't set during local development.
Uses `git rev-parse --short HEAD` as the default value for GIT_COMMIT_SHA
if not explicitly set via environment variable. Falls back to 'unknown' if
not in a git repository.
Copy link
Contributor

@dobrac dobrac left a comment

Choose a reason for hiding this comment

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

one nit

-include ${ENV_FILE}

# Default to current git commit SHA if not set via environment
GIT_COMMIT_SHA ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't this be annoying for dev where you rebuild just one job, but then run make plan ; make apply?

Copy link
Member

Choose a reason for hiding this comment

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

would it be possible to set up terraform to ignore_changes for this somehow?

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