feat(ci): add deploy pipeline with OIDC, dynamic stack naming, and deploy-intent artifact#98
Draft
scottschreckengaust wants to merge 8 commits into
Draft
feat(ci): add deploy pipeline with OIDC, dynamic stack naming, and deploy-intent artifact#98scottschreckengaust wants to merge 8 commits into
scottschreckengaust wants to merge 8 commits into
Conversation
… tag Aligns CI and CDK terminology with the existing ComputeType union in repo-config.ts. build.yml matrix key, env var, and cdk.context.json key are all renamed from computeVariant to compute_type. The CDK app now reads compute_type from context (default: agentcore) and applies it as a resource tag for per-type baseline diffs and cost attribution. Closes phase 2 items in #73. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a deploy workflow that: - Fires on workflow_run after build.yml succeeds - Resolves deploy targets from PR labels (deploy=all, deploy:<type>=one) or defaults to all registered types on push to main - Skips entirely (no approval prompt) when no deploy labels are present - Downloads the exact cdk-<compute_type>-out artifact from the build run - Uses OIDC to assume the CDK bootstrap deploy role - Deploys via `cdk deploy --app cdk/cdk.out --all --require-approval never` - Protected by the `deploy` GitHub environment (manual approval required) - Concurrency: non-cancellable once started, max-parallel 3 Part of #73 Phase 3. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
build.yml: Replace hardcoded stackName with trigger-aware naming: - push to main: main-<compute_type> - pull_request: pr<number>-<compute_type> - merge_group: mg<pr_number>-<compute_type> - workflow_dispatch: <branch>-<compute_type> - fallback: <compute_type>-<sha7> All inputs sanitized (alphanumeric + hyphens, 60-char branch cap). deploy.yml: Add workflow_dispatch trigger with compute_type choice input (all, agentcore). Handle non-PR triggers (push to main, workflow_dispatch on build) by deploying all registered types. Label-based resolution only applies to PR triggers. Part of #73 Phase 3. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
build.yml now owns the deploy decision via workflow_dispatch choice input: - "-" (default): no deploy - "agentcore": deploy agentcore after build Build always writes a deploy-intent.json artifact encoding the decision: - push to main: intent = compute_type (deploy) - workflow_dispatch with choice: intent = selected value - pull_request: intent = "labels" (defer to deploy.yml label check) - anything else: intent = "-" (no deploy) deploy.yml simplified to a pure consumer: - Removes workflow_dispatch trigger (single entry point is build.yml) - Downloads deploy-intent.json from triggering build run - Reads intent: "-" = skip, "labels" = check PR labels, else = deploy Part of #73 Phase 3. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ypes Addresses 5 security findings: 1. CRITICAL: deploy.yml wildcard case now validates intent against ALLOWED_COMPUTE_TYPES before passing to matrix. Invalid values cause the workflow to fail with an error annotation. 2. MEDIUM: PR label deploy:<type> values are filtered through validate_compute_type(). Invalid labels emit a warning and are ignored rather than passed to the deploy matrix. 3. MEDIUM: sanitize() now lowercases input and prefixes "s-" if the result starts with a digit (CloudFormation requires letter start). 4. LOW: deploy-intent.json is now written with jq (safe JSON encoding) instead of shell string interpolation. 5. LOW: PR_NUMBER is validated as numeric before use in stack names. The ALLOWED_COMPUTE_TYPES allowlist is defined as an env var in each step that performs validation. When new compute types are added to the matrix, this allowlist must be updated in both build.yml and deploy.yml. Part of #73 Phase 3. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 tasks
The file is generated during build and was being picked up by the mutation detection step, causing the build to fail. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the deployment pipeline (Phase 3 of #73) on top of PR #97 (
compute_typerename).Architecture
Commits
compute_typerenamecomputeVariant→compute_typein build.yml, context, CDK tag (from PR #97)Stack Naming
mainmain-<type>main-agentcore<branch>-<type>feat-deploy-yml-agentcorepr<N>-<type>pr42-agentcoremg<N>-<type>mg42-agentcoreworkflow_dispatch<branch>-<type>main-agentcore<type>-<sha7>agentcore-abc1234Sanitization: lowercase,
/_. → -, strip non-[a-z0-9-], collapse hyphens, 60-char cap, prefixs-if starts with digit.Deploy Intent Flow
mainagentcore-workflow_dispatchwith--workflow_dispatchwithagentcoreagentcorepull_requestlabels-Label-Driven Deploy (PR only)
deploydeploy:agentcoreagentcoreonlydeploy:*deploy*labelLabel values are validated against
ALLOWED_COMPUTE_TYPES. Invalid labels emit a warning and are silently dropped.Security
choicetype — enforced at UI and APIALLOWED_COMPUTE_TYPESenv var;validate_compute_type()filter_valid_types()rejects invaliddeploy:<type>labels^[0-9]+$check before usejq -n --arg(not shell interpolation)env:, never inrun:directlypermissions: {}at top; least-privilege per jobdeployenvironment with manual approval, prevent self-reviewcancel-in-progress: falseonce deployment startsTest plan
github-tags.test.ts— 5/5 pass (compute_type tag defaults + explicit)workflow_dispatchbuild withdeploy: agentcoredeploylabeldeploy:foolabel emits warning and is ignoredNot in scope (future work)
cdk diffoutput to step summarycleanup.yml)🤖 Generated with Claude Code