Skip to content

Commit c53de0e

Browse files
authored
ci: fix integration-test-deployment script (#35716)
### Reason for this change - Previously, the script was executing the script under the cwd of the script package, when it should be at the head branch folder. - PATH was not passed on to integration test spawn command, leading to a ENOENT error as the integration test command could not find yarn. - Workflow trigger on label is misconfigured. ### Description of changes - We'll use node explicitly to run the script without changing the cwd. - PATH env variable is now passed to integration test command. - Workflow trigger on label is fixed. ### Describe any new or updated permissions being added No new permissions were added. ### Description of how you validated changes Tested on my fork here: https://github.com/Abogical/aws-cdk/actions/runs/18465794651/job/52607352315?pr=15 ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent d01a553 commit c53de0e

File tree

4 files changed

+17
-28
lines changed

4 files changed

+17
-28
lines changed

.github/workflows/integration-test-deployment.yml

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
workflow_dispatch: {}
88
merge_group: {}
99
pull_request_target:
10+
types:
11+
- opened
12+
- synchronize
13+
- reopened
14+
- labeled
1015
branches:
1116
- main
1217
paths:
@@ -21,26 +26,18 @@ jobs:
2126
integration_test_deployment:
2227
runs-on: codebuild-aws-cdk-github-actions-deployment-integ-runner-${{ github.run_id }}-${{ github.run_attempt }}
2328
environment: deployment-integ-test # Do not change or remove this without discussing with Appsec
24-
if: contains(github.event.pull_request.labels.*.name, 'pr/needs-integration-tests-deployment ')
29+
if: contains(github.event.pull_request.labels.*.name, 'pr/needs-integration-tests-deployment')
2530
name: 'Deploy integration test snapshots (requires `pr/needs-integration-tests-deployment` label)'
2631

2732
env:
2833
PR_BUILD: true
2934

3035
steps:
31-
- name: Checkout BASE
32-
uses: actions/checkout@v5
33-
with:
34-
ref: ${{ github.event.pull_request.base.sha }}
35-
fetch-depth: 0
36-
path: base
37-
3836
- name: Checkout HEAD
3937
uses: actions/checkout@v5
4038
with:
4139
ref: ${{ github.event.pull_request.head.sha }}
4240
fetch-depth: 0
43-
path: head
4441

4542
- name: Configure AWS credentials
4643
uses: aws-actions/configure-aws-credentials@v5
@@ -55,8 +52,7 @@ jobs:
5552
node-version: "lts/*"
5653
cache: "yarn"
5754
cache-dependency-path: |
58-
base/yarn.lock
59-
head/yarn.lock
55+
yarn.lock
6056
6157
- name: Set up Docker
6258
uses: docker/setup-buildx-action@v3
@@ -85,26 +81,18 @@ jobs:
8581
run: |
8682
(command -v sysctl || sudo apt-get update && sudo apt-get install -y procps) && \
8783
sudo sysctl -w vm.max_map_count=2251954
88-
89-
- name: Install dependencies for integration-test-deployment (BASE)
90-
working-directory: base
91-
run: yarn --cwd tools/@aws-cdk/integration-test-deployment install
92-
93-
- name: Build deployment-integ (BASE)
94-
working-directory: base
95-
run: yarn --cwd tools/@aws-cdk/integration-test-deployment build
9684
97-
- name: Install dependencies for Integration Tests (HEAD)
98-
working-directory: head
85+
- name: Install dependencies for Integration Tests
9986
run: yarn install
87+
88+
- name: Build deployment-integ
89+
run: yarn --cwd tools/@aws-cdk/integration-test-deployment build
10090

101-
- name: Build Integration Tests (HEAD)
102-
working-directory: head
91+
- name: Build Integration Tests
10392
run: npx lerna run build --scope=@aws-cdk-testing/framework-integ
10493

105-
- name: Run integration tests from HEAD using integration-test-deployment script from BASE
106-
run: yarn --cwd ../base/tools/@aws-cdk/integration-test-deployment/ integration-test-deployment
107-
working-directory: head
94+
- name: Run integration tests using integration-test-deployment script
95+
run: yarn run atmosphere-integ-test
10896
env:
10997
CDK_ATMOSPHERE_ENDPOINT: ${{ vars.CDK_ATMOSPHERE_ENDPOINT }}
11098
CDK_ATMOSPHERE_POOL: ${{ vars.CDK_ATMOSPHERE_POOL}}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"pack": "./pack.sh",
1313
"compat": "./scripts/check-api-compatibility.sh",
1414
"bump": "./bump.sh",
15-
"build-all": "tsc -b"
15+
"build-all": "tsc -b",
16+
"atmosphere-integ-test": "lerna run build --scope @aws-cdk/integration-test-deployment && node tools/@aws-cdk/integration-test-deployment/bin/index.js"
1617
},
1718
"devDependencies": {
1819
"@nx/workspace": "^20",

tools/@aws-cdk/integration-test-deployment/lib/integration-test-runner.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const deployInegTestsWithAtmosphere = async ({ endpoint, pool }: {endpoin
88

99
try {
1010
const env = {
11+
PATH: process.env.PATH, // Allows the spawn process to find the yarn binary.
1112
AWS_ACCESS_KEY_ID: allocation.allocation.credentials.accessKeyId,
1213
AWS_SECRET_ACCESS_KEY: allocation.allocation.credentials.secretAccessKey,
1314
AWS_SESSION_TOKEN: allocation.allocation.credentials.sessionToken,

tools/@aws-cdk/integration-test-deployment/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@
2323
"ts-jest": "^29.4.1",
2424
"typescript": "~5.5.4"
2525
},
26-
"main": "bin/project-sync.js",
2726
"license": "Apache-2.0"
2827
}

0 commit comments

Comments
 (0)