cpflow 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.agents/bin/README.md +3 -2
- data/.agents/bin/docs +2 -1
- data/.agents/bin/lint +2 -1
- data/.agents/shaka/bin/setup +6 -0
- data/.agents/shaka/bin/test +6 -0
- data/.agents/shaka/bin/validate +7 -0
- data/.agents/{agent-workflow.yml → shaka/config.yml} +1 -1
- data/.agents/shaka.md +3 -2
- data/.github/actions/cpflow-setup-environment/action.yml +1 -1
- data/.github/dependabot.yml +10 -5
- data/.github/scripts/deployment_lock.py +141 -0
- data/.github/workflows/claude-code-review.yml +1 -1
- data/.github/workflows/claude.yml +1 -1
- data/.github/workflows/command_docs.yml +1 -1
- data/.github/workflows/cpflow-cleanup-stale-review-apps.yml +4 -11
- data/.github/workflows/cpflow-delete-review-app.yml +6 -13
- data/.github/workflows/cpflow-deploy-review-app.yml +225 -108
- data/.github/workflows/cpflow-deploy-staging.yml +5 -11
- data/.github/workflows/cpflow-promote-staging-to-production.yml +7 -7
- data/.github/workflows/rspec-shared.yml +3 -3
- data/.github/workflows/rspec.yml +2 -2
- data/.github/workflows/rubocop.yml +1 -1
- data/.github/workflows/trigger-docs-site.yml +1 -1
- data/AGENTS.md +4 -4
- data/CHANGELOG.md +26 -1
- data/CONTRIBUTING.md +9 -5
- data/Gemfile.lock +15 -10
- data/README.md +1 -1
- data/cpflow.gemspec +1 -1
- data/docs/ai-github-flow-prompt.md +104 -8
- data/docs/ci-automation.md +174 -59
- data/docs/commands.md +11 -6
- data/lib/command/ai_github_flow_prompt.rb +10 -13
- data/lib/command/ai_github_flow_prompt.txt +103 -0
- data/lib/command/apply_template.rb +12 -1
- data/lib/command/base.rb +10 -0
- data/lib/command/generate_github_actions.rb +8 -16
- data/lib/command/run.rb +7 -7
- data/lib/command/setup_app.rb +6 -1
- data/lib/command/update_github_actions.rb +28 -2
- data/lib/core/bootstrap_image.rb +21 -0
- data/lib/core/controlplane.rb +7 -6
- data/lib/cpflow/version.rb +1 -1
- data/lib/github_flow_templates/.github/cpflow-help.md +2 -2
- data/lib/github_flow_templates/.github/workflows/cpflow-promote-staging-to-production.yml +7 -7
- data/lib/github_flow_templates/bin/test-cpflow-github-flow +26 -4
- data/script/check_shell_scripts +3 -3
- metadata +12 -9
- data/.agents/bin/setup +0 -5
- data/.agents/bin/test +0 -5
- data/.agents/bin/validate +0 -6
- /data/.agents/{trusted-github-actors.yml → shaka/trusted-github-actors.yml} +0 -0
data/docs/ci-automation.md
CHANGED
|
@@ -23,7 +23,7 @@ End-to-end rollout in one view:
|
|
|
23
23
|
|
|
24
24
|
1. `cpflow github-flow-readiness` — exits non-zero if the repo is not ready to deploy.
|
|
25
25
|
2. `cpflow generate` — creates `.controlplane/` if missing.
|
|
26
|
-
3. `cpflow generate-github-actions` — adds `cpflow-*` workflow wrappers
|
|
26
|
+
3. `cpflow generate-github-actions` — adds `cpflow-*` workflow wrappers. Review-app, staging, cleanup, and helper workflows call upstream reusable workflows; production promotion is a normal caller-repo job so it can own the protected production Environment.
|
|
27
27
|
4. Configure the [GitHub Actions secrets and variables](#github-actions-secrets-and-variables) the workflows expect.
|
|
28
28
|
5. Push the branch, then comment `+review-app-deploy` on a PR to spin up a review environment.
|
|
29
29
|
|
|
@@ -69,7 +69,6 @@ The second command writes namespaced files so they can coexist with an app's exi
|
|
|
69
69
|
- `.github/workflows/cpflow-deploy-staging.yml`
|
|
70
70
|
- `.github/workflows/cpflow-promote-staging-to-production.yml`
|
|
71
71
|
- `.github/workflows/cpflow-cleanup-stale-review-apps.yml`
|
|
72
|
-
- `.github/actions/cpflow-*` (the local composite actions used by those workflows)
|
|
73
72
|
- `bin/pin-cpflow-github-ref`
|
|
74
73
|
- `bin/test-cpflow-github-flow`
|
|
75
74
|
|
|
@@ -268,8 +267,7 @@ summary does not claim to know the production-to-staging diff.
|
|
|
268
267
|
Existing repositories adopt this with
|
|
269
268
|
`cpflow update-github-actions --workflows cpflow-promote-staging-to-production.yml`.
|
|
270
269
|
Review and reapply downstream workflow customizations before committing the
|
|
271
|
-
replacement
|
|
272
|
-
preserves existing top-level workflows.
|
|
270
|
+
replacement. The bare update command preserves existing top-level workflows.
|
|
273
271
|
|
|
274
272
|
### Recover a missing or stale production release record
|
|
275
273
|
|
|
@@ -390,20 +388,28 @@ the run early instead of deploying an image that cannot boot.
|
|
|
390
388
|
|
|
391
389
|
Review apps are different: the generated `+review-app-deploy` workflow creates
|
|
392
390
|
temporary PR apps as needed, including the identity and secret policy binding.
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
image
|
|
391
|
+
Each eligible deployment first builds the full PR head and verifies that the
|
|
392
|
+
registry image tag belongs to that review app and contains the exact full PR SHA.
|
|
393
|
+
A failed build or mismatched image stops before app setup or template refresh.
|
|
394
|
+
For an existing review app, the workflow then runs
|
|
395
|
+
`cpflow setup-app --refresh-templates --bootstrap-image APP:NUMBER_FULL_COMMIT_SHA`.
|
|
396
|
+
Refresh mode reapplies the configured `setup_app_templates` without
|
|
396
397
|
deleting the GVC or running `hooks.post_creation`, answers template replacement
|
|
397
398
|
prompts noninteractively, preserves each matching workload container's exact
|
|
398
399
|
configured app-image reference even when the app is unhealthy or workloads use
|
|
399
400
|
different image versions, and repairs the configured app and shared-secret
|
|
400
|
-
policy bindings.
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
401
|
+
policy bindings. The explicit bootstrap image must exist in the same org's
|
|
402
|
+
registry and match the app and full-commit tag format. It initializes only missing
|
|
403
|
+
images or that app's `NO_IMAGE_AVAILABLE` placeholders; foreign configured images
|
|
404
|
+
fail closed. Without this option, missing or invalid images still require an
|
|
405
|
+
unambiguous app image from ready workloads. Refresh never implicitly selects the
|
|
406
|
+
registry's newest image as a fallback. Preserving valid image references keeps
|
|
407
|
+
release-phase and ordered-deploy gates in control of their rollout; initializing
|
|
408
|
+
placeholders can start previously unbootstrapped workloads during refresh.
|
|
409
|
+
A template failure stops before the deployment phase. Existing secret templates are skipped
|
|
405
410
|
as whole resources, so refresh neither changes existing values nor adds newly templated
|
|
406
411
|
keys; provision required new keys separately before deployment.
|
|
412
|
+
An automatic PR update still skips an app that has not been explicitly created.
|
|
407
413
|
You still need the shared review-app runtime secret values described by your
|
|
408
414
|
templates, and the staging token must have access to create and update
|
|
409
415
|
review-app GVCs, workloads, images, identities, policies, and secrets in the
|
|
@@ -538,12 +544,11 @@ The generated flow uses these defaults:
|
|
|
538
544
|
makes the newest intent fail closed instead of falling back to an older operation. This permission gate applies to every
|
|
539
545
|
`+review-app-deploy` comment, whether or not a review app already exists. Later pushes to a base-repository branch PR
|
|
540
546
|
redeploy automatically without another approval because the auto-push path (`pull_request` event) does not use the
|
|
541
|
-
comment permission gate. The reusable deploy workflow loads
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
code run with staging/review credentials;
|
|
547
|
+
comment permission gate. The reusable deploy workflow loads its composite actions from `shakacode/control-plane-flow`
|
|
548
|
+
at the commit the wrapper pins, never from the pull request's revision; see
|
|
549
|
+
[Where the actions run from](#where-the-actions-run-from). Preserve the same-repository caller guard because a
|
|
550
|
+
same-repository pull request can still change the wrapper and the application code that run with staging/review
|
|
551
|
+
credentials;
|
|
547
552
|
- fork pull requests cannot deploy via the generated `pull_request` path because the caller workflow's job-level `if:`
|
|
548
553
|
condition explicitly skips fork-originated runs. For `issue_comment` events, the caller `if:` restricts invocation to
|
|
549
554
|
the exact command shape; the reusable workflow resolves repository permission before its deploy job runs, then its
|
|
@@ -579,11 +584,10 @@ generated staging/review org and make that token disposable and unable to access
|
|
|
579
584
|
|
|
580
585
|
The PR-close teardown workflow runs trusted base-branch workflow code with repository secret access so it can delete fork
|
|
581
586
|
PR review apps. The generated `cpflow-delete-control-plane-app` composite action script refuses to call `cpflow delete`
|
|
582
|
-
on any app whose name does not match the review-app prefix. This shell-level guard is effective because the
|
|
583
|
-
|
|
584
|
-
the commit GitHub recorded for the triggering event (`GITHUB_SHA`, the base-branch tip under
|
|
585
|
-
|
|
586
|
-
paths rather than PR or fork code. If you customize this
|
|
587
|
+
on any app whose name does not match the review-app prefix. This shell-level guard is effective because the delete
|
|
588
|
+
workflow loads that action from the wrapper-pinned `.cpflow` commit. Its separate app checkout has no `ref:` override,
|
|
589
|
+
which resolves to the commit GitHub recorded for the triggering event (`GITHUB_SHA`, the base-branch tip under
|
|
590
|
+
`pull_request_target`), so teardown reads base-branch configuration rather than PR or fork code. If you customize this
|
|
587
591
|
workflow, never check out PR or fork code in the same job as the delete step; doing so could let a PR replace the guard
|
|
588
592
|
script itself and would also make `hooks.pre_deletion` come from the PR's `controlplane.yml`. This is still not a token
|
|
589
593
|
policy, so use a scoped staging service account limited to review/staging operations. A configured
|
|
@@ -792,21 +796,77 @@ or clones that copy the workflow before configuring Control Plane can remove
|
|
|
792
796
|
wrapper-level `if:` guard shown in that file, for example
|
|
793
797
|
`vars.REVIEW_APP_PREFIX != '' || vars.CPLN_ORG_STAGING != ''`.
|
|
794
798
|
|
|
799
|
+
## Coordinate review-app deployments across CI providers
|
|
800
|
+
|
|
801
|
+
Set the reusable deploy workflow's `deployment_lock` input to `true` when
|
|
802
|
+
another CI provider can deploy the same review app. Every participating provider
|
|
803
|
+
must acquire the same Control Plane lock before provisioning, refreshing
|
|
804
|
+
templates, building the app image, or deploying it. Existing consumers keep their
|
|
805
|
+
current behavior until they opt in.
|
|
806
|
+
|
|
807
|
+
The standalone `.github/scripts/deployment_lock.py` helper accepts `acquire`,
|
|
808
|
+
`release`, and `run`. Use the same immutable upstream revision in every provider.
|
|
809
|
+
Pass the exact `--org`, `--app`, a distinct `--owner` for each job attempt, and a
|
|
810
|
+
job-private `--receipt` path. `run` additionally accepts the deployment command
|
|
811
|
+
after `--`; it releases ownership only when that command succeeds, preserving
|
|
812
|
+
its exit status. The command must wait for any remote deployment work to finish;
|
|
813
|
+
do not use a detached command. GitHub acquires and releases inside its deploy job
|
|
814
|
+
so rerunning that job also reacquires ownership, and releases only after success.
|
|
815
|
+
|
|
816
|
+
Provide the existing deployment token through `CPLN_TOKEN`. It must already have
|
|
817
|
+
permission to create, read, and delete the lock secret in the review-app org.
|
|
818
|
+
The helper creates an opaque secret containing no credentials, with the app and
|
|
819
|
+
owner recorded in its tags. Acquisition failures stop deployment; they never
|
|
820
|
+
overwrite or remove an existing lock. Cleanup verifies both the owner and the
|
|
821
|
+
resource identity before deleting it.
|
|
822
|
+
|
|
823
|
+
Failed, canceled, or forcibly terminated runners retain their locks. A nonzero
|
|
824
|
+
deployment exit can leave remote release jobs running, including after a local
|
|
825
|
+
observation timeout. An uncertain API result also fails closed. There is no
|
|
826
|
+
age-based expiry: an old timestamp does
|
|
827
|
+
not prove a deployment stopped. Before manually removing a stranded lock,
|
|
828
|
+
confirm that its recorded owner and any deployment children have stopped, inspect
|
|
829
|
+
the app's deployment state, and obtain operator approval to delete that exact
|
|
830
|
+
lock secret. Do not recover a lock while its owner could still run cleanup.
|
|
831
|
+
|
|
832
|
+
The guard coordinates deployments only. Review-app deletion and scheduled
|
|
833
|
+
cleanup need their own coordination when they can overlap an external deploy.
|
|
834
|
+
Validate token permissions and contention in an approved disposable environment
|
|
835
|
+
before enabling this option in a consumer.
|
|
836
|
+
|
|
795
837
|
## Upstream Workflows And Actions
|
|
796
838
|
|
|
797
839
|
Most generated workflows are intentionally small wrappers. The deployment
|
|
798
|
-
logic and comment formatting live in upstream reusable workflows
|
|
799
|
-
composite actions live in this repository
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
840
|
+
logic and comment formatting live in upstream reusable workflows, and the
|
|
841
|
+
composite actions they call live in this repository. Each job checks out
|
|
842
|
+
`shakacode/control-plane-flow` at the pinned ref into `.cpflow`, then runs the
|
|
843
|
+
actions as `./.cpflow/.github/actions/cpflow-*` and builds the `cpflow` runtime
|
|
844
|
+
from the same checkout. A downstream repository carries the wrappers and one
|
|
845
|
+
pinned ref, with no copies of the actions. Production promotion is expanded
|
|
846
|
+
into the caller repository so it can own `environment: production`; it pins the
|
|
847
|
+
same source in its own `.cpflow` checkout.
|
|
805
848
|
|
|
806
849
|
- `cpflow-setup-environment`: installs Ruby, the Control Plane CLI, and `cpflow`, then logs into the target org. By default it builds `cpflow` from the checked-out upstream `control-plane-flow` ref; set the `CPFLOW_VERSION` repository variable only when you want to force a published RubyGems release.
|
|
807
850
|
- `cpflow-build-docker-image`: builds and pushes the app image with the desired commit SHA
|
|
808
851
|
- `cpflow-delete-control-plane-app`: safely deletes temporary apps and refuses to touch names outside the configured review-app prefix
|
|
809
852
|
|
|
853
|
+
### Where the actions run from
|
|
854
|
+
|
|
855
|
+
The actions that receive `CPLN_TOKEN_STAGING` come from
|
|
856
|
+
`shakacode/control-plane-flow` at the commit the calling wrapper pins. For a
|
|
857
|
+
reusable workflow that is `job.workflow_sha`; for production promotion it is the
|
|
858
|
+
`ref:` of the `Checkout control-plane-flow actions` step.
|
|
859
|
+
|
|
860
|
+
A same-repository pull request can change the wrapper, including its pinned
|
|
861
|
+
ref, and the application code and `.controlplane/` configuration that the
|
|
862
|
+
deployment builds. It cannot change the action code without changing that pin,
|
|
863
|
+
so reviewing the pin reviews the actions. The review-app jobs check out caller
|
|
864
|
+
files only under `app/`, and never at the workspace root.
|
|
865
|
+
|
|
866
|
+
cpflow 6.0.0 instead ran copies of the actions from the caller repository at
|
|
867
|
+
the triggering revision. See
|
|
868
|
+
[Removing cpflow 6.0.0 action copies](#removing-cpflow-600-action-copies).
|
|
869
|
+
|
|
810
870
|
## Version Pins: GitHub Ref vs RubyGems
|
|
811
871
|
|
|
812
872
|
Generated `cpflow-*` workflow files pin `shakacode/control-plane-flow` from
|
|
@@ -828,22 +888,22 @@ that input outside the production promotion setup step, regenerate with a newer
|
|
|
828
888
|
|
|
829
889
|
There are two coordinated inputs, and they protect different things:
|
|
830
890
|
|
|
831
|
-
- The GitHub ref locks the reusable workflow
|
|
832
|
-
checkout that GitHub runs.
|
|
833
|
-
- The installed Ruby gem supplies the generated
|
|
834
|
-
|
|
835
|
-
|
|
891
|
+
- The GitHub ref locks the reusable workflow, its composite actions, and the
|
|
892
|
+
`.cpflow` runtime source checkout that GitHub runs.
|
|
893
|
+
- The installed Ruby gem supplies the generated wrappers. `CPFLOW_VERSION`,
|
|
894
|
+
when configured, separately locks the published `cpflow` runtime installed by
|
|
895
|
+
the setup action.
|
|
836
896
|
|
|
837
897
|
That means a downstream app cannot rely on the gem alone for GitHub Actions
|
|
838
898
|
behavior. The safe stable path is still gem-driven for generation, but
|
|
839
|
-
developers must commit the generated wrappers
|
|
840
|
-
|
|
899
|
+
developers must commit the generated wrappers from the gem that matches the
|
|
900
|
+
upstream release tag:
|
|
841
901
|
|
|
842
902
|
1. Publish a `cpflow` gem.
|
|
843
903
|
2. Install or bundle that released gem in the downstream project.
|
|
844
904
|
3. Run `cpflow generate-github-actions`.
|
|
845
|
-
4. Commit the generated wrappers
|
|
846
|
-
|
|
905
|
+
4. Commit the generated wrappers; they should point to the matching upstream
|
|
906
|
+
release tag such as `v5.0.0`.
|
|
847
907
|
|
|
848
908
|
That release tag should point to the same source that produced the RubyGems
|
|
849
909
|
release. Downstream production automation should use release tags, not `main` or
|
|
@@ -852,8 +912,8 @@ feature-branch refs.
|
|
|
852
912
|
Generated cross-repository reusable-workflow calls deliberately use an exact
|
|
853
913
|
release tag such as `v5.0.0`. This is the intentional downstream exception to
|
|
854
914
|
the repository's full-SHA external-action policy: it keeps the installed gem,
|
|
855
|
-
generated wrappers,
|
|
856
|
-
|
|
915
|
+
generated wrappers, and upstream workflow on one reviewed release update
|
|
916
|
+
contract. It does not extend to external actions inside
|
|
857
917
|
those workflows, which remain pinned to full commit SHAs with readable release
|
|
858
918
|
comments. Unreleased downstream validation temporarily replaces the exact tag
|
|
859
919
|
with the upstream PR's full commit SHA as described below; moving version
|
|
@@ -863,14 +923,14 @@ aliases and branches remain forbidden.
|
|
|
863
923
|
|
|
864
924
|
Whenever a downstream repo updates the `cpflow` gem, update all checked-in
|
|
865
925
|
GitHub Actions files in the same PR. The gem version does not make GitHub load
|
|
866
|
-
new reusable workflow YAML
|
|
867
|
-
|
|
926
|
+
new reusable workflow YAML by itself; GitHub uses the workflow ref committed in
|
|
927
|
+
the repository.
|
|
868
928
|
|
|
869
929
|
For a new repository that does not have generated wrappers yet, run
|
|
870
930
|
`cpflow generate-github-actions` first. Use the update command below for later
|
|
871
931
|
gem upgrades.
|
|
872
932
|
|
|
873
|
-
Use the installed gem to refresh the generated
|
|
933
|
+
Use the installed gem to refresh the generated files:
|
|
874
934
|
|
|
875
935
|
```sh
|
|
876
936
|
cpflow update-github-actions
|
|
@@ -884,7 +944,7 @@ bundle exec cpflow update-github-actions
|
|
|
884
944
|
bin/test-cpflow-github-flow bundle exec cpflow
|
|
885
945
|
```
|
|
886
946
|
|
|
887
|
-
`cpflow update-github-actions` refreshes
|
|
947
|
+
`cpflow update-github-actions` refreshes the generated helpers.
|
|
888
948
|
It preserves every top-level workflow by default, including refs, triggers,
|
|
889
949
|
permissions, and downstream deployment ownership. It does not create staging
|
|
890
950
|
or production deployment workflows when another CI system owns those deploys.
|
|
@@ -901,13 +961,36 @@ bundle exec cpflow update-github-actions --workflows \
|
|
|
901
961
|
Each selected wrapper is replaced in full with the installed gem's template
|
|
902
962
|
and release ref. Review the diff and reapply downstream changes before
|
|
903
963
|
committing. Unselected wrappers keep their refs: preservation is not evidence
|
|
904
|
-
that old wrappers are compatible with new
|
|
964
|
+
that old wrappers are compatible with the new release. Migrate wrapper
|
|
905
965
|
contracts and source pins together, then run the validator in the same PR.
|
|
906
966
|
For a selected staging wrapper, a single existing push branch or the default
|
|
907
967
|
main/master pair can be inferred. Missing, malformed, or ambiguous branch
|
|
908
968
|
configuration requires an explicit `--staging-branch BRANCH`; that option also
|
|
909
969
|
requires selecting `cpflow-deploy-staging.yml`.
|
|
910
970
|
|
|
971
|
+
### Removing cpflow 6.0.0 action copies
|
|
972
|
+
|
|
973
|
+
cpflow 6.0.0 generated `.github/actions/cpflow-*` and ran those copies. Later
|
|
974
|
+
releases load the actions from the pinned ref, so the copies are unused once
|
|
975
|
+
every workflow has moved off 6.0.0:
|
|
976
|
+
|
|
977
|
+
1. Update the gem, then replace the wrappers and the production promotion
|
|
978
|
+
workflow with `cpflow update-github-actions --workflows FILE...`. Reapply
|
|
979
|
+
downstream customizations.
|
|
980
|
+
2. Confirm that no workflow is still pinned to cpflow 6.0.0 and that none has a
|
|
981
|
+
`uses: ./.github/actions/cpflow-*` line. In a workflow you maintain by hand,
|
|
982
|
+
change each such line to `uses: ./.cpflow/.github/actions/cpflow-*`.
|
|
983
|
+
3. Delete the copies with `git rm -r .github/actions/cpflow-*`, delete any
|
|
984
|
+
downstream check that compares them with the gem, and run
|
|
985
|
+
`bin/test-cpflow-github-flow`.
|
|
986
|
+
|
|
987
|
+
`cpflow update-github-actions` lists the copies it finds and never deletes
|
|
988
|
+
them. A wrapper pinned to 6.0.0 runs them without naming them, and a full-SHA
|
|
989
|
+
pin does not say which release it is, so the command cannot prove a copy is
|
|
990
|
+
unused. Until step 3 the copies are harmless: a wrapper pinned to a later
|
|
991
|
+
release never reads them. The validator fails when a workflow names a copy
|
|
992
|
+
that is not checked in.
|
|
993
|
+
|
|
911
994
|
### Preserving downstream validation
|
|
912
995
|
|
|
913
996
|
The generated `bin/test-cpflow-github-flow` runs baseline checks followed by
|
|
@@ -949,7 +1032,7 @@ trusted_actions:
|
|
|
949
1032
|
```
|
|
950
1033
|
|
|
951
1034
|
Merge the needed entries into your existing policy rather than replacing it.
|
|
952
|
-
`ruby/setup-ruby` is used by
|
|
1035
|
+
`ruby/setup-ruby` is used by cpflow's setup action, including in
|
|
953
1036
|
review-app-only installations. `actions/checkout` and `docker/setup-buildx-action`
|
|
954
1037
|
are used directly by the generated production wrapper;
|
|
955
1038
|
`shakacode/control-plane-flow` supplies the reusable wrappers. Other existing
|
|
@@ -999,8 +1082,7 @@ action commit, so a moving branch named like `v5.0.0` cannot be used with
|
|
|
999
1082
|
runners that cannot reach GitHub should leave `CPFLOW_VERSION` unset and build
|
|
1000
1083
|
`cpflow` from the checked-out ref instead. When testing an unreleased upstream
|
|
1001
1084
|
commit SHA, leave `CPFLOW_VERSION` unset so the workflow builds `cpflow` from the
|
|
1002
|
-
same source that supplies the reusable workflow
|
|
1003
|
-
actions from that checkout before testing as described below.
|
|
1085
|
+
same source that supplies the reusable workflow and its actions.
|
|
1004
1086
|
|
|
1005
1087
|
## Testing Unreleased Upstream Changes Downstream
|
|
1006
1088
|
|
|
@@ -1016,8 +1098,7 @@ releasing it. Use an immutable commit SHA from the upstream PR branch:
|
|
|
1016
1098
|
bin/pin-cpflow-github-ref --version <reviewed-version-tag> <upstream-pr-sha>
|
|
1017
1099
|
```
|
|
1018
1100
|
|
|
1019
|
-
The
|
|
1020
|
-
`.github/actions/cpflow-*`. The pin helper then updates every generated
|
|
1101
|
+
The pin helper updates every generated
|
|
1021
1102
|
reusable-workflow `uses:` ref plus the production workflow's pinned
|
|
1022
1103
|
`control-plane-flow` checkout and setup validation ref. It accepts release
|
|
1023
1104
|
tags and full commit SHAs (with a reviewed `--version` label), rejects branch names such as `main` or
|
|
@@ -1045,19 +1126,18 @@ releasing it. Use an immutable commit SHA from the upstream PR branch:
|
|
|
1045
1126
|
matches the repository's installation state.
|
|
1046
1127
|
|
|
1047
1128
|
For an existing installation, where `cpflow-deploy-review-app.yml` is already
|
|
1048
|
-
present on the default branch, dispatch the workflow definition
|
|
1049
|
-
|
|
1050
|
-
base-repository PR:
|
|
1129
|
+
present on the default branch, dispatch the workflow definition from the
|
|
1130
|
+
unmerged downstream test branch against a suitable open base-repository PR:
|
|
1051
1131
|
|
|
1052
1132
|
```sh
|
|
1053
1133
|
gh workflow run cpflow-deploy-review-app.yml --ref <downstream-test-branch> -f pr_number=<pr-number>
|
|
1054
1134
|
```
|
|
1055
1135
|
|
|
1056
|
-
The `--ref` selects the downstream wrapper
|
|
1136
|
+
The `--ref` selects the downstream wrapper commit under test;
|
|
1057
1137
|
`pr_number` selects the application source to deploy. Do not use a
|
|
1058
1138
|
`+review-app-deploy` comment for this pre-merge validation: `issue_comment`
|
|
1059
1139
|
always loads the workflow definition from the default branch, so it cannot
|
|
1060
|
-
validate unmerged wrappers
|
|
1140
|
+
validate unmerged wrappers.
|
|
1061
1141
|
|
|
1062
1142
|
For a first installation, GitHub will not dispatch a workflow that does not
|
|
1063
1143
|
yet exist on the default branch, even when `--ref` names the installation
|
|
@@ -1078,9 +1158,9 @@ releasing it. Use an immutable commit SHA from the upstream PR branch:
|
|
|
1078
1158
|
`bin/pin-cpflow-github-ref vX.Y.Z` only for a ref-only update when the
|
|
1079
1159
|
generated templates are already current.
|
|
1080
1160
|
|
|
1081
|
-
For an existing installation, this tests the real reusable workflows,
|
|
1082
|
-
|
|
1083
|
-
|
|
1161
|
+
For an existing installation, this tests the real reusable workflows, their
|
|
1162
|
+
composite actions, and the source-built `cpflow` gem against one immutable
|
|
1163
|
+
upstream commit. A first installation gets the same remote
|
|
1084
1164
|
proof immediately after its locally validated files reach the default branch.
|
|
1085
1165
|
Both paths avoid testing against a moving upstream branch.
|
|
1086
1166
|
|
|
@@ -1177,3 +1257,38 @@ Expand that prompt with app-specific requirements before editing files:
|
|
|
1177
1257
|
- keep workflow files generic and put app names, org names, branch names, and Docker build knobs in repository `vars` and `secrets`
|
|
1178
1258
|
|
|
1179
1259
|
When the agent applies this to a project, it should avoid hardcoding app names or org names into the workflow files. Those belong in repository `vars` and `secrets`.
|
|
1260
|
+
|
|
1261
|
+
### Review-app deployment reporting
|
|
1262
|
+
|
|
1263
|
+
The reusable review deployment, deletion, and stale cleanup jobs pin Ubuntu 24.04 rather than following
|
|
1264
|
+
`ubuntu-latest`, because an application Ruby patch release may not have a
|
|
1265
|
+
prebuilt binary for a newly introduced runner image. This does not change the
|
|
1266
|
+
application's declared Ruby version.
|
|
1267
|
+
|
|
1268
|
+
After source authorization and review configuration resolution, the workflow
|
|
1269
|
+
records an explicitly requested target commit, PR number, workflow run, and transient GitHub
|
|
1270
|
+
deployment before installing Ruby or provisioning the app. The PR comment
|
|
1271
|
+
includes the final failure or cancellation outcome even when provisioning never
|
|
1272
|
+
started. Automatic pushes to an uncreated app leave no deployment or PR comment.
|
|
1273
|
+
Automatic updates of an existing app post only the final outcome comment, without a
|
|
1274
|
+
starting comment or progress edits.
|
|
1275
|
+
Automatic updates check the live Control Plane GVC before Ruby setup and record
|
|
1276
|
+
an in-progress deployment when the app exists, including apps without earlier GitHub
|
|
1277
|
+
deployment records. Stale GitHub metadata cannot activate a deleted app. If an app
|
|
1278
|
+
disappears between that lookup and later detection, the attempt becomes inactive.
|
|
1279
|
+
The early read uses curl's bounded transient/transport retries with per-request
|
|
1280
|
+
and retry-window deadlines. Authorization is supplied through stdin, and redirects
|
|
1281
|
+
are not followed. The reusable workflow targets the standard Control Plane API.
|
|
1282
|
+
If the early Control Plane lookup still fails, the workflow fails without guessing that
|
|
1283
|
+
an app exists; its run logs remain the diagnostic source. Ready status requires
|
|
1284
|
+
a successful job and a detected preview URL.
|
|
1285
|
+
|
|
1286
|
+
Consumers can build a review queue from environments named `review/<app-name>`,
|
|
1287
|
+
deployment payload `pr_number` and `run_id`, the deployment SHA, and its latest
|
|
1288
|
+
status and URLs. A successful deployment establishes preview availability, not
|
|
1289
|
+
product approval or merge readiness. Feedback should identify the reviewed commit.
|
|
1290
|
+
|
|
1291
|
+
Reporting still depends on GitHub accepting the final API writes. A terminated
|
|
1292
|
+
runner or API outage can leave an in-progress record; consumers should reconcile
|
|
1293
|
+
it with the linked workflow run's terminal status and display missing evidence
|
|
1294
|
+
as unavailable, rather than assuming success.
|
data/docs/commands.md
CHANGED
|
@@ -32,6 +32,7 @@ cpflow ai-github-flow-prompt
|
|
|
32
32
|
- Use `--preserve-existing-runtime` to retain each workload container's configured app image, even when the workload is unready, and skip existing secret resources entirely while applying other template changes
|
|
33
33
|
- Use `--exclude-secret-template NAME` and `--exclude-policy-template NAME` to exclude exact named templates without changing workload image handling
|
|
34
34
|
- Missing or invalid workload images use only an unambiguous app image from ready workloads; refresh fails before applying templates when no safe fallback exists
|
|
35
|
+
- With `--preserve-existing-runtime`, use `--bootstrap-image APP:NUMBER_FULL_COMMIT_SHA` to initialize missing or own-app placeholder images from an explicitly verified registry image; valid configured images remain unchanged and foreign images are rejected
|
|
35
36
|
|
|
36
37
|
**Preprocessed template variables:**
|
|
37
38
|
|
|
@@ -234,8 +235,8 @@ Creates GitHub Actions templates for a Heroku Flow style Control Plane pipeline:
|
|
|
234
235
|
- manual promotion from staging to production
|
|
235
236
|
- nightly cleanup and PR help workflows
|
|
236
237
|
|
|
237
|
-
|
|
238
|
-
|
|
238
|
+
The workflows load cpflow's composite actions from this gem's repository at
|
|
239
|
+
the ref each workflow pins, so no `.github/actions/cpflow-*` copies are generated.
|
|
239
240
|
|
|
240
241
|
Pass `--staging-branch BRANCH` when staging should auto-deploy from a branch
|
|
241
242
|
other than `main` or `master`; the generator will bake that branch into the
|
|
@@ -245,7 +246,7 @@ Pass `--force` to overwrite existing generated files. Prefer
|
|
|
245
246
|
repo.
|
|
246
247
|
|
|
247
248
|
```sh
|
|
248
|
-
# Creates workflow wrappers
|
|
249
|
+
# Creates workflow wrappers and validation helpers
|
|
249
250
|
cpflow generate-github-actions
|
|
250
251
|
|
|
251
252
|
# Creates the flow with staging deploys triggered from develop
|
|
@@ -568,6 +569,7 @@ cpflow run -a $APP_NAME --entrypoint /app/alternative-entrypoint.sh -- rails db:
|
|
|
568
569
|
- If the hook exits with a non-zero code, the command will stop executing and also exit with a non-zero code
|
|
569
570
|
- Use `--skip-post-creation-hook` to skip the hook if specified in `controlplane.yml`
|
|
570
571
|
- Use `--refresh-templates` to apply configured templates noninteractively to an existing app while preserving each workload's configured app image even when workloads are unready or use mixed image versions, skipping existing secret templates (but filling missing opt-in generated review keys), repairing secrets access bindings, and skipping the post-creation hook
|
|
572
|
+
- With `--refresh-templates`, use `--bootstrap-image APP:NUMBER_FULL_COMMIT_SHA` to repair a partial bootstrap from a freshly built own-app registry image; valid workload images are preserved
|
|
571
573
|
|
|
572
574
|
```sh
|
|
573
575
|
cpflow setup-app -a $APP_NAME
|
|
@@ -591,11 +593,14 @@ cpflow terraform import
|
|
|
591
593
|
|
|
592
594
|
### `update-github-actions`
|
|
593
595
|
|
|
594
|
-
Refreshes
|
|
596
|
+
Refreshes helper files from the installed gem. Workflows load cpflow's
|
|
597
|
+
composite actions from the pinned cpflow ref, so the command reports any
|
|
598
|
+
`.github/actions/cpflow-*` copies left by cpflow 6.0.0 for you to delete
|
|
599
|
+
once no workflow is pinned to 6.0.0. It never deletes them itself.
|
|
595
600
|
All top-level workflows are preserved by default, including their refs,
|
|
596
601
|
triggers, permissions, and deployment ownership. Use --workflows FILE...
|
|
597
602
|
to explicitly add or replace named generated workflows. Replacement resets
|
|
598
|
-
each selected workflow to its template and matching v6.
|
|
603
|
+
each selected workflow to its template and matching v6.1.0 ref;
|
|
599
604
|
review and reapply any downstream customizations in the same PR.
|
|
600
605
|
|
|
601
606
|
Selecting cpflow-deploy-staging.yml preserves a single existing push branch
|
|
@@ -609,7 +614,7 @@ invokes that extension after its baseline checks; the extension is never
|
|
|
609
614
|
generated or overwritten. See docs/ci-automation.md for migration guidance.
|
|
610
615
|
|
|
611
616
|
```sh
|
|
612
|
-
# Refresh
|
|
617
|
+
# Refresh helpers while preserving downstream workflows
|
|
613
618
|
cpflow update-github-actions
|
|
614
619
|
|
|
615
620
|
# When running cpflow through Bundler
|
|
@@ -22,24 +22,21 @@ module Command
|
|
|
22
22
|
VALIDATIONS = [].freeze
|
|
23
23
|
REQUIRES_STARTUP_CHECKS = false
|
|
24
24
|
|
|
25
|
+
# The prompt lives in its own file with one instruction per bullet, so a person can read it and
|
|
26
|
+
# a change shows as a small diff. docs/ai-github-flow-prompt.md carries the same text with no app
|
|
27
|
+
# prefix; a spec keeps the two equal.
|
|
28
|
+
PROMPT_PATH = File.expand_path("ai_github_flow_prompt.txt", __dir__)
|
|
29
|
+
|
|
30
|
+
def self.text(app_prefix: nil)
|
|
31
|
+
format(File.read(PROMPT_PATH), prefix_note: app_prefix ? " (`#{app_prefix}`)" : "")
|
|
32
|
+
end
|
|
33
|
+
|
|
25
34
|
def call
|
|
26
|
-
puts
|
|
35
|
+
puts self.class.text(app_prefix: inferred_app_prefix)
|
|
27
36
|
end
|
|
28
37
|
|
|
29
38
|
private
|
|
30
39
|
|
|
31
|
-
def prompt
|
|
32
|
-
<<~PROMPT
|
|
33
|
-
Set up Control Plane GitHub Flow for this repo. First make sure the `cpflow` CLI is available: use the repo's existing `bundle exec cpflow` if present, otherwise install the published `cpflow` Ruby gem with `gem install cpflow`; if neither is possible, stop and report that blocker. Use the same `cpflow` invocation for the rest of the rollout. Start with `cpflow github-flow-readiness` and stop on any reported blockers. The repo must be deployable from a clean clone: published package versions, complete runtime scaffold, and a production Dockerfile that can build the app. If any package version is unpublished, inaccessible from CI, or requires credentials that are not already modeled in the repo or GitHub settings, stop and report the blocker instead of generating workflow files. If the repo is a legacy sample pinned to an obsolete Ruby or Bundler toolchain, if it does not even have a production Dockerfile yet, or if it is a monorepo without an already-decided single app boundary for this flow, stop and report that as a prerequisite instead of forcing the rollout.
|
|
34
|
-
|
|
35
|
-
If `.controlplane/` is missing, run `cpflow generate`. Treat the generated app names as the repo-name default (`#{inferred_app_prefix}`) and rename them only if the project needs a different prefix. Then run `cpflow generate-github-actions` (or `cpflow generate-github-actions --staging-branch BRANCH` when staging should deploy from a branch other than `main`/`master`), keep review apps opt-in via `+review-app-deploy`, make sure any `STAGING_APP_BRANCH` repository variable is also present in the generated staging workflow's `on.push.branches` filter, and list the GitHub secrets and variables that must be configured. Do not hand-edit duplicated upstream refs into the generated wrappers. Keep every generated Control Plane Flow source pin synchronized at the same `vX.Y.Z`: each reusable-workflow `uses: ...@vX.Y.Z` ref, the production promotion `.cpflow` checkout ref, and its `control_plane_flow_ref` setup input. By default, `cpflow generate-github-actions` derives these values from the installed `cpflow` gem version; temporary explicit ref overrides are for unreleased testing and must keep all three values synchronized. Keep the generated `.github/actions/cpflow-*` files from that same gem unchanged; upstream reusable workflows invoke those checked-in local actions and separately check out the matching runtime source at `.cpflow`. When bumping the `cpflow` gem in a downstream repo, `cpflow update-github-actions` refreshes local actions and helpers while preserving all top-level workflows, including their refs and triggers. Use `cpflow update-github-actions --workflows FILE...` to explicitly select wrappers for replacement, then review the diff and reapply downstream customizations. A differing existing validator blocks all writes: preserve its downstream checks in executable `bin/test-cpflow-github-flow-custom`, then remove or rename the old generated validator before retrying. The generated validator invokes that preserved extension and propagates its failures. Follow `docs/ci-automation.md` for the migration procedure, keep source pins compatible with the updated actions, and run `bin/test-cpflow-github-flow` in the same PR (or `bin/test-cpflow-github-flow bundle exec cpflow` when using Bundler). Keep the normal generated review-app setup simple: review apps require only `CPLN_TOKEN_STAGING` when the generated review app config can be inferred. For public demos, starter staging apps, and long-lived review apps, keep the app workload `type: standard` with one warm replica, set its autoscaling metric to `disabled`, and enable `capacityAI: true` so Control Plane can right-size CPU and memory allocation at that fixed replica count. Shared Postgres and other stateful workloads are the usual exceptions and should stay manually sized; Capacity AI is for supported stateless app/service workloads. If true idle scale-to-zero is explicitly required, create a separate `serverless` workload before first deploy or plan a delete/recreate migration because Control Plane will not change an existing `standard` workload to `serverless` in place. For shared review-app resources such as one staging database, use `shared_secret_grants` and `{{SHARED_SECRET_DATABASE}}` placeholders instead of hardcoding the base app secret name; this keeps review-app policy binding and cleanup automatic while avoiding per-PR database cost. Document the one-time Control Plane bootstrap command for persistent staging and production apps with `cpflow setup-app --skip-post-creation-hook`; for existing apps or later template updates, document `cpflow apply-template` and the need for the app identity to have `reveal` on the app secret policy. Do not imply the staging deploy or promotion workflows create those persistent GVCs. For production promotion, document a protected `production` GitHub Environment with required reviewers, prevent self-review, and `CPLN_TOKEN_PRODUCTION` stored as an environment secret, not as a repository or organization secret.
|
|
36
|
-
|
|
37
|
-
Keep Node available in the final image if asset compilation or SSR depends on ExecJS, Yarn, `pnpm`, or npm after the main install layer. Make sure the generated Dockerfile uses a Ruby base image compatible with the app's declared Ruby requirement. Preserve repo-defined frontend build hooks: if `config/shakapacker.yml` defines a `precompile_hook`, or React on Rails enables `config.auto_load_bundle = true`, confirm the generated Dockerfile runs that codegen step before `rails assets:precompile`. If `config/database.yml` shows SQLite in production, confirm that the generated scaffold redirects every production database file into persistent `/app/data` (or keeps it under persistent `/app/storage`) without mounting over the image's `/app/db` migrations, stores Active Storage under `/app/storage`, and runs `rails db:prepare`; otherwise keep the default Postgres workload. If the public workload is not named `rails`, set `PRIMARY_WORKLOAD` or adjust the generated workflows. Inspect the Dockerfile and package sources for private GitHub dependencies or `RUN --mount=type=ssh`; if present, wire `DOCKER_BUILD_SSH_KEY`, optionally set `DOCKER_BUILD_SSH_KNOWN_HOSTS` for non-GitHub SSH hosts, and keep `DOCKER_BUILD_EXTRA_ARGS` to newline-delimited single tokens such as `--build-arg=FOO=bar`.
|
|
38
|
-
|
|
39
|
-
Run the real local validations you can: Docker build if feasible, repo tests or smoke checks, YAML validation, and any CI-equivalent build steps. Push the branch and check the GitHub Actions results. Only stop early for a real external blocker or a product decision that changes scope.
|
|
40
|
-
PROMPT
|
|
41
|
-
end
|
|
42
|
-
|
|
43
40
|
def inferred_app_prefix
|
|
44
41
|
RepoIntrospection.inferred_app_prefix(Dir.pwd)
|
|
45
42
|
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Set up Control Plane GitHub Flow for this repo.
|
|
2
|
+
|
|
3
|
+
Before generating anything:
|
|
4
|
+
- First make sure the `cpflow` CLI is available: use the repo's existing `bundle exec cpflow` if
|
|
5
|
+
present, otherwise install the published `cpflow` Ruby gem with `gem install cpflow`; if neither
|
|
6
|
+
is possible, stop and report that blocker.
|
|
7
|
+
- Use the same `cpflow` invocation for the rest of the rollout.
|
|
8
|
+
- Start with `cpflow github-flow-readiness` and stop on any reported blockers.
|
|
9
|
+
- The repo must be deployable from a clean clone: published package versions, complete runtime
|
|
10
|
+
scaffold, and a production Dockerfile that can build the app.
|
|
11
|
+
- If any package version is unpublished, inaccessible from CI, or requires credentials that are not
|
|
12
|
+
already modeled in the repo or GitHub settings, stop and report the blocker instead of generating
|
|
13
|
+
workflow files.
|
|
14
|
+
- If the repo is a legacy sample pinned to an obsolete Ruby or Bundler toolchain, if it does not
|
|
15
|
+
even have a production Dockerfile yet, or if it is a monorepo without an already-decided single
|
|
16
|
+
app boundary for this flow, stop and report that as a prerequisite instead of forcing the rollout.
|
|
17
|
+
|
|
18
|
+
Generate the flow:
|
|
19
|
+
- If `.controlplane/` is missing, run `cpflow generate`.
|
|
20
|
+
- Treat the generated app names as the repo-name default%<prefix_note>s and rename them only if the
|
|
21
|
+
project needs a different prefix.
|
|
22
|
+
- Then run `cpflow generate-github-actions` (or `cpflow generate-github-actions --staging-branch
|
|
23
|
+
BRANCH` when staging should deploy from a branch other than `main`/`master`).
|
|
24
|
+
- Keep review apps opt-in via `+review-app-deploy`.
|
|
25
|
+
- Make sure any `STAGING_APP_BRANCH` repository variable is also present in the generated staging
|
|
26
|
+
workflow's `on.push.branches` filter.
|
|
27
|
+
- List the GitHub secrets and variables that must be configured.
|
|
28
|
+
|
|
29
|
+
Keep the Control Plane Flow source pins together:
|
|
30
|
+
- Do not hand-edit duplicated upstream refs into the generated wrappers.
|
|
31
|
+
- Keep every generated Control Plane Flow source pin synchronized at the same `vX.Y.Z`: each
|
|
32
|
+
reusable-workflow `uses: ...@vX.Y.Z` ref, the production promotion `.cpflow` checkout ref, and its
|
|
33
|
+
`control_plane_flow_ref` setup input.
|
|
34
|
+
- By default, `cpflow generate-github-actions` derives these values from the installed `cpflow` gem
|
|
35
|
+
version; temporary explicit ref overrides are for unreleased testing and must keep all three
|
|
36
|
+
values synchronized.
|
|
37
|
+
- Do not add `.github/actions/cpflow-*` copies; the workflows load cpflow's composite actions and
|
|
38
|
+
runtime source from the pinned `.cpflow` checkout.
|
|
39
|
+
|
|
40
|
+
When bumping the `cpflow` gem in a downstream repo:
|
|
41
|
+
- `cpflow update-github-actions` refreshes helpers while preserving all top-level workflows,
|
|
42
|
+
including their refs and triggers.
|
|
43
|
+
- It reports `.github/actions/cpflow-*` copies left by cpflow 6.0.0; delete them once no workflow is
|
|
44
|
+
pinned to 6.0.0 or names one.
|
|
45
|
+
- Use `cpflow update-github-actions --workflows FILE...` to explicitly select wrappers for
|
|
46
|
+
replacement, then review the diff and reapply downstream customizations.
|
|
47
|
+
- A differing existing validator blocks all writes: preserve its downstream checks in executable
|
|
48
|
+
`bin/test-cpflow-github-flow-custom`, then remove or rename the old generated validator before
|
|
49
|
+
retrying.
|
|
50
|
+
- The generated validator invokes that preserved extension and propagates its failures.
|
|
51
|
+
- Follow `docs/ci-automation.md` for the migration procedure, keep source pins compatible with the
|
|
52
|
+
updated actions, and run `bin/test-cpflow-github-flow` in the same PR (or
|
|
53
|
+
`bin/test-cpflow-github-flow bundle exec cpflow` when using Bundler).
|
|
54
|
+
|
|
55
|
+
Review apps and workload sizing:
|
|
56
|
+
- Keep the normal generated review-app setup simple: review apps require only `CPLN_TOKEN_STAGING`
|
|
57
|
+
when the generated review app config can be inferred.
|
|
58
|
+
- For public demos, starter staging apps, and long-lived review apps, keep the app workload `type:
|
|
59
|
+
standard` with one warm replica, set its autoscaling metric to `disabled`, and enable `capacityAI:
|
|
60
|
+
true` so Control Plane can right-size CPU and memory allocation at that fixed replica count.
|
|
61
|
+
- Shared Postgres and other stateful workloads are the usual exceptions and should stay manually
|
|
62
|
+
sized; Capacity AI is for supported stateless app/service workloads.
|
|
63
|
+
- If true idle scale-to-zero is explicitly required, create a separate `serverless` workload before
|
|
64
|
+
first deploy or plan a delete/recreate migration because Control Plane will not change an existing
|
|
65
|
+
`standard` workload to `serverless` in place.
|
|
66
|
+
- For shared review-app resources such as one staging database, use `shared_secret_grants` and
|
|
67
|
+
`{{SHARED_SECRET_DATABASE}}` placeholders instead of hardcoding the base app secret name; this
|
|
68
|
+
keeps review-app policy binding and cleanup automatic while avoiding per-PR database cost.
|
|
69
|
+
|
|
70
|
+
Staging and production:
|
|
71
|
+
- Document the one-time Control Plane bootstrap command for persistent staging and production apps
|
|
72
|
+
with `cpflow setup-app --skip-post-creation-hook`; for existing apps or later template updates,
|
|
73
|
+
document `cpflow apply-template` and the need for the app identity to have `reveal` on the app
|
|
74
|
+
secret policy.
|
|
75
|
+
- Do not imply the staging deploy or promotion workflows create those persistent GVCs.
|
|
76
|
+
- For production promotion, document a protected `production` GitHub Environment with required
|
|
77
|
+
reviewers, prevent self-review, and `CPLN_TOKEN_PRODUCTION` stored as an environment secret, not
|
|
78
|
+
as a repository or organization secret.
|
|
79
|
+
|
|
80
|
+
Docker image and runtime:
|
|
81
|
+
- Keep Node available in the final image if asset compilation or SSR depends on ExecJS, Yarn,
|
|
82
|
+
`pnpm`, or npm after the main install layer.
|
|
83
|
+
- Make sure the generated Dockerfile uses a Ruby base image compatible with the app's declared Ruby
|
|
84
|
+
requirement.
|
|
85
|
+
- Preserve repo-defined frontend build hooks: if `config/shakapacker.yml` defines a
|
|
86
|
+
`precompile_hook`, or React on Rails enables `config.auto_load_bundle = true`, confirm the
|
|
87
|
+
generated Dockerfile runs that codegen step before `rails assets:precompile`.
|
|
88
|
+
- If `config/database.yml` shows SQLite in production, confirm that the generated scaffold redirects
|
|
89
|
+
every production database file into persistent `/app/data` (or keeps it under persistent
|
|
90
|
+
`/app/storage`) without mounting over the image's `/app/db` migrations, stores Active Storage
|
|
91
|
+
under `/app/storage`, and runs `rails db:prepare`; otherwise keep the default Postgres workload.
|
|
92
|
+
- If the public workload is not named `rails`, set `PRIMARY_WORKLOAD` or adjust the generated
|
|
93
|
+
workflows.
|
|
94
|
+
- Inspect the Dockerfile and package sources for private GitHub dependencies or `RUN
|
|
95
|
+
--mount=type=ssh`; if present, wire `DOCKER_BUILD_SSH_KEY`, optionally set
|
|
96
|
+
`DOCKER_BUILD_SSH_KNOWN_HOSTS` for non-GitHub SSH hosts, and keep `DOCKER_BUILD_EXTRA_ARGS` to
|
|
97
|
+
newline-delimited single tokens such as `--build-arg=FOO=bar`.
|
|
98
|
+
|
|
99
|
+
Validate and finish:
|
|
100
|
+
- Run the real local validations you can: Docker build if feasible, repo tests or smoke checks, YAML
|
|
101
|
+
validation, and any CI-equivalent build steps.
|
|
102
|
+
- Push the branch and check the GitHub Actions results.
|
|
103
|
+
- Only stop early for a real external blocker or a product decision that changes scope.
|