Skip to content

Commit 2c49140

Browse files
committed
Pass Control Plane token to cpflow steps
1 parent ff6a820 commit 2c49140

5 files changed

Lines changed: 22 additions & 0 deletions

.github/workflows/cpflow-cleanup-stale-review-apps.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848

4949
- name: Remove stale review apps
5050
env:
51+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
5152
REVIEW_APP_PREFIX: ${{ vars.REVIEW_APP_PREFIX }}
5253
CPLN_ORG_STAGING: ${{ vars.CPLN_ORG_STAGING }}
5354
shell: bash

.github/workflows/cpflow-delete-review-app.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ jobs:
109109
- name: Delete review app
110110
if: steps.config.outputs.ready == 'true'
111111
uses: ./.github/actions/cpflow-delete-control-plane-app
112+
env:
113+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
112114
with:
113115
app_name: ${{ env.APP_NAME }}
114116
cpln_org: ${{ vars.CPLN_ORG_STAGING }}

.github/workflows/cpflow-deploy-review-app.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ jobs:
216216
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true'
217217
id: check-app
218218
working-directory: app
219+
env:
220+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
219221
shell: bash
220222
run: |
221223
set -euo pipefail
@@ -261,6 +263,8 @@ jobs:
261263
id: setup-review-app
262264
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && steps.check-app.outputs.exists != 'true' && github.event_name != 'pull_request'
263265
working-directory: app
266+
env:
267+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
264268
shell: bash
265269
run: |
266270
set -euo pipefail
@@ -347,6 +351,8 @@ jobs:
347351
- name: Build Docker image
348352
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
349353
uses: ./.github/actions/cpflow-build-docker-image
354+
env:
355+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
350356
with:
351357
app_name: ${{ env.APP_NAME }}
352358
org: ${{ vars.CPLN_ORG_STAGING }}
@@ -387,6 +393,7 @@ jobs:
387393
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
388394
working-directory: app
389395
env:
396+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
390397
RELEASE_PHASE_FLAG: ${{ steps.release-phase.outputs.flag }}
391398
shell: bash
392399
run: |
@@ -404,6 +411,8 @@ jobs:
404411
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
405412
id: workload
406413
working-directory: app
414+
env:
415+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
407416
shell: bash
408417
run: |
409418
set -euo pipefail

.github/workflows/cpflow-deploy-staging.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ jobs:
9191

9292
- name: Build Docker image
9393
uses: ./.github/actions/cpflow-build-docker-image
94+
env:
95+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
9496
with:
9597
app_name: ${{ env.APP_NAME }}
9698
org: ${{ vars.CPLN_ORG_STAGING }}
@@ -126,6 +128,7 @@ jobs:
126128

127129
- name: Deploy staging image
128130
env:
131+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
129132
RELEASE_PHASE_FLAG: ${{ steps.release-phase.outputs.flag }}
130133
shell: bash
131134
run: |

.github/workflows/cpflow-promote-staging-to-production.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ jobs:
162162
- name: Capture current production image
163163
id: capture-current
164164
env:
165+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
165166
PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
166167
CPLN_ORG_PRODUCTION: ${{ vars.CPLN_ORG_PRODUCTION }}
167168
WORKLOAD_NAMES: ${{ steps.workloads.outputs.names }}
@@ -271,6 +272,7 @@ jobs:
271272
272273
- name: Copy image from staging
273274
env:
275+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
274276
# Pass the upstream token via env rather than `-t` so it doesn't appear in /proc/<pid>/cmdline.
275277
CPLN_UPSTREAM_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
276278
PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
@@ -283,6 +285,7 @@ jobs:
283285
284286
- name: Deploy image to production
285287
env:
288+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
286289
PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
287290
CPLN_ORG_PRODUCTION: ${{ vars.CPLN_ORG_PRODUCTION }}
288291
RELEASE_PHASE_FLAG: ${{ steps.release-phase.outputs.flag }}
@@ -301,6 +304,8 @@ jobs:
301304
- name: Wait for deployment health
302305
id: health-check
303306
uses: ./.github/actions/cpflow-wait-for-health
307+
env:
308+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
304309
with:
305310
workload_name: ${{ env.PRIMARY_WORKLOAD || 'rails' }}
306311
app_name: ${{ vars.PRODUCTION_APP_NAME }}
@@ -312,6 +317,7 @@ jobs:
312317
- name: Roll back on failure
313318
if: failure() && steps.capture-current.outputs.rollback_state != '' && steps.capture-current.outputs.rollback_state != '{}'
314319
env:
320+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
315321
ROLLBACK_STATE: ${{ steps.capture-current.outputs.rollback_state }}
316322
PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
317323
CPLN_ORG_PRODUCTION: ${{ vars.CPLN_ORG_PRODUCTION }}
@@ -378,6 +384,7 @@ jobs:
378384
- name: Wait for rollback readiness
379385
if: failure() && steps.capture-current.outputs.rollback_state != '' && steps.capture-current.outputs.rollback_state != '{}'
380386
env:
387+
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
381388
ROLLBACK_STATE: ${{ steps.capture-current.outputs.rollback_state }}
382389
PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
383390
CPLN_ORG_PRODUCTION: ${{ vars.CPLN_ORG_PRODUCTION }}

0 commit comments

Comments
 (0)