cpflow 6.0.0.rc.0 → 6.0.1
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/agent-workflow.yml +16 -38
- data/.agents/bin/README.md +7 -8
- data/.agents/legacy-workflow-policy.yml +11 -0
- data/.agents/shaka.md +20 -0
- data/.agents/trusted-actions.yml +12 -0
- data/.coderabbit.yaml +1 -0
- data/.github/actions/cpflow-build-docker-image/action.yml +153 -22
- data/.github/actions/cpflow-delete-control-plane-app/delete-app.sh +3 -0
- data/.github/actions/cpflow-preview-promotion/action.yml +82 -0
- data/.github/actions/cpflow-preview-promotion/preview-promotion.sh +90 -0
- data/.github/workflows/cpflow-cleanup-stale-review-apps.yml +3 -10
- data/.github/workflows/cpflow-delete-review-app.yml +4 -11
- data/.github/workflows/cpflow-deploy-review-app.yml +19 -14
- data/.github/workflows/cpflow-deploy-staging.yml +17 -12
- data/.github/workflows/cpflow-promote-staging-to-production.yml +132 -13
- data/.github/workflows/rspec.yml +24 -0
- data/AGENTS.md +18 -3
- data/CHANGELOG.md +26 -3
- data/CONTRIBUTING.md +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -2
- data/docs/ai-github-flow-prompt.md +104 -8
- data/docs/ci-automation.md +258 -60
- data/docs/commands.md +32 -16
- data/docs/postgres-review-apps.md +90 -0
- data/docs/postgres.md +233 -375
- data/docs/secrets-and-env-values.md +42 -0
- data/docs/sidebars.ts +1 -0
- 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 +36 -4
- data/lib/command/base.rb +56 -3
- data/lib/command/delete.rb +174 -4
- data/lib/command/deploy_image.rb +6 -0
- data/lib/command/generate.rb +247 -3
- data/lib/command/generate_github_actions.rb +15 -17
- data/lib/command/setup_app.rb +92 -10
- data/lib/command/update_github_actions.rb +107 -43
- data/lib/core/config.rb +73 -0
- data/lib/core/controlplane.rb +22 -2
- data/lib/core/controlplane_api.rb +28 -2
- data/lib/core/controlplane_api_direct.rb +17 -0
- data/lib/core/disposable_postgres_helpers.rb +167 -0
- data/lib/core/doctor_service.rb +7 -0
- data/lib/core/github_flow_readiness/checks.rb +2 -1
- data/lib/core/github_flow_readiness_service.rb +4 -0
- data/lib/core/repo_introspection.rb +112 -2
- data/lib/cpflow/version.rb +1 -1
- data/lib/generator_templates/.dockerignore +16 -0
- data/lib/generator_templates/Dockerfile +9 -5
- data/lib/generator_templates/entrypoint.sh +2 -0
- data/lib/generator_templates/templates/postgres.yml +9 -0
- data/lib/generator_templates_sqlite/controlplane.yml +2 -1
- data/lib/generator_templates_sqlite/release_script.sh +1 -1
- data/lib/generator_templates_sqlite/templates/rails.yml +2 -1
- data/lib/github_flow_templates/.github/cpflow-help.md +39 -12
- data/lib/github_flow_templates/.github/workflows/cpflow-deploy-review-app.yml +1 -0
- data/lib/github_flow_templates/.github/workflows/cpflow-deploy-staging.yml +1 -0
- data/lib/github_flow_templates/.github/workflows/cpflow-promote-staging-to-production.yml +132 -13
- data/lib/github_flow_templates/bin/pin-cpflow-github-ref +37 -13
- data/lib/github_flow_templates/bin/test-cpflow-github-flow +88 -47
- metadata +12 -3
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# PostgreSQL for disposable review apps
|
|
2
|
+
|
|
3
|
+
Use the generated `.controlplane/templates/postgres.yml` for a PostgreSQL workload
|
|
4
|
+
that belongs to one disposable review app. For production database migration, see
|
|
5
|
+
[Migrating PostgreSQL from Heroku to RDS](./postgres.md).
|
|
6
|
+
|
|
7
|
+
## Enable cleanup for new review apps
|
|
8
|
+
|
|
9
|
+
The generated template marks three helper resources:
|
|
10
|
+
|
|
11
|
+
| Resource | Purpose |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `<APP>-pg` | Credential dictionary |
|
|
14
|
+
| `<APP>-pg-script` | Initialization-script secret |
|
|
15
|
+
| `<APP>-pg-access` | Policy granting access to those secrets |
|
|
16
|
+
|
|
17
|
+
Each helper template carries this tag:
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
tags:
|
|
21
|
+
cpflow-disposable-postgres-app: "{{APP_NAME}}"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`cpflow apply-template` retains the tag for dynamically named review apps and removes
|
|
25
|
+
it for persistent apps. In an existing project, add the tag to all three helper
|
|
26
|
+
**templates before creating new review apps**. Reapplying a marked template to an
|
|
27
|
+
existing unmarked resource is refused; it does not adopt that resource.
|
|
28
|
+
|
|
29
|
+
Before opting in, check that your deployment token can:
|
|
30
|
+
|
|
31
|
+
- Read and delete the three helper resources.
|
|
32
|
+
- Read each secret's effective access report (`viewAccessReport` on the org).
|
|
33
|
+
|
|
34
|
+
A missing or incomplete access report blocks cleanup before app data is deleted.
|
|
35
|
+
|
|
36
|
+
## Delete an app
|
|
37
|
+
|
|
38
|
+
Run the normal app deletion command:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
cpflow delete -a APP_NAME
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Cleanup validates the helpers before deleting app data. It removes the marked
|
|
45
|
+
policy and secrets before deleting the GVC. Deleting a single workload with
|
|
46
|
+
`cpflow delete -a APP_NAME -w WORKLOAD_NAME` preserves the helpers.
|
|
47
|
+
|
|
48
|
+
The ownership checks require:
|
|
49
|
+
|
|
50
|
+
- The same app marker on every surviving helper.
|
|
51
|
+
- A policy targeting exactly the two helper secrets.
|
|
52
|
+
- Only `reveal` grants in that policy, for the app and PostgreSQL identities in the
|
|
53
|
+
app's GVC.
|
|
54
|
+
- No helper listed in `shared_secret_grants`.
|
|
55
|
+
- No effective secret access through another application policy or identity.
|
|
56
|
+
|
|
57
|
+
Reapplying marked helpers with `cpflow apply-template` uses the same checks.
|
|
58
|
+
|
|
59
|
+
## Understand a cleanup refusal
|
|
60
|
+
|
|
61
|
+
Cleanup preserves resources when a marker, policy, or access report cannot establish
|
|
62
|
+
exclusive ownership. A refusal aborts whole-app deletion before live app data is
|
|
63
|
+
deleted. Fix the reported condition before retrying; do not remove a
|
|
64
|
+
sharing grant until you know which applications depend on it.
|
|
65
|
+
|
|
66
|
+
| Condition | Result |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| All helpers are unmarked legacy resources | App deletion proceeds; helpers are preserved |
|
|
69
|
+
| Marked and unmarked helpers coexist | Cleanup refuses deletion |
|
|
70
|
+
| A marker names another app | Cleanup refuses deletion |
|
|
71
|
+
| Policy targets or principals differ from the expected app scope | Cleanup refuses deletion |
|
|
72
|
+
| A helper is configured as shared | Cleanup refuses deletion |
|
|
73
|
+
| Secret access reports are unavailable or incomplete | Cleanup refuses deletion |
|
|
74
|
+
|
|
75
|
+
The access checks include permissions implied by `edit` or `manage`. Global `manage`
|
|
76
|
+
grants to org groups, users, or service accounts count as org administration.
|
|
77
|
+
Targeted or query grants, and grants to other GVC identities, block cleanup.
|
|
78
|
+
|
|
79
|
+
For shared staging credentials, use the
|
|
80
|
+
[shared-secret configuration guide](./secrets-and-env-values.md#shared-secrets-for-review-apps)
|
|
81
|
+
instead of marking them as disposable helpers.
|
|
82
|
+
|
|
83
|
+
## Recover after interruption
|
|
84
|
+
|
|
85
|
+
Repeat `cpflow delete` with the same app name. Cleanup tolerates an already absent
|
|
86
|
+
GVC, policy, or secret and rechecks the surviving helpers before deleting them.
|
|
87
|
+
|
|
88
|
+
Unmarked legacy helpers need manual cleanup after you establish that no other app
|
|
89
|
+
uses them. Rolling back to an older cpflow version leaves the tags in place but
|
|
90
|
+
stops automatic helper cleanup.
|