cpflow 5.3.0 → 6.0.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/agent-workflow.yml +16 -25
- data/.agents/bin/README.md +19 -9
- data/.agents/bin/docs +1 -1
- data/.agents/bin/lint +1 -1
- data/.agents/bin/setup +1 -1
- data/.agents/bin/test +1 -1
- data/.agents/bin/validate +2 -1
- data/.agents/legacy-workflow-policy.yml +11 -0
- data/.agents/shaka.md +20 -0
- data/.agents/trusted-actions.yml +12 -0
- data/.coderabbit.yaml +14 -0
- data/.github/actions/cpflow-build-docker-image/action.yml +153 -22
- data/.github/actions/cpflow-delete-control-plane-app/action.yml +2 -1
- 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/actions/cpflow-setup-environment/action.yml +8 -6
- data/.github/dependabot.yml +10 -0
- data/.github/workflows/check_cpln_links.yml +6 -1
- data/.github/workflows/claude-code-review.yml +5 -2
- data/.github/workflows/claude.yml +6 -4
- data/.github/workflows/coderabbit-lifecycle-review.yml +29 -0
- data/.github/workflows/command_docs.yml +7 -2
- data/.github/workflows/cpflow-cleanup-stale-review-apps.yml +12 -5
- data/.github/workflows/cpflow-delete-review-app.yml +18 -11
- data/.github/workflows/cpflow-deploy-review-app.yml +38 -17
- data/.github/workflows/cpflow-deploy-staging.yml +28 -11
- data/.github/workflows/cpflow-help-command.yml +3 -3
- data/.github/workflows/cpflow-promote-staging-to-production.yml +135 -16
- data/.github/workflows/cpflow-review-app-help.yml +1 -1
- data/.github/workflows/rspec-shared.yml +34 -26
- data/.github/workflows/rspec-specific.yml +10 -2
- data/.github/workflows/rspec.yml +95 -4
- data/.github/workflows/rubocop.yml +9 -2
- data/.github/workflows/trigger-docs-site.yml +2 -0
- data/.rubocop.yml +6 -1
- data/AGENTS.md +18 -3
- data/CHANGELOG.md +39 -1
- data/CONTRIBUTING.md +39 -2
- data/Gemfile.lock +1 -1
- data/README.md +10 -2
- data/cpflow.gemspec +3 -15
- data/docs/ai-github-flow-prompt.md +3 -3
- data/docs/ci-automation.md +284 -68
- data/docs/commands.md +38 -15
- data/docs/postgres-review-apps.md +90 -0
- data/docs/postgres.md +233 -375
- data/docs/rds-private-networking.md +12 -12
- data/docs/releasing.md +15 -4
- data/docs/secrets-and-env-values.md +42 -0
- data/docs/sidebars.ts +1 -0
- data/examples/controlplane.yml +5 -0
- data/lib/command/ai_github_flow_prompt.rb +2 -2
- data/lib/command/apply_template.rb +36 -4
- data/lib/command/base.rb +56 -3
- data/lib/command/cleanup_stale_apps.rb +28 -4
- data/lib/command/copy_image_from_upstream.rb +3 -0
- data/lib/command/delete.rb +174 -4
- data/lib/command/deploy_image.rb +44 -1
- data/lib/command/generate.rb +247 -3
- data/lib/command/generate_github_actions.rb +43 -13
- data/lib/command/run.rb +224 -34
- data/lib/command/setup_app.rb +92 -10
- data/lib/command/update_github_actions.rb +82 -43
- data/lib/core/config.rb +73 -0
- data/lib/core/controlplane.rb +167 -80
- 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/core/shell.rb +35 -10
- data/lib/core/timed_command.rb +111 -0
- data/lib/cpflow/version.rb +1 -1
- data/lib/cpflow.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 +135 -16
- data/lib/github_flow_templates/bin/pin-cpflow-github-ref +37 -13
- data/lib/github_flow_templates/bin/test-cpflow-github-flow +125 -46
- data/lib/patches/hash.rb +2 -2
- data/rakelib/create_release.rake +14 -14
- data/script/check_shell_scripts +66 -0
- metadata +18 -17
|
@@ -19,6 +19,10 @@ inputs:
|
|
|
19
19
|
description: Directory where ruby/setup-ruby should detect Ruby version files.
|
|
20
20
|
required: false
|
|
21
21
|
default: "."
|
|
22
|
+
cpflow_source_directory:
|
|
23
|
+
description: Directory containing the checked-out control-plane-flow source.
|
|
24
|
+
required: false
|
|
25
|
+
default: ".cpflow"
|
|
22
26
|
# GitHub parses double-brace expression snippets inside action metadata (including
|
|
23
27
|
# `description:`) while loading the composite action, and the `vars` context is not
|
|
24
28
|
# available in that phase. Keep these descriptions in plain prose - reference repo
|
|
@@ -47,8 +51,8 @@ inputs:
|
|
|
47
51
|
|
|
48
52
|
runs:
|
|
49
53
|
using: composite
|
|
50
|
-
#
|
|
51
|
-
#
|
|
54
|
+
# Dependabot proposes action updates, but each reviewed dependency remains
|
|
55
|
+
# pinned to the release commit recorded beside its exact version comment.
|
|
52
56
|
steps:
|
|
53
57
|
- name: Resolve Ruby setup version
|
|
54
58
|
id: ruby-version
|
|
@@ -80,9 +84,7 @@ runs:
|
|
|
80
84
|
echo "ruby_version=${ruby_version}" >> "$GITHUB_OUTPUT"
|
|
81
85
|
|
|
82
86
|
- name: Set up Ruby
|
|
83
|
-
|
|
84
|
-
# roll out automatically; Dependabot/Renovate can manage this non-GitHub action.
|
|
85
|
-
uses: ruby/setup-ruby@v1
|
|
87
|
+
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
|
|
86
88
|
with:
|
|
87
89
|
ruby-version: ${{ steps.ruby-version.outputs.ruby_version }}
|
|
88
90
|
working-directory: ${{ inputs.working_directory }}
|
|
@@ -93,7 +95,7 @@ runs:
|
|
|
93
95
|
CONTROL_PLANE_FLOW_REF: ${{ inputs.control_plane_flow_ref }}
|
|
94
96
|
CPLN_CLI_VERSION: ${{ inputs.cpln_cli_version }}
|
|
95
97
|
CPFLOW_VERSION: ${{ inputs.cpflow_version }}
|
|
96
|
-
CPFLOW_SOURCE_DIR: ${{
|
|
98
|
+
CPFLOW_SOURCE_DIR: ${{ inputs.cpflow_source_directory }}
|
|
97
99
|
run: |
|
|
98
100
|
set -euo pipefail
|
|
99
101
|
|
|
@@ -6,13 +6,18 @@ on:
|
|
|
6
6
|
- main
|
|
7
7
|
pull_request:
|
|
8
8
|
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
9
12
|
jobs:
|
|
10
13
|
check_cpln_links:
|
|
11
14
|
runs-on: ubuntu-latest
|
|
12
15
|
name: Check Links
|
|
13
16
|
steps:
|
|
14
17
|
- name: Checkout repository
|
|
15
|
-
uses: actions/checkout@
|
|
18
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
19
|
+
with:
|
|
20
|
+
persist-credentials: false
|
|
16
21
|
- name: Validate outgoing links to Control Plane
|
|
17
22
|
run: |
|
|
18
23
|
TERM=xterm-color ./script/check_cpln_links
|
|
@@ -4,6 +4,8 @@ on:
|
|
|
4
4
|
pull_request:
|
|
5
5
|
types: [opened, synchronize, ready_for_review, reopened]
|
|
6
6
|
|
|
7
|
+
permissions: {}
|
|
8
|
+
|
|
7
9
|
jobs:
|
|
8
10
|
claude-review:
|
|
9
11
|
runs-on: ubuntu-latest
|
|
@@ -15,13 +17,14 @@ jobs:
|
|
|
15
17
|
|
|
16
18
|
steps:
|
|
17
19
|
- name: Checkout repository
|
|
18
|
-
uses: actions/checkout@
|
|
20
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
19
21
|
with:
|
|
20
22
|
fetch-depth: 1
|
|
23
|
+
persist-credentials: false
|
|
21
24
|
|
|
22
25
|
- name: Run Claude Code Review
|
|
23
26
|
id: claude-review
|
|
24
|
-
uses: anthropics/claude-code-action@v1
|
|
27
|
+
uses: anthropics/claude-code-action@8251c103ac8c1d761882c86aba1412c7f583c844 # v1.0.213
|
|
25
28
|
env:
|
|
26
29
|
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
27
30
|
with:
|
|
@@ -10,6 +10,8 @@ on:
|
|
|
10
10
|
pull_request_review:
|
|
11
11
|
types: [submitted]
|
|
12
12
|
|
|
13
|
+
permissions: {}
|
|
14
|
+
|
|
13
15
|
jobs:
|
|
14
16
|
authorize_claude_actor:
|
|
15
17
|
if: |
|
|
@@ -25,7 +27,7 @@ jobs:
|
|
|
25
27
|
steps:
|
|
26
28
|
- name: Verify actor can run Claude
|
|
27
29
|
id: permission-gate
|
|
28
|
-
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
|
30
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
29
31
|
with:
|
|
30
32
|
script: |
|
|
31
33
|
const owner = context.repo.owner;
|
|
@@ -119,13 +121,14 @@ jobs:
|
|
|
119
121
|
statuses: read
|
|
120
122
|
steps:
|
|
121
123
|
- name: Checkout repository
|
|
122
|
-
uses: actions/checkout@
|
|
124
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
123
125
|
with:
|
|
124
126
|
fetch-depth: 1
|
|
127
|
+
persist-credentials: false
|
|
125
128
|
|
|
126
129
|
- name: Run Claude Code
|
|
127
130
|
id: claude
|
|
128
|
-
uses: anthropics/claude-code-action@v1
|
|
131
|
+
uses: anthropics/claude-code-action@8251c103ac8c1d761882c86aba1412c7f583c844 # v1.0.213
|
|
129
132
|
env:
|
|
130
133
|
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
131
134
|
with:
|
|
@@ -145,4 +148,3 @@ jobs:
|
|
|
145
148
|
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
146
149
|
# or https://code.claude.com/docs/en/cli-reference for available options
|
|
147
150
|
# claude_args: '--allowed-tools Bash(gh pr:*)'
|
|
148
|
-
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: CodeRabbit Lifecycle Review
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, ready_for_review]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
pull-requests: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
request-review:
|
|
12
|
+
if: github.event.pull_request.head.repo.fork == false
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Add CodeRabbit lifecycle label
|
|
16
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
17
|
+
with:
|
|
18
|
+
# Both labels must already exist in the repo (addLabels does not create them); created 2026-09-06.
|
|
19
|
+
script: |
|
|
20
|
+
const label = context.payload.action === 'opened'
|
|
21
|
+
? 'coderabbit:first-pass'
|
|
22
|
+
: 'coderabbit:ready';
|
|
23
|
+
|
|
24
|
+
await github.rest.issues.addLabels({
|
|
25
|
+
owner: context.repo.owner,
|
|
26
|
+
repo: context.repo.repo,
|
|
27
|
+
issue_number: context.issue.number,
|
|
28
|
+
labels: [label]
|
|
29
|
+
});
|
|
@@ -6,15 +6,20 @@ on:
|
|
|
6
6
|
- main
|
|
7
7
|
pull_request:
|
|
8
8
|
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
9
12
|
jobs:
|
|
10
13
|
rspec:
|
|
11
14
|
runs-on: ubuntu-latest
|
|
12
15
|
name: Command Docs
|
|
13
16
|
steps:
|
|
14
17
|
- name: Checkout code
|
|
15
|
-
uses: actions/checkout@
|
|
18
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
19
|
+
with:
|
|
20
|
+
persist-credentials: false
|
|
16
21
|
- name: Set up Ruby
|
|
17
|
-
uses: ruby/setup-ruby@v1
|
|
22
|
+
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
|
|
18
23
|
with:
|
|
19
24
|
ruby-version: "3.2"
|
|
20
25
|
bundler-cache: true
|
|
@@ -23,8 +23,15 @@ jobs:
|
|
|
23
23
|
runs-on: ubuntu-latest
|
|
24
24
|
timeout-minutes: 30
|
|
25
25
|
steps:
|
|
26
|
+
# No explicit ref: checkout's default resolves to this event's recorded commit
|
|
27
|
+
# (GITHUB_SHA), which is trusted base-repository code and is exempt from checkout v7's fork-PR guard.
|
|
28
|
+
- name: Checkout generated cpflow actions
|
|
29
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
30
|
+
with:
|
|
31
|
+
persist-credentials: false
|
|
32
|
+
|
|
26
33
|
- name: Checkout control-plane-flow actions
|
|
27
|
-
uses: actions/checkout@
|
|
34
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
28
35
|
with:
|
|
29
36
|
repository: ${{ job.workflow_repository }}
|
|
30
37
|
ref: ${{ job.workflow_sha }}
|
|
@@ -32,7 +39,7 @@ jobs:
|
|
|
32
39
|
persist-credentials: false
|
|
33
40
|
|
|
34
41
|
- name: Validate required secrets and variables
|
|
35
|
-
uses: ./.
|
|
42
|
+
uses: ./.github/actions/cpflow-validate-config
|
|
36
43
|
env:
|
|
37
44
|
CPLN_TOKEN_STAGING: ${{ secrets.CPLN_TOKEN_STAGING }}
|
|
38
45
|
with:
|
|
@@ -40,21 +47,21 @@ jobs:
|
|
|
40
47
|
secret:CPLN_TOKEN_STAGING
|
|
41
48
|
|
|
42
49
|
- name: Checkout caller repository
|
|
43
|
-
uses: actions/checkout@
|
|
50
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
44
51
|
with:
|
|
45
52
|
path: app
|
|
46
53
|
persist-credentials: false
|
|
47
54
|
|
|
48
55
|
- name: Resolve review app config
|
|
49
56
|
id: review-config
|
|
50
|
-
uses: ./.
|
|
57
|
+
uses: ./.github/actions/cpflow-resolve-review-config
|
|
51
58
|
with:
|
|
52
59
|
working_directory: app
|
|
53
60
|
configured_cpln_org_staging: ${{ vars.CPLN_ORG_STAGING }}
|
|
54
61
|
configured_review_app_prefix: ${{ vars.REVIEW_APP_PREFIX }}
|
|
55
62
|
|
|
56
63
|
- name: Setup environment
|
|
57
|
-
uses: ./.
|
|
64
|
+
uses: ./.github/actions/cpflow-setup-environment
|
|
58
65
|
with:
|
|
59
66
|
token: ${{ secrets.CPLN_TOKEN_STAGING }}
|
|
60
67
|
org: ${{ steps.review-config.outputs.cpln_org }}
|
|
@@ -545,7 +545,7 @@ jobs:
|
|
|
545
545
|
- name: React to delete command
|
|
546
546
|
if: github.event_name == 'issue_comment'
|
|
547
547
|
continue-on-error: true
|
|
548
|
-
uses: actions/github-script@
|
|
548
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
549
549
|
with:
|
|
550
550
|
script: |
|
|
551
551
|
try {
|
|
@@ -563,8 +563,15 @@ jobs:
|
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
+
# No explicit ref: checkout's default resolves to this event's recorded commit
|
|
567
|
+
# (GITHUB_SHA; the base-branch tip under pull_request_target) and is exempt from checkout v7's fork-PR guard.
|
|
568
|
+
- name: Checkout generated cpflow actions
|
|
569
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
570
|
+
with:
|
|
571
|
+
persist-credentials: false
|
|
572
|
+
|
|
566
573
|
- name: Checkout control-plane-flow actions
|
|
567
|
-
uses: actions/checkout@
|
|
574
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
568
575
|
with:
|
|
569
576
|
repository: ${{ job.workflow_repository }}
|
|
570
577
|
ref: ${{ job.workflow_sha }}
|
|
@@ -573,7 +580,7 @@ jobs:
|
|
|
573
580
|
|
|
574
581
|
- name: Validate required secrets and variables
|
|
575
582
|
id: config
|
|
576
|
-
uses: ./.
|
|
583
|
+
uses: ./.github/actions/cpflow-validate-config
|
|
577
584
|
env:
|
|
578
585
|
CPLN_TOKEN_STAGING: ${{ secrets.CPLN_TOKEN_STAGING }}
|
|
579
586
|
with:
|
|
@@ -583,7 +590,7 @@ jobs:
|
|
|
583
590
|
|
|
584
591
|
- name: Checkout repository
|
|
585
592
|
if: steps.config.outputs.ready == 'true'
|
|
586
|
-
uses: actions/checkout@
|
|
593
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
587
594
|
with:
|
|
588
595
|
path: app
|
|
589
596
|
persist-credentials: false
|
|
@@ -591,7 +598,7 @@ jobs:
|
|
|
591
598
|
- name: Resolve review app config
|
|
592
599
|
if: steps.config.outputs.ready == 'true'
|
|
593
600
|
id: review-config
|
|
594
|
-
uses: ./.
|
|
601
|
+
uses: ./.github/actions/cpflow-resolve-review-config
|
|
595
602
|
with:
|
|
596
603
|
working_directory: app
|
|
597
604
|
configured_cpln_org_staging: ${{ vars.CPLN_ORG_STAGING }}
|
|
@@ -600,7 +607,7 @@ jobs:
|
|
|
600
607
|
|
|
601
608
|
- name: Setup environment
|
|
602
609
|
if: steps.config.outputs.ready == 'true'
|
|
603
|
-
uses: ./.
|
|
610
|
+
uses: ./.github/actions/cpflow-setup-environment
|
|
604
611
|
with:
|
|
605
612
|
token: ${{ secrets.CPLN_TOKEN_STAGING }}
|
|
606
613
|
org: ${{ steps.review-config.outputs.cpln_org }}
|
|
@@ -611,7 +618,7 @@ jobs:
|
|
|
611
618
|
|
|
612
619
|
- name: Set workflow links
|
|
613
620
|
if: steps.config.outputs.ready == 'true'
|
|
614
|
-
uses: actions/github-script@
|
|
621
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
615
622
|
with:
|
|
616
623
|
script: |
|
|
617
624
|
const workflowUrl = `${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
|
|
@@ -624,7 +631,7 @@ jobs:
|
|
|
624
631
|
- name: Create initial PR comment
|
|
625
632
|
if: steps.config.outputs.ready == 'true'
|
|
626
633
|
id: create-comment
|
|
627
|
-
uses: actions/github-script@
|
|
634
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
628
635
|
with:
|
|
629
636
|
script: |
|
|
630
637
|
const body = [
|
|
@@ -644,7 +651,7 @@ jobs:
|
|
|
644
651
|
- name: Delete review app
|
|
645
652
|
id: delete-app
|
|
646
653
|
if: steps.config.outputs.ready == 'true'
|
|
647
|
-
uses: ./.
|
|
654
|
+
uses: ./.github/actions/cpflow-delete-control-plane-app
|
|
648
655
|
with:
|
|
649
656
|
app_name: ${{ steps.review-config.outputs.app_name }}
|
|
650
657
|
cpln_org: ${{ steps.review-config.outputs.cpln_org }}
|
|
@@ -655,7 +662,7 @@ jobs:
|
|
|
655
662
|
id: deactivate-deployments
|
|
656
663
|
if: steps.config.outputs.ready == 'true' && steps.delete-app.outcome == 'success'
|
|
657
664
|
continue-on-error: true
|
|
658
|
-
uses: actions/github-script@
|
|
665
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
659
666
|
env:
|
|
660
667
|
APP_NAME: ${{ steps.review-config.outputs.app_name }}
|
|
661
668
|
with:
|
|
@@ -710,7 +717,7 @@ jobs:
|
|
|
710
717
|
# config validation created the initial PR comment and workflow link env vars it updates.
|
|
711
718
|
- name: Finalize delete status
|
|
712
719
|
if: always() && steps.config.outputs.ready == 'true'
|
|
713
|
-
uses: actions/github-script@
|
|
720
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
714
721
|
env:
|
|
715
722
|
APP_NAME: ${{ steps.review-config.outputs.app_name }}
|
|
716
723
|
COMMENT_ID: ${{ steps.create-comment.outputs.comment-id }}
|
|
@@ -4,6 +4,12 @@ run-name: "Deploy Review App - PR #${{ github.event.pull_request.number || githu
|
|
|
4
4
|
|
|
5
5
|
on:
|
|
6
6
|
workflow_call:
|
|
7
|
+
inputs:
|
|
8
|
+
docker_build_extra_args:
|
|
9
|
+
description: Optional newline-delimited extra docker build tokens, appended to the repository variable.
|
|
10
|
+
required: false
|
|
11
|
+
type: string
|
|
12
|
+
default: ""
|
|
7
13
|
outputs:
|
|
8
14
|
image_built:
|
|
9
15
|
description: Whether this run successfully built the application image.
|
|
@@ -12,6 +18,9 @@ on:
|
|
|
12
18
|
CPLN_TOKEN_STAGING:
|
|
13
19
|
description: Control Plane token for the staging org that owns review apps.
|
|
14
20
|
required: true
|
|
21
|
+
REVIEW_APP_DOCKER_BUILD_SECRETS:
|
|
22
|
+
description: Optional newline-delimited id=value secrets passed to review-app builds through BuildKit secret mounts.
|
|
23
|
+
required: false
|
|
15
24
|
DOCKER_BUILD_SSH_KEY:
|
|
16
25
|
description: Optional SSH key used by Docker builds that fetch private dependencies.
|
|
17
26
|
required: false
|
|
@@ -590,7 +599,7 @@ jobs:
|
|
|
590
599
|
- name: React to deploy command
|
|
591
600
|
if: github.event_name == 'issue_comment'
|
|
592
601
|
continue-on-error: true
|
|
593
|
-
uses: actions/github-script@
|
|
602
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
594
603
|
with:
|
|
595
604
|
script: |
|
|
596
605
|
try {
|
|
@@ -608,8 +617,15 @@ jobs:
|
|
|
608
617
|
}
|
|
609
618
|
}
|
|
610
619
|
|
|
620
|
+
# No explicit ref: checkout's default resolves to this event's recorded commit
|
|
621
|
+
# (GITHUB_SHA), which is trusted base-repository code and is exempt from checkout v7's fork-PR guard.
|
|
622
|
+
- name: Checkout generated cpflow actions
|
|
623
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
624
|
+
with:
|
|
625
|
+
persist-credentials: false
|
|
626
|
+
|
|
611
627
|
- name: Checkout control-plane-flow actions
|
|
612
|
-
uses: actions/checkout@
|
|
628
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
613
629
|
with:
|
|
614
630
|
repository: ${{ job.workflow_repository }}
|
|
615
631
|
ref: ${{ job.workflow_sha }}
|
|
@@ -618,7 +634,7 @@ jobs:
|
|
|
618
634
|
|
|
619
635
|
- name: Validate required secrets and variables
|
|
620
636
|
id: config
|
|
621
|
-
uses: ./.
|
|
637
|
+
uses: ./.github/actions/cpflow-validate-config
|
|
622
638
|
env:
|
|
623
639
|
CPLN_TOKEN_STAGING: ${{ secrets.CPLN_TOKEN_STAGING }}
|
|
624
640
|
with:
|
|
@@ -691,7 +707,9 @@ jobs:
|
|
|
691
707
|
exit 0
|
|
692
708
|
fi
|
|
693
709
|
|
|
694
|
-
|
|
710
|
+
# pull_request_target is in this workflow's event allowlist, so it needs the same
|
|
711
|
+
# fork skip as pull_request instead of falling through to the workflow_dispatch error.
|
|
712
|
+
if [[ "${EVENT_NAME}" == "pull_request" || "${EVENT_NAME}" == "pull_request_target" ]]; then
|
|
695
713
|
echo "allowed=false" >> "$GITHUB_OUTPUT"
|
|
696
714
|
{
|
|
697
715
|
echo "Review app deploys are skipped for fork pull requests."
|
|
@@ -714,7 +732,7 @@ jobs:
|
|
|
714
732
|
|
|
715
733
|
- name: Checkout PR commit
|
|
716
734
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true'
|
|
717
|
-
uses: actions/checkout@
|
|
735
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
718
736
|
with:
|
|
719
737
|
ref: ${{ env.PR_SHA }}
|
|
720
738
|
path: app
|
|
@@ -730,7 +748,7 @@ jobs:
|
|
|
730
748
|
- name: Resolve review app config
|
|
731
749
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true'
|
|
732
750
|
id: review-config
|
|
733
|
-
uses: ./.
|
|
751
|
+
uses: ./.github/actions/cpflow-resolve-review-config
|
|
734
752
|
with:
|
|
735
753
|
working_directory: app
|
|
736
754
|
configured_cpln_org_staging: ${{ vars.CPLN_ORG_STAGING }}
|
|
@@ -739,7 +757,7 @@ jobs:
|
|
|
739
757
|
|
|
740
758
|
- name: Setup environment
|
|
741
759
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true'
|
|
742
|
-
uses: ./.
|
|
760
|
+
uses: ./.github/actions/cpflow-setup-environment
|
|
743
761
|
with:
|
|
744
762
|
token: ${{ secrets.CPLN_TOKEN_STAGING }}
|
|
745
763
|
org: ${{ steps.review-config.outputs.cpln_org }}
|
|
@@ -751,7 +769,7 @@ jobs:
|
|
|
751
769
|
- name: Detect release phase support
|
|
752
770
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true'
|
|
753
771
|
id: release-phase
|
|
754
|
-
uses: ./.
|
|
772
|
+
uses: ./.github/actions/cpflow-detect-release-phase
|
|
755
773
|
with:
|
|
756
774
|
app_name: ${{ steps.review-config.outputs.app_name }}
|
|
757
775
|
working_directory: app
|
|
@@ -826,7 +844,7 @@ jobs:
|
|
|
826
844
|
- name: Create initial PR comment
|
|
827
845
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
|
|
828
846
|
id: create-comment
|
|
829
|
-
uses: actions/github-script@
|
|
847
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
830
848
|
with:
|
|
831
849
|
script: |
|
|
832
850
|
const body = [
|
|
@@ -845,7 +863,7 @@ jobs:
|
|
|
845
863
|
|
|
846
864
|
- name: Set deployment links
|
|
847
865
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
|
|
848
|
-
uses: actions/github-script@
|
|
866
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
849
867
|
with:
|
|
850
868
|
script: |
|
|
851
869
|
const workflowUrl = `${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
|
|
@@ -858,7 +876,7 @@ jobs:
|
|
|
858
876
|
- name: Initialize GitHub deployment
|
|
859
877
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
|
|
860
878
|
id: init-deployment
|
|
861
|
-
uses: actions/github-script@
|
|
879
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
862
880
|
with:
|
|
863
881
|
script: |
|
|
864
882
|
const deployment = await github.rest.repos.createDeployment({
|
|
@@ -885,7 +903,7 @@ jobs:
|
|
|
885
903
|
|
|
886
904
|
- name: Update PR comment with build status
|
|
887
905
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
|
|
888
|
-
uses: actions/github-script@
|
|
906
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
889
907
|
env:
|
|
890
908
|
COMMENT_ID: ${{ steps.create-comment.outputs.comment-id }}
|
|
891
909
|
with:
|
|
@@ -913,20 +931,23 @@ jobs:
|
|
|
913
931
|
- name: Build Docker image
|
|
914
932
|
id: build-image
|
|
915
933
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
|
|
916
|
-
uses: ./.
|
|
934
|
+
uses: ./.github/actions/cpflow-build-docker-image
|
|
917
935
|
with:
|
|
918
936
|
app_name: ${{ steps.review-config.outputs.app_name }}
|
|
919
937
|
org: ${{ steps.review-config.outputs.cpln_org }}
|
|
920
938
|
commit: ${{ env.PR_SHA }}
|
|
921
939
|
pr_number: ${{ env.PR_NUMBER }}
|
|
922
|
-
docker_build_extra_args:
|
|
940
|
+
docker_build_extra_args: |
|
|
941
|
+
${{ vars.DOCKER_BUILD_EXTRA_ARGS }}
|
|
942
|
+
${{ inputs.docker_build_extra_args }}
|
|
943
|
+
docker_build_secrets: ${{ secrets.REVIEW_APP_DOCKER_BUILD_SECRETS }}
|
|
923
944
|
docker_build_ssh_key: ${{ secrets.DOCKER_BUILD_SSH_KEY }}
|
|
924
945
|
docker_build_ssh_known_hosts: ${{ vars.DOCKER_BUILD_SSH_KNOWN_HOSTS }}
|
|
925
946
|
working_directory: app
|
|
926
947
|
|
|
927
948
|
- name: Update PR comment with deploy status
|
|
928
949
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
|
|
929
|
-
uses: actions/github-script@
|
|
950
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
930
951
|
env:
|
|
931
952
|
COMMENT_ID: ${{ steps.create-comment.outputs.comment-id }}
|
|
932
953
|
DEPLOYING_ICON_URL: ${{ vars.REVIEW_APP_DEPLOYING_ICON_URL }}
|
|
@@ -998,7 +1019,7 @@ jobs:
|
|
|
998
1019
|
- name: Wait for deployment health
|
|
999
1020
|
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
|
|
1000
1021
|
id: health-check
|
|
1001
|
-
uses: ./.
|
|
1022
|
+
uses: ./.github/actions/cpflow-wait-for-health
|
|
1002
1023
|
with:
|
|
1003
1024
|
workload_name: ${{ env.PRIMARY_WORKLOAD || 'rails' }}
|
|
1004
1025
|
app_name: ${{ steps.review-config.outputs.app_name }}
|
|
@@ -1087,7 +1108,7 @@ jobs:
|
|
|
1087
1108
|
|
|
1088
1109
|
- name: Finalize deployment status
|
|
1089
1110
|
if: always() && steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
|
|
1090
|
-
uses: actions/github-script@
|
|
1111
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
1091
1112
|
env:
|
|
1092
1113
|
COMMENT_ID: ${{ steps.create-comment.outputs.comment-id }}
|
|
1093
1114
|
DEPLOYMENT_ID: ${{ steps.init-deployment.outputs.result }}
|
|
@@ -5,6 +5,11 @@ run-name: Deploy Control Plane staging app
|
|
|
5
5
|
on:
|
|
6
6
|
workflow_call:
|
|
7
7
|
inputs:
|
|
8
|
+
docker_build_extra_args:
|
|
9
|
+
description: Optional newline-delimited extra docker build tokens, appended to the repository variable.
|
|
10
|
+
required: false
|
|
11
|
+
type: string
|
|
12
|
+
default: ""
|
|
8
13
|
staging_app_branch_default:
|
|
9
14
|
description: Fallback branch name baked into the generated caller workflow.
|
|
10
15
|
required: false
|
|
@@ -14,6 +19,9 @@ on:
|
|
|
14
19
|
CPLN_TOKEN_STAGING:
|
|
15
20
|
description: Control Plane token for the staging org.
|
|
16
21
|
required: true
|
|
22
|
+
DOCKER_BUILD_SECRETS:
|
|
23
|
+
description: Optional newline-delimited id=value secrets passed through BuildKit secret mounts.
|
|
24
|
+
required: false
|
|
17
25
|
DOCKER_BUILD_SSH_KEY:
|
|
18
26
|
description: Optional SSH key used by Docker builds that fetch private dependencies.
|
|
19
27
|
required: false
|
|
@@ -60,9 +68,15 @@ jobs:
|
|
|
60
68
|
echo "is_deployable=false" >> "$GITHUB_OUTPUT"
|
|
61
69
|
fi
|
|
62
70
|
|
|
71
|
+
- name: Checkout generated cpflow actions
|
|
72
|
+
if: steps.check-branch.outputs.is_deployable == 'true'
|
|
73
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
74
|
+
with:
|
|
75
|
+
persist-credentials: false
|
|
76
|
+
|
|
63
77
|
- name: Checkout control-plane-flow actions
|
|
64
78
|
if: steps.check-branch.outputs.is_deployable == 'true'
|
|
65
|
-
uses: actions/checkout@
|
|
79
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
66
80
|
with:
|
|
67
81
|
repository: ${{ job.workflow_repository }}
|
|
68
82
|
ref: ${{ job.workflow_sha }}
|
|
@@ -71,7 +85,7 @@ jobs:
|
|
|
71
85
|
|
|
72
86
|
- name: Validate required secrets and variables
|
|
73
87
|
if: steps.check-branch.outputs.is_deployable == 'true'
|
|
74
|
-
uses: ./.
|
|
88
|
+
uses: ./.github/actions/cpflow-validate-config
|
|
75
89
|
env:
|
|
76
90
|
CPLN_TOKEN_STAGING: ${{ secrets.CPLN_TOKEN_STAGING }}
|
|
77
91
|
CPLN_ORG_STAGING: ${{ vars.CPLN_ORG_STAGING }}
|
|
@@ -89,12 +103,12 @@ jobs:
|
|
|
89
103
|
timeout-minutes: 30
|
|
90
104
|
steps:
|
|
91
105
|
- name: Checkout repository
|
|
92
|
-
uses: actions/checkout@
|
|
106
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
93
107
|
with:
|
|
94
108
|
persist-credentials: false
|
|
95
109
|
|
|
96
110
|
- name: Checkout control-plane-flow actions
|
|
97
|
-
uses: actions/checkout@
|
|
111
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
98
112
|
with:
|
|
99
113
|
repository: ${{ job.workflow_repository }}
|
|
100
114
|
ref: ${{ job.workflow_sha }}
|
|
@@ -102,7 +116,7 @@ jobs:
|
|
|
102
116
|
persist-credentials: false
|
|
103
117
|
|
|
104
118
|
- name: Setup environment
|
|
105
|
-
uses: ./.
|
|
119
|
+
uses: ./.github/actions/cpflow-setup-environment
|
|
106
120
|
with:
|
|
107
121
|
token: ${{ secrets.CPLN_TOKEN_STAGING }}
|
|
108
122
|
org: ${{ vars.CPLN_ORG_STAGING }}
|
|
@@ -112,12 +126,15 @@ jobs:
|
|
|
112
126
|
control_plane_flow_ref: ${{ job.workflow_ref }}
|
|
113
127
|
|
|
114
128
|
- name: Build Docker image
|
|
115
|
-
uses: ./.
|
|
129
|
+
uses: ./.github/actions/cpflow-build-docker-image
|
|
116
130
|
with:
|
|
117
131
|
app_name: ${{ env.APP_NAME }}
|
|
118
132
|
org: ${{ vars.CPLN_ORG_STAGING }}
|
|
119
133
|
commit: ${{ github.sha }}
|
|
120
|
-
docker_build_extra_args:
|
|
134
|
+
docker_build_extra_args: |
|
|
135
|
+
${{ vars.DOCKER_BUILD_EXTRA_ARGS }}
|
|
136
|
+
${{ inputs.docker_build_extra_args }}
|
|
137
|
+
docker_build_secrets: ${{ secrets.DOCKER_BUILD_SECRETS }}
|
|
121
138
|
docker_build_ssh_key: ${{ secrets.DOCKER_BUILD_SSH_KEY }}
|
|
122
139
|
docker_build_ssh_known_hosts: ${{ vars.DOCKER_BUILD_SSH_KNOWN_HOSTS }}
|
|
123
140
|
|
|
@@ -128,12 +145,12 @@ jobs:
|
|
|
128
145
|
timeout-minutes: 30
|
|
129
146
|
steps:
|
|
130
147
|
- name: Checkout repository
|
|
131
|
-
uses: actions/checkout@
|
|
148
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
132
149
|
with:
|
|
133
150
|
persist-credentials: false
|
|
134
151
|
|
|
135
152
|
- name: Checkout control-plane-flow actions
|
|
136
|
-
uses: actions/checkout@
|
|
153
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
137
154
|
with:
|
|
138
155
|
repository: ${{ job.workflow_repository }}
|
|
139
156
|
ref: ${{ job.workflow_sha }}
|
|
@@ -141,7 +158,7 @@ jobs:
|
|
|
141
158
|
persist-credentials: false
|
|
142
159
|
|
|
143
160
|
- name: Setup environment
|
|
144
|
-
uses: ./.
|
|
161
|
+
uses: ./.github/actions/cpflow-setup-environment
|
|
145
162
|
with:
|
|
146
163
|
token: ${{ secrets.CPLN_TOKEN_STAGING }}
|
|
147
164
|
org: ${{ vars.CPLN_ORG_STAGING }}
|
|
@@ -152,7 +169,7 @@ jobs:
|
|
|
152
169
|
|
|
153
170
|
- name: Detect release phase support
|
|
154
171
|
id: release-phase
|
|
155
|
-
uses: ./.
|
|
172
|
+
uses: ./.github/actions/cpflow-detect-release-phase
|
|
156
173
|
with:
|
|
157
174
|
app_name: ${{ env.APP_NAME }}
|
|
158
175
|
|