Skip to content

Commit dbcb1c8

Browse files
committed
Address latest cpflow review polish
1 parent e8e13d0 commit dbcb1c8

5 files changed

Lines changed: 35 additions & 7 deletions

File tree

.controlplane/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ After the review app exists, new pushes to the PR redeploy it automatically.
380380
Use `/delete-review-app` to delete it manually; closing the PR deletes it
381381
automatically. Pushes to the staging branch deploy staging, and production
382382
promotion is manual from the `cpflow-promote-staging-to-production` workflow.
383+
If staging moves off `master`, update both the `STAGING_APP_BRANCH` repository
384+
variable and the `branches:` filter in `.github/workflows/cpflow-deploy-staging.yml`;
385+
GitHub does not allow repository variables in trigger branch filters.
383386
The production promotion workflow checks that production has all environment
384387
variable names present in staging; it does not compare secret values, workload
385388
environment variables, or Control Plane secret references.

.github/actions/cpflow-build-docker-image/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ inputs:
2121
description: Optional private SSH key used for Docker builds that fetch private dependencies with RUN --mount=type=ssh
2222
required: false
2323
docker_build_ssh_known_hosts:
24-
description: Optional SSH known_hosts entries used with docker_build_ssh_key. Defaults to pinned GitHub.com host keys.
24+
description: Optional SSH known_hosts entries used with docker_build_ssh_key. Defaults to pinned GitHub.com host keys; override if GitHub rotates keys or your build uses another SSH host.
2525
required: false
2626

2727
runs:
@@ -50,6 +50,8 @@ runs:
5050
if [[ -n "${DOCKER_BUILD_SSH_KNOWN_HOSTS}" ]]; then
5151
printf '%s\n' "${DOCKER_BUILD_SSH_KNOWN_HOSTS}" > ~/.ssh/known_hosts
5252
else
53+
# GitHub.com host keys verified against GitHub's published keys on 2026-05-01.
54+
# Override docker_build_ssh_known_hosts if GitHub rotates keys again.
5355
printf '%s\n' \
5456
'github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl' \
5557
'github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=' \

.github/workflows/cpflow-deploy-review-app.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened]
88
issue_comment:
9+
# Slash-command workflow changes run from the default branch until merged.
10+
# Test PR-branch edits with:
11+
# gh workflow run cpflow-deploy-review-app.yml --ref <branch> -f pr_number=<pr-number>
912
types: [created]
1013
workflow_dispatch:
1114
inputs:
@@ -282,6 +285,8 @@ jobs:
282285
ref: process.env.PR_SHA,
283286
environment: `review/${process.env.APP_NAME}`,
284287
auto_merge: false,
288+
// Review apps intentionally deploy on demand regardless of CI status;
289+
// they are ephemeral feedback environments, not branch-protection gates.
285290
required_contexts: [],
286291
description: `Control Plane review app for PR #${process.env.PR_NUMBER}`
287292
});

.github/workflows/cpflow-promote-staging-to-production.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,24 @@ concurrency:
4040
cancel-in-progress: false
4141

4242
jobs:
43+
validate-confirmation:
44+
runs-on: ubuntu-latest
45+
timeout-minutes: 5
46+
steps:
47+
- name: Validate promotion confirmation
48+
env:
49+
CONFIRM_PROMOTION: ${{ github.event.inputs.confirm_promotion }}
50+
shell: bash
51+
run: |
52+
set -euo pipefail
53+
54+
if [[ "${CONFIRM_PROMOTION}" != "promote" ]]; then
55+
echo "::error::Promotion confirmation must be exactly 'promote'."
56+
exit 1
57+
fi
58+
4359
promote-to-production:
44-
if: github.event.inputs.confirm_promotion == 'promote'
60+
needs: validate-confirmation
4561
runs-on: ubuntu-latest
4662
timeout-minutes: 45
4763

@@ -175,7 +191,9 @@ jobs:
175191
[[ -n "${workload_name}" ]] || continue
176192
177193
workload_json="$(cpln workload get "${workload_name}" --gvc "${PRODUCTION_APP_NAME}" --org "${CPLN_ORG_PRODUCTION}" -o json)"
178-
workload_image="$(echo "${workload_json}" | jq -r '.spec.containers[0].image')"
194+
# current_image/current_version are summary fields for the first container
195+
# of the selected workload; rollback_state below captures all containers.
196+
workload_image="$(echo "${workload_json}" | jq -r '.spec.containers[0].image')"
179197
workload_containers="$(echo "${workload_json}" | jq -c '.spec.containers | map({name, image})')"
180198
workload_version="$(echo "${workload_json}" | jq -r '.version')"
181199
@@ -215,15 +233,14 @@ jobs:
215233
216234
- name: Copy image from staging
217235
env:
218-
# cpflow 4.2.x requires the upstream token flag; keep the secret sourced
219-
# from env so it is still masked by GitHub logs.
236+
# cpflow reads this env var directly, avoiding token exposure in argv.
220237
CPLN_UPSTREAM_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
221238
PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
222239
CPLN_ORG_PRODUCTION: ${{ vars.CPLN_ORG_PRODUCTION }}
223240
shell: bash
224241
run: |
225242
set -euo pipefail
226-
cpflow copy-image-from-upstream -a "${PRODUCTION_APP_NAME}" -t "${CPLN_UPSTREAM_TOKEN}" --org "${CPLN_ORG_PRODUCTION}"
243+
cpflow copy-image-from-upstream -a "${PRODUCTION_APP_NAME}" --org "${CPLN_ORG_PRODUCTION}"
227244
228245
- name: Deploy image to production
229246
env:
@@ -390,6 +407,6 @@ jobs:
390407
echo "❌ Status: deployment failed"
391408
fi
392409
echo
393-
echo "Previous image: \`${PREVIOUS_IMAGE}\`"
410+
echo "Previous image (first container of selected/first workload): \`${PREVIOUS_IMAGE}\`"
394411
echo "Previous version: ${PREVIOUS_VERSION}"
395412
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/cpflow-review-app-help.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
types: [opened]
1010

1111
permissions:
12+
contents: read
1213
issues: write
1314
pull-requests: write
1415

0 commit comments

Comments
 (0)