Skip to content

Generalize the processing image buildspec by mission - #20

Merged
jamesray merged 1 commit into
mainfrom
jamesray/processing-buildspec
Sep 9, 2026
Merged

jamesray merged 1 commit into
mainfrom
jamesray/processing-buildspec

Conversation

@jamesray

@jamesray jamesray commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Buildspec only. This is the buildspec.yml from #13 on a clean branch off main, without the workflow, AGENTS.md, and README edits that were bundled there.

What the buildspec does now:

  • big, easy-to-scan banner at the start of every build showing environment, mission, service, trigger, project, build number, and commit (no secret values)
  • classifies main/tag/PR from CodeBuild metadata (webhook trigger, source version, head ref) with a git describe/origin/main fallback; PR and feature-branch builds announce they are validation-only and exit before touching ECR
  • stale main builds (HEAD no longer equals origin/main) skip publishing instead of racing a newer build
  • publishes latest plus an immutable tag (YYYYmmddHHMMSS on main, the git tag on releases), validated against Docker's tag rules
  • after the push it starts the mission's build_<mission>_sdc_aws_pipeline_architecture project with MISSION, CDK_ENVIRONMENT, LAMBDA_PIPELINE=PROCESSING, and TAG=<immutable tag>, so Terraform deploys exactly that image

Ordering: the architecture project has to be running its buildspec.yml from swxsoc/sdc_aws_architecture#38 for the handoff to do a targeted deploy. Until then this buildspec still builds and pushes correctly; only the final start-build lands on a project that ignores the extra variables.

Checks: YAML parses and every embedded shell block passes bash -n; git diff --check clean.

🤖 Generated with Claude Code

Classify main, tag, and pull-request builds from CodeBuild metadata,
publish an immutable image tag alongside latest, refuse to deploy from
anything but main or a release tag, and hand off to the mission's
architecture project with MISSION, CDK_ENVIRONMENT, LAMBDA_PIPELINE,
and the exact tag just pushed. Buildspec only; the workflow and doc
edits from #13 are left out.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 9, 2026 18:49
@jamesray
jamesray merged commit 3da86c9 into main Sep 9, 2026
8 checks passed

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

The downstream start-build variable name mismatch (MISSION_NAME vs MISSION) can break the deployment handoff contract described in the PR metadata.

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

Pull request overview

This PR updates the CodeBuild buildspec.yml for the processing Lambda image to be mission-aware and safer to run across different triggers, while only publishing/deploying from the correct main commit or a release tag.

Changes:

  • Adds a standardized build banner and stricter gating to skip PR/branch/stale-main builds before any ECR publishing.
  • Derives mission from the CodeBuild project name, selects the correct base image + requirements file, and enforces Docker tag validity.
  • Publishes latest plus an immutable tag, then triggers the mission-specific architecture CodeBuild project with deployment parameters.
File summaries
File Description
buildspec.yml Reworks CodeBuild logic to be mission-derived, guarded by trigger/source checks, and to publish + hand off deployments with an immutable tag.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • 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 thread buildspec.yml
Comment on lines +252 to +256
--environment-variables-override \
name=CDK_ENVIRONMENT,value="${CDK_ENVIRONMENT}",type=PLAINTEXT \
name=MISSION_NAME,value="${MISSION_NAME}",type=PLAINTEXT \
name=LAMBDA_PIPELINE,value="${LAMBDA_PIPELINE}",type=PLAINTEXT \
name=TAG,value="${VERSION}",type=PLAINTEXT
Comment thread buildspec.yml
tag/*|refs/tags/*) BANNER_ENVIRONMENT=PRODUCTION ;;
branch/main|main|refs/heads/main) BANNER_ENVIRONMENT=DEVELOPMENT ;;
pr/*|refs/pull/*|branch/*|refs/heads/*) BANNER_ENVIRONMENT=VALIDATION ;;
*) BANNER_ENVIRONMENT=UNRESOLVED ;;
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