Skip to content

Commit eb1dbb2

Browse files
committed
Document generated cpflow workflow settings
1 parent 56c53a0 commit eb1dbb2

2 files changed

Lines changed: 59 additions & 10 deletions

File tree

.controlplane/readme.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,27 +364,43 @@ openssl rand -hex 64
364364

365365
_Note, some of the URL references are internal for the ShakaCode team._
366366

367-
Review Apps (deployment of apps based on a PR) are done via Github Actions.
367+
Review Apps (deployment of apps based on a PR) are done via the generated
368+
`cpflow-*` GitHub Actions flow.
368369

369-
The review apps work by creating isolated deployments for each branch through this automated process. When a branch is pushed, the action:
370+
The review apps work by creating isolated deployments for pull requests through
371+
this automated process. When an approved collaborator comments exactly
372+
`/deploy-review-app` on a PR, the action:
370373

371374
1. Sets up the necessary environment and tools
372-
2. Creates a unique deployment for that branch if it doesn't exist
373-
3. Builds a Docker image tagged with the branch's commit SHA
375+
2. Creates a unique review app if it doesn't exist
376+
3. Builds a Docker image tagged with the PR commit SHA
374377
4. Deploys this image to Control Plane with its own isolated environment
375378

379+
After the review app exists, new pushes to the PR redeploy it automatically.
380+
Use `/delete-review-app` to delete it manually; closing the PR deletes it
381+
automatically. Pushes to the staging branch deploy staging, and production
382+
promotion is manual from the `cpflow-promote-staging-to-production` workflow.
383+
384+
The repository variables and secrets must match the app names in
385+
`.controlplane/controlplane.yml`. In particular, `REVIEW_APP_PREFIX` should
386+
include the `-pr` suffix for this app, such as
387+
`qa-react-webpack-rails-tutorial-pr`, so generated review apps are named
388+
`qa-react-webpack-rails-tutorial-pr-1234`.
389+
376390
This allows teams to:
377391
- Preview changes in a production-like environment
378392
- Test features independently
379393
- Share working versions with stakeholders
380394
- Validate changes before merging to main branches
381395

382-
The system uses Control Plane's infrastructure to manage these deployments, with each branch getting its own resources as defined in the controlplane.yml configuration.
396+
The system uses Control Plane's infrastructure to manage these deployments, with
397+
each review app getting its own resources as defined in the controlplane.yml
398+
configuration.
383399

384400

385-
### Workflow for Developing Github Actions for Review Apps
401+
### Workflow for Developing GitHub Actions for Review Apps
386402

387-
1. Create a PR with changes to the Github Actions workflow
403+
1. Create a PR with changes to the GitHub Actions workflow
388404
2. Make edits to files such as `.github/actions/cpflow-build-docker-image/action.yml` or `.github/workflows/cpflow-deploy-review-app.yml`
389405
3. Run a script like `ga .github && gc -m fixes && gp` to commit and push changes (ga = git add, gc = git commit, gp = git push)
390-
4. Check the Github Actions tab in the PR to see the status of the workflow
406+
4. Check the GitHub Actions tab in the PR to see the status of the workflow

.controlplane/shakacode-team.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Deployments are handled by Control Plane configuration in this repo and GitHub A
66

77
### Review Apps
88
- Add a comment `/deploy-review-app` to any PR to deploy a review app
9+
- The generated app name is `${REVIEW_APP_PREFIX}-${PR_NUMBER}`. Keep
10+
`REVIEW_APP_PREFIX` set to `qa-react-webpack-rails-tutorial-pr` so review
11+
apps use names like `qa-react-webpack-rails-tutorial-pr-1234`, matching the
12+
prefix-backed config in `.controlplane/controlplane.yml`.
13+
- New pushes to a PR redeploy only after the review app already exists.
14+
- Add `/delete-review-app` to delete a review app manually; closing the PR also
15+
deletes it automatically.
916

1017
### Staging Environment
1118
- **Automatic**: Any merge to the `master` branch automatically deploys to staging
@@ -19,9 +26,35 @@ Deployments are handled by Control Plane configuration in this repo and GitHub A
1926
- [Control Plane Console - Production](https://console.cpln.io/console/org/shakacode-open-source-examples-production/gvc/react-webpack-rails-tutorial-production/workload/rails/-info)
2027
- [Production App](https://reactrails.com/)
2128

22-
See [./README.md](./README.md) for more details.
29+
### GitHub Repository Settings
30+
31+
Required repository secrets:
32+
33+
- `CPLN_TOKEN_STAGING`
34+
- `CPLN_TOKEN_PRODUCTION`
35+
36+
Required repository variables:
37+
38+
- `CPLN_ORG_STAGING=shakacode-open-source-examples-staging`
39+
- `CPLN_ORG_PRODUCTION=shakacode-open-source-examples-production`
40+
- `STAGING_APP_NAME=react-webpack-rails-tutorial-staging`
41+
- `PRODUCTION_APP_NAME=react-webpack-rails-tutorial-production`
42+
- `REVIEW_APP_PREFIX=qa-react-webpack-rails-tutorial-pr`
43+
- `STAGING_APP_BRANCH=master`
44+
- `PRIMARY_WORKLOAD=rails`
45+
46+
Optional repository settings:
47+
48+
- `DOCKER_BUILD_SSH_KEY`: secret for private SSH dependencies during Docker builds.
49+
- `DOCKER_BUILD_EXTRA_ARGS`: newline-delimited Docker build tokens, such as `--build-arg=FOO=bar`.
50+
- `DOCKER_BUILD_SSH_KNOWN_HOSTS`: custom `known_hosts` entries when SSH build hosts are not GitHub.com.
51+
52+
If staging moves off `master`, update both `STAGING_APP_BRANCH` and the branch
53+
filter in `.github/workflows/cpflow-deploy-staging.yml`.
54+
55+
See [readme.md](readme.md) for more details.
2356

2457
## Links
2558

2659
- [Control Plane Org for Staging and Review Apps](https://console.cpln.io/console/org/shakacode-open-source-examples-staging/-info)
27-
- [Control Plane Org for Deployed App](https://console.cpln.io/console/org/shakacode-open-source-examples/-info)
60+
- [Control Plane Org for Production App](https://console.cpln.io/console/org/shakacode-open-source-examples-production/-info)

0 commit comments

Comments
 (0)