Skip to content

Commit 7fb9f3d

Browse files
authored
Merge pull request #401 from co-cddo/chore/serialize-and-svc-catalog
feat(ci-lease): reuse_account_id to skip acquire/release while debugging
2 parents 0072fd5 + ca6f0ee commit 7fb9f3d

17 files changed

Lines changed: 132 additions & 18 deletions

.github/workflows/scenario-ai-contact-centre.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ on:
99
- 'scripts/isb/**'
1010
- 'tests/smoke/**'
1111
workflow_dispatch:
12-
12+
inputs:
13+
reuse_account_id:
14+
description: 'DEBUG: reuse an already-leased account (set via `isb assign` locally). Skips acquire/release.'
15+
required: false
16+
type: string
17+
default: ''
1318
concurrency:
1419
# Repo-wide group across ALL scenario callers because ISB caps ci-bot
1520
# at 1 active lease at a time (maxLeasesPerUser). Concurrent dispatches
@@ -26,4 +31,5 @@ jobs:
2631
uses: ./.github/workflows/scenario-ci.yml
2732
with:
2833
scenario: ai-contact-centre
34+
reuse_account_id: ${{ inputs.reuse_account_id || '' }}
2935
secrets: inherit

.github/workflows/scenario-bops-planning.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ on:
99
- 'scripts/isb/**'
1010
- 'tests/smoke/**'
1111
workflow_dispatch:
12-
12+
inputs:
13+
reuse_account_id:
14+
description: 'DEBUG: reuse an already-leased account (set via `isb assign` locally). Skips acquire/release.'
15+
required: false
16+
type: string
17+
default: ''
1318
concurrency:
1419
# Repo-wide group across ALL scenario callers because ISB caps ci-bot
1520
# at 1 active lease at a time (maxLeasesPerUser). Concurrent dispatches
@@ -26,4 +31,5 @@ jobs:
2631
uses: ./.github/workflows/scenario-ci.yml
2732
with:
2833
scenario: bops-planning
34+
reuse_account_id: ${{ inputs.reuse_account_id || '' }}
2935
secrets: inherit

.github/workflows/scenario-ci.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ on:
3131
required: false
3232
type: string
3333
default: ci-bot@ndx-try.local
34+
reuse_account_id:
35+
description: |
36+
DEBUG: skip acquire/release; use this already-leased pool account.
37+
Lease the account locally first (`isb assign` then look at
38+
assigned account_id) and paste here. Workflow will assume
39+
CIDeployRole directly. Lease is NOT released — call `isb terminate`
40+
when done. Used during CI iteration to avoid burning pool accounts.
41+
required: false
42+
type: string
43+
default: ''
3444

3545
permissions:
3646
id-token: write
@@ -86,19 +96,27 @@ jobs:
8696

8797
- name: Acquire ISB lease
8898
id: lease
99+
if: inputs.reuse_account_id == ''
89100
run: |
90101
python3 scripts/isb/ci_lease.py acquire \
91102
--template '${{ inputs.lease_template }}' \
92103
--user-email '${{ inputs.ci_lease_email }}'
93104
105+
- name: Use reused lease account
106+
id: reuse
107+
if: inputs.reuse_account_id != ''
108+
run: |
109+
echo "::notice::Reusing already-leased account ${{ inputs.reuse_account_id }} — acquire+release skipped"
110+
echo "account_id=${{ inputs.reuse_account_id }}" >> "$GITHUB_OUTPUT"
111+
94112
# Now assume the in-lease CIDeployRole. role-chaining=true tells
95113
# configure-aws-credentials to sigv4-sign from the already-loaded
96114
# hub creds (sts:AssumeRole) instead of trying OIDC against the
97115
# leased account (which has no OIDC provider).
98116
- uses: aws-actions/configure-aws-credentials@v6
99117
id: lease-creds
100118
with:
101-
role-to-assume: arn:aws:iam::${{ steps.lease.outputs.account_id }}:role/InnovationSandbox-ndx-CIDeployRole
119+
role-to-assume: arn:aws:iam::${{ steps.lease.outputs.account_id || steps.reuse.outputs.account_id }}:role/InnovationSandbox-ndx-CIDeployRole
102120
role-session-name: scenario-ci-deploy-${{ github.run_id }}
103121
aws-region: us-east-1
104122
# Chained assumes (sigv4 from already-assumed creds) are capped
@@ -117,7 +135,7 @@ jobs:
117135
env:
118136
SCENARIO: ${{ inputs.scenario }}
119137
TEMPLATE: ${{ steps.paths.outputs.template_path }}
120-
ACCOUNT_ID: ${{ steps.lease.outputs.account_id }}
138+
ACCOUNT_ID: ${{ steps.lease.outputs.account_id || steps.reuse.outputs.account_id }}
121139
run: |
122140
set -euo pipefail
123141
STACK_NAME="ndx-try-${SCENARIO}"

.github/workflows/scenario-council-chatbot.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ on:
1212
- 'scripts/isb/**'
1313
- 'tests/smoke/**'
1414
workflow_dispatch:
15-
15+
inputs:
16+
reuse_account_id:
17+
description: 'DEBUG: reuse an already-leased account (set via `isb assign` locally). Skips acquire/release.'
18+
required: false
19+
type: string
20+
default: ''
1621
concurrency:
1722
# Repo-wide group across ALL scenario callers because ISB caps ci-bot
1823
# at 1 active lease at a time (maxLeasesPerUser). Concurrent dispatches
@@ -29,4 +34,5 @@ jobs:
2934
uses: ./.github/workflows/scenario-ci.yml
3035
with:
3136
scenario: council-chatbot
37+
reuse_account_id: ${{ inputs.reuse_account_id || '' }}
3238
secrets: inherit

.github/workflows/scenario-digital-planning-register.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ on:
99
- 'scripts/isb/**'
1010
- 'tests/smoke/**'
1111
workflow_dispatch:
12-
12+
inputs:
13+
reuse_account_id:
14+
description: 'DEBUG: reuse an already-leased account (set via `isb assign` locally). Skips acquire/release.'
15+
required: false
16+
type: string
17+
default: ''
1318
concurrency:
1419
# Repo-wide group across ALL scenario callers because ISB caps ci-bot
1520
# at 1 active lease at a time (maxLeasesPerUser). Concurrent dispatches
@@ -26,4 +31,5 @@ jobs:
2631
uses: ./.github/workflows/scenario-ci.yml
2732
with:
2833
scenario: digital-planning-register
34+
reuse_account_id: ${{ inputs.reuse_account_id || '' }}
2935
secrets: inherit

.github/workflows/scenario-fixmystreet.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ on:
99
- 'scripts/isb/**'
1010
- 'tests/smoke/**'
1111
workflow_dispatch:
12-
12+
inputs:
13+
reuse_account_id:
14+
description: 'DEBUG: reuse an already-leased account (set via `isb assign` locally). Skips acquire/release.'
15+
required: false
16+
type: string
17+
default: ''
1318
concurrency:
1419
# Repo-wide group across ALL scenario callers because ISB caps ci-bot
1520
# at 1 active lease at a time (maxLeasesPerUser). Concurrent dispatches
@@ -26,4 +31,5 @@ jobs:
2631
uses: ./.github/workflows/scenario-ci.yml
2732
with:
2833
scenario: fixmystreet
34+
reuse_account_id: ${{ inputs.reuse_account_id || '' }}
2935
secrets: inherit

.github/workflows/scenario-foi-redaction.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ on:
99
- 'scripts/isb/**'
1010
- 'tests/smoke/**'
1111
workflow_dispatch:
12-
12+
inputs:
13+
reuse_account_id:
14+
description: 'DEBUG: reuse an already-leased account (set via `isb assign` locally). Skips acquire/release.'
15+
required: false
16+
type: string
17+
default: ''
1318
concurrency:
1419
# Repo-wide group across ALL scenario callers because ISB caps ci-bot
1520
# at 1 active lease at a time (maxLeasesPerUser). Concurrent dispatches
@@ -26,4 +31,5 @@ jobs:
2631
uses: ./.github/workflows/scenario-ci.yml
2732
with:
2833
scenario: foi-redaction
34+
reuse_account_id: ${{ inputs.reuse_account_id || '' }}
2935
secrets: inherit

.github/workflows/scenario-localgov-drupal.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ on:
99
- 'scripts/isb/**'
1010
- 'tests/smoke/**'
1111
workflow_dispatch:
12-
12+
inputs:
13+
reuse_account_id:
14+
description: 'DEBUG: reuse an already-leased account (set via `isb assign` locally). Skips acquire/release.'
15+
required: false
16+
type: string
17+
default: ''
1318
concurrency:
1419
# Repo-wide group across ALL scenario callers because ISB caps ci-bot
1520
# at 1 active lease at a time (maxLeasesPerUser). Concurrent dispatches
@@ -26,4 +31,5 @@ jobs:
2631
uses: ./.github/workflows/scenario-ci.yml
2732
with:
2833
scenario: localgov-drupal
34+
reuse_account_id: ${{ inputs.reuse_account_id || '' }}
2935
secrets: inherit

.github/workflows/scenario-localgov-ims.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ on:
99
- 'scripts/isb/**'
1010
- 'tests/smoke/**'
1111
workflow_dispatch:
12-
12+
inputs:
13+
reuse_account_id:
14+
description: 'DEBUG: reuse an already-leased account (set via `isb assign` locally). Skips acquire/release.'
15+
required: false
16+
type: string
17+
default: ''
1318
concurrency:
1419
# Repo-wide group across ALL scenario callers because ISB caps ci-bot
1520
# at 1 active lease at a time (maxLeasesPerUser). Concurrent dispatches
@@ -26,4 +31,5 @@ jobs:
2631
uses: ./.github/workflows/scenario-ci.yml
2732
with:
2833
scenario: localgov-ims
34+
reuse_account_id: ${{ inputs.reuse_account_id || '' }}
2935
secrets: inherit

.github/workflows/scenario-minute.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ on:
99
- 'scripts/isb/**'
1010
- 'tests/smoke/**'
1111
workflow_dispatch:
12-
12+
inputs:
13+
reuse_account_id:
14+
description: 'DEBUG: reuse an already-leased account (set via `isb assign` locally). Skips acquire/release.'
15+
required: false
16+
type: string
17+
default: ''
1318
concurrency:
1419
# Repo-wide group across ALL scenario callers because ISB caps ci-bot
1520
# at 1 active lease at a time (maxLeasesPerUser). Concurrent dispatches
@@ -26,4 +31,5 @@ jobs:
2631
uses: ./.github/workflows/scenario-ci.yml
2732
with:
2833
scenario: minute
34+
reuse_account_id: ${{ inputs.reuse_account_id || '' }}
2935
secrets: inherit

0 commit comments

Comments
 (0)