Skip to content

Commit f323ed7

Browse files
committed
WIP
1 parent 65ec57e commit f323ed7

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

docs/ci-automation.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# CI Automation, Review Apps, Staging, and Promoting to Production
2+
3+
## Setting up Tokens for CI Automation
4+
5+
The examples uses Github Actions as an example. The same applies to Circle CI and other similar CI/CD tools.
6+
7+
1. Ensure that you have two orgs:
8+
1. `company-staging` (for staging deployments, developers have access)
9+
2. `company-production` (for production deployments, limited access)
10+
2. Create the token for staging org and set on Github repository secrets and variables:
11+
1. Go to the Control Plane UI for your organization's staging org
12+
2. Make a new service account called `github-actions-staging`
13+
3. Assign to the group `superusers`
14+
4. Click "Keys" and create a one with description "Github Actions" and copy the token (or download it).
15+
5. Add this key to your Github repository **secrets** as `CPLN_TOKEN_STAGING`
16+
6. Add another key to your Github repository **variables** as `CPLN_ORG_STAGING` with the name of the staging org, like `company-staging`
17+
3. Create the token for production org, and set on Github repository secrets and variables.
18+
1. Go to the Control Plane UI for your organization's production org
19+
2. Make a new service account called `github-actions-production`
20+
3. Assign to the group `superusers`
21+
4. Click "Keys" and create a one with description "Github Actions" and copy the token (or download it).
22+
5. Add this key to your Github repository **secrets** as `CPLN_TOKEN_PRODUCTION`
23+
6. Add another key to your Github repository **variables** as `CPLN_ORG_PRODUCTION` with the name of the production org, like `company-production`
24+
4. Create a few more ENV **variables** for the app name and the app prefix:
25+
1. `STAGING_APP_NAME` - the name of the app in Control Plane for staging, which is the GVC name, like `app-name-staging`
26+
2. `PRODUCTION_APP_NAME` - the name of the app in Control Plane for production, which is the GVC name, like `app-name-production`
27+
3. `REVIEW_APP_PREFIX` - the prefix for the review apps in Control Plane. The Review apps are named `$REVIEW_APP_PREFIX-pr-$PR_NUMBER`
28+
5. All in all, you should have 7 secrets set in your Github repository
29+
30+
31+
32+
3. Go to the Control Plane UI for your organization's staging org
33+
3. and make a new service account

docs/commands.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,17 @@ cpflow ps:stop -a $APP_NAME -w $WORKLOAD_NAME -r $REPLICA_NAME
354354
### `ps:wait`
355355
356356
- Waits for workloads in app to be ready after re-deployment
357+
- Use Unix timeout command to set a maximum wait time (e.g., `timeout 300 cpflow ps:wait ...`)
357358
358359
```sh
359360
# Waits for all workloads in app.
360361
cpflow ps:wait -a $APP_NAME
361362
362363
# Waits for a specific workload in app.
363-
cpflow ps:swait -a $APP_NAME -w $WORKLOAD_NAME
364+
cpflow ps:wait -a $APP_NAME -w $WORKLOAD_NAME
365+
366+
# Waits for all workloads with a 5-minute timeout.
367+
timeout 300 cpflow ps:wait -a $APP_NAME
364368
```
365369
366370
### `run`

lib/command/ps_wait.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ class PsWait < Base
1111
DESCRIPTION = "Waits for workloads in app to be ready after re-deployment"
1212
LONG_DESCRIPTION = <<~DESC
1313
- Waits for workloads in app to be ready after re-deployment
14+
- Use Unix timeout command to set a maximum wait time (e.g., `timeout 300 cpflow ps:wait ...`)
1415
DESC
1516
EXAMPLES = <<~EX
1617
```sh
1718
# Waits for all workloads in app.
1819
cpflow ps:wait -a $APP_NAME
1920
2021
# Waits for a specific workload in app.
21-
cpflow ps:swait -a $APP_NAME -w $WORKLOAD_NAME
22+
cpflow ps:wait -a $APP_NAME -w $WORKLOAD_NAME
23+
24+
# Waits for all workloads with a 5-minute timeout.
25+
timeout 300 cpflow ps:wait -a $APP_NAME
2226
```
2327
EX
2428

0 commit comments

Comments
 (0)