You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For production promotion, configure a protected GitHub Environment named
55
+
`production`:
56
+
57
+
| Secret or variable | Value |
58
+
| --- | --- |
59
+
|`CPLN_TOKEN_PRODUCTION`| Environment secret on `production`, not a repository or organization secret. |
60
+
|`CPLN_ORG_PRODUCTION`| Environment variable on `production`: `shakacode-open-source-examples-production`|
61
+
|`PRODUCTION_APP_NAME`| Environment variable on `production`: `react-webpack-rails-tutorial-production`|
62
+
63
+
Protect the `production` environment with required reviewers, enable prevent
64
+
self-review, and consider disabling administrator bypass. Only release managers
65
+
or similarly trusted maintainers should be able to approve the promotion job.
66
+
The promotion workflow uses that environment before it can access
67
+
`CPLN_TOKEN_PRODUCTION`, so the production token is not exposed to ordinary
68
+
review-app or staging runs.
69
+
70
+
Advanced optional variables:
71
+
72
+
| Name | Notes |
73
+
| --- | --- |
74
+
|`REVIEW_APP_DEPLOYING_ICON_URL`| Cosmetic custom animated icon for review-app comments. Ignore this for the standard setup. |
75
+
|`CPLN_CLI_VERSION`| Pin only when Control Plane CLI compatibility requires it. |
76
+
|`CPFLOW_VERSION`| Runtime gem override. Leave unset when workflow wrappers are pinned to a GitHub commit SHA for upstream PR testing. |
77
+
78
+
## Control Plane Setup
79
+
80
+
The GitHub secret is only the automation credential. The Control Plane org also
81
+
needs the app resources and runtime secrets that the workloads read at boot.
82
+
83
+
For review-app testing, the standard setup is:
84
+
85
+
| Control Plane item | Where | Notes |
86
+
| --- | --- | --- |
87
+
| Staging/review org |`shakacode-open-source-examples-staging`| The `CPLN_TOKEN_STAGING` service account must be able to create and update GVCs, workloads, images, identities, policies, and secrets in this org. |
88
+
| Review app prefix |`qa-react-webpack-rails-tutorial`| Review apps are named `qa-react-webpack-rails-tutorial-<PR number>`. This is inferred from `.controlplane/controlplane.yml`. |
89
+
| Review app secret dictionary |`qa-react-webpack-rails-tutorial-secrets`| Shared by generated review apps because the QA app entry uses `match_if_app_name_starts_with: true`. |
90
+
91
+
For staging deploys later, also use:
92
+
93
+
| Control Plane item | Where | Notes |
94
+
| --- | --- | --- |
95
+
| Staging app |`react-webpack-rails-tutorial-staging`| The `CPLN_TOKEN_STAGING` token deploys this app from `master`. |
96
+
| Staging app secret dictionary |`react-webpack-rails-tutorial-staging-secrets`| Same required keys as the review app secret dictionary. |
97
+
98
+
For production promotion later, use a separate production org and token:
99
+
100
+
| Control Plane item | Where | Notes |
101
+
| --- | --- | --- |
102
+
| Production org |`shakacode-open-source-examples-production`| Do not give the staging token access to this org. |
103
+
| Production app |`react-webpack-rails-tutorial-production`| Promotion copies the staging image into this app. |
104
+
| Production app secret dictionary |`react-webpack-rails-tutorial-production-secrets`| Create before the first promotion. Use production-only values. |
105
+
| Production service-account token | GitHub Environment secret `CPLN_TOKEN_PRODUCTION`| Keep this token in the protected `production` GitHub Environment only. |
106
+
107
+
The app secret dictionaries must include:
108
+
109
+
-`SECRET_KEY_BASE`
110
+
-`RENDERER_PASSWORD`
111
+
-`REACT_ON_RAILS_PRO_LICENSE`
112
+
113
+
Generate `SECRET_KEY_BASE` with `openssl rand -hex 64` and
114
+
`RENDERER_PASSWORD` with `openssl rand -hex 32`. The review/staging template
115
+
currently contains a test placeholder for `SECRET_KEY_BASE`; replace it with a
116
+
secret-backed value before promoting production. The demo Postgres and Redis
117
+
workloads are useful for review apps and staging demos. For real production,
118
+
prefer managed services and update `DATABASE_URL` and `REDIS_URL` accordingly.
119
+
22
120
## Prerequisites
23
121
24
122
1. Ensure your [Control Plane](https://shakacode.controlplane.com) account is set up.
@@ -388,11 +486,11 @@ The production promotion workflow checks that production has all environment
388
486
variable names present in staging; it does not compare secret values, workload
389
487
environment variables, or Control Plane secret references.
390
488
391
-
The repository variables and secrets must match the app names in
392
-
`.controlplane/controlplane.yml`. In particular, `REVIEW_APP_PREFIX` should
393
-
include the `-pr` suffix for this app, such as
394
-
`qa-react-webpack-rails-tutorial-pr`, so generated review apps are named
395
-
`qa-react-webpack-rails-tutorial-pr-1234`.
489
+
The GitHub settings and Control Plane resources must match the app names in
490
+
`.controlplane/controlplane.yml`. For the standard review-app path, leave
491
+
`REVIEW_APP_PREFIX` unset and let the workflow infer
492
+
`qa-react-webpack-rails-tutorial`; generated review apps are named
493
+
`qa-react-webpack-rails-tutorial-<PR number>`.
396
494
397
495
This allows teams to:
398
496
- Preview changes in a production-like environment
Copy file name to clipboardExpand all lines: .github/cpflow-help.md
+58-7Lines changed: 58 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,26 +35,77 @@ You asked for review app help. These commands are generated by [cpflow](https://
35
35
| Name | Required | Notes |
36
36
| --- | --- | --- |
37
37
|`CPLN_TOKEN_STAGING`| yes | Service-account token scoped to the staging Control Plane org on controlplane.com. |
38
-
|`CPLN_TOKEN_PRODUCTION`| yes (for promote) |Service-account token scoped to the production Control Plane org on controlplane.com. |
38
+
|`CPLN_TOKEN_PRODUCTION`| yes (for promote) |Store this as a secret on the protected `production` GitHub Environment, not as a repository or organization secret. |
39
39
|`DOCKER_BUILD_SSH_KEY`| optional | Private SSH key used when Docker builds fetch private deps via `RUN --mount=type=ssh`. |
40
40
41
+
For normal generated review apps, `CPLN_TOKEN_STAGING` is the only required
42
+
GitHub setting. The review app prefix and staging org are inferred from
43
+
`.controlplane/controlplane.yml` when it defines exactly one app with
44
+
`match_if_app_name_starts_with: true`.
45
+
46
+
For production promotion, create a GitHub Environment named `production`, add
47
+
required reviewers, enable prevent self-review, and store
48
+
`CPLN_TOKEN_PRODUCTION` as an environment secret there. The generated promotion
49
+
workflow uses that environment before it can access production secrets.
50
+
41
51
### GitHub Actions variables
42
52
43
53
| Name | Required | Notes |
44
54
| --- | --- | --- |
45
-
|`CPLN_ORG_STAGING`| yes |Control Plane org on controlplane.com for staging and review apps. |
46
-
|`CPLN_ORG_PRODUCTION`| yes (for promote) | Control Plane org on controlplane.com for production. |
55
+
|`CPLN_ORG_STAGING`|optional for review apps; yes for staging | Override the staging/review Control Plane org inferred from `controlplane.yml`. |
56
+
|`CPLN_ORG_PRODUCTION`| yes (for promote) | Control Plane org on controlplane.com for production. Prefer a `production` environment variable. |
47
57
|`STAGING_APP_NAME`| yes | App name in `controlplane.yml` used as the staging deploy target. |
48
-
|`PRODUCTION_APP_NAME`| yes (for promote) | App name in `controlplane.yml` used as the production deploy target. |
49
-
|`REVIEW_APP_PREFIX`|yes|Prefix for per-PR review app names (e.g. `review-app`). |
50
-
|`REVIEW_APP_DEPLOYING_ICON_URL`| optional| Custom image URL for the animated deploying icon in review-app PR comments. Set to `none` to use the text fallback icon. |
58
+
|`PRODUCTION_APP_NAME`| yes (for promote) | App name in `controlplane.yml` used as the production deploy target. Prefer a `production` environment variable. |
59
+
|`REVIEW_APP_PREFIX`|optional|Override or disambiguate the review app prefix inferred from `controlplane.yml`. |
60
+
|`REVIEW_APP_DEPLOYING_ICON_URL`| optional, advanced | Cosmetic custom image URL for the animated deploying icon in review-app PR comments. Set to `none` to use the text fallback icon. |
51
61
|`STAGING_APP_BRANCH`| optional | Custom staging branch. Custom branches must also appear in `cpflow-deploy-staging.yml`'s push filter. |
52
62
|`PRIMARY_WORKLOAD`| optional | Workload polled for health and rollback (defaults to `rails`). |
|`DOCKER_BUILD_SSH_KNOWN_HOSTS`| optional | SSH known_hosts entries when SSH build hosts are not GitHub.com. |
55
65
|`HEALTH_CHECK_ACCEPTED_STATUSES`| optional | Space-separated HTTP statuses considered healthy on promote (default `200 301 302`). |
56
66
|`CPLN_CLI_VERSION`| optional | Pin a specific `@controlplane/cli` version; falls back to the action default when unset. |
57
-
|`CPFLOW_VERSION`| optional | Runtime gem-install override. When unset, cpflow is built from the pinned upstream workflow ref. When set, use the RubyGems version without a leading `v`. |
67
+
|`CPFLOW_VERSION`| optional | Pin a published RubyGems version such as `5.0.0` or `5.0.0.rc.1`. Leave unset for normal generated workflows so the setup action builds `cpflow` from the same `control-plane-flow` GitHub ref used by the reusable workflow. |
Generated workflow wrappers have two related pins:
75
+
76
+
- The `uses: shakacode/control-plane-flow/...@<ref>` GitHub ref selects the reusable workflow code.
77
+
- The `control_plane_flow_ref: <ref>` input tells the setup action which `control-plane-flow` source to check out and build when `CPFLOW_VERSION` is empty.
78
+
79
+
The GitHub ref is the runtime lock for workflow and action behavior. The
80
+
RubyGems version is used to generate/update these wrappers and, only when
81
+
`CPFLOW_VERSION` is set, to install the `cpflow` CLI at runtime. A downstream
82
+
repo cannot rely on the gem alone because GitHub loads reusable workflow YAML
83
+
from `shakacode/control-plane-flow`, not from RubyGems.
84
+
85
+
For normal releases, point both pins at a release tag such as `v5.0.0`.
86
+
You may leave `CPFLOW_VERSION` unset, or set it to the matching RubyGems version
87
+
without the leading `v`, such as `5.0.0`. If you set `CPFLOW_VERSION` for a
88
+
prerelease, use RubyGems dot syntax such as `5.0.0.rc.1`; the release tag may
89
+
use either `v5.0.0.rc.1` or `v5.0.0-rc.1`.
90
+
91
+
To update to a new stable release, install or bundle the new `cpflow` gem, run
92
+
`cpflow generate-github-actions`, and commit the regenerated wrappers. Use
93
+
`bin/pin-cpflow-github-ref vX.Y.Z` only when the generated files are already
94
+
current and you only need to move the upstream GitHub ref.
95
+
96
+
For temporary downstream testing of an upstream PR before a gem is released, pin
97
+
both values to the exact 40-character commit SHA and leave `CPFLOW_VERSION`
0 commit comments