Skip to content

Commit ec3160b

Browse files
committed
test: stub Stage 2 for fork testing (DO NOT MERGE)
Temporary commit to validate the workflow_run artifact handoff on ozelalisen/aws-cdk fork. Will be reverted after testing.
1 parent 49066b8 commit ec3160b

2 files changed

Lines changed: 48 additions & 96 deletions

File tree

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,34 @@ name: Integration Test Auto Trigger
99
on:
1010
pull_request_review:
1111
types: [submitted]
12+
# Manual trigger for testing (e.g., when self-approval is not possible on forks)
13+
workflow_dispatch:
14+
inputs:
15+
pr_number:
16+
description: 'PR number to test'
17+
required: true
18+
head_sha:
19+
description: 'Head commit SHA'
20+
required: true
21+
base_sha:
22+
description: 'Base commit SHA'
23+
required: true
24+
reviewer:
25+
description: 'Reviewer login'
26+
required: true
1227

1328
permissions:
1429
contents: read
1530

1631
jobs:
1732
save-pr-info:
18-
if: github.event.review.state == 'approved'
33+
if: github.event_name == 'workflow_dispatch' || github.event.review.state == 'approved'
1934
runs-on: ubuntu-latest
2035
steps:
2136
- name: Checkout
2237
uses: actions/checkout@v6
2338
with:
24-
ref: ${{ github.event.pull_request.head.sha }}
39+
ref: ${{ github.event.inputs.head_sha || github.event.pull_request.head.sha }}
2540
fetch-depth: 0
2641

2742
- name: Setup Node.js
@@ -38,8 +53,8 @@ jobs:
3853
- name: Check for snapshot changes
3954
id: check_snapshots
4055
env:
41-
TARGET_BRANCH_COMMIT: ${{ github.event.pull_request.base.sha }}
42-
SOURCE_BRANCH_COMMIT: ${{ github.event.pull_request.head.sha }}
56+
TARGET_BRANCH_COMMIT: ${{ github.event.inputs.base_sha || github.event.pull_request.base.sha }}
57+
SOURCE_BRANCH_COMMIT: ${{ github.event.inputs.head_sha || github.event.pull_request.head.sha }}
4358
run: |
4459
if yarn --cwd tools/@aws-cdk/integration-test-deployment check-snapshots; then
4560
echo "has_snapshots=true" >> $GITHUB_OUTPUT
@@ -49,10 +64,10 @@ jobs:
4964
5065
- name: Save PR info
5166
env:
52-
PR_NUMBER: ${{ github.event.pull_request.number }}
53-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
54-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
55-
REVIEWER: ${{ github.event.review.user.login }}
67+
PR_NUMBER: ${{ github.event.inputs.pr_number || github.event.pull_request.number }}
68+
HEAD_SHA: ${{ github.event.inputs.head_sha || github.event.pull_request.head.sha }}
69+
BASE_SHA: ${{ github.event.inputs.base_sha || github.event.pull_request.base.sha }}
70+
REVIEWER: ${{ github.event.inputs.reviewer || github.event.review.user.login }}
5671
HAS_SNAPSHOTS: ${{ steps.check_snapshots.outputs.has_snapshots }}
5772
run: |
5873
mkdir -p ./pr
Lines changed: 25 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: Integration Test deployment (Auto)
22

3-
# Privileged workflow that runs integration tests when triggered by the
4-
# "Integration Test Auto Trigger" workflow. Uses workflow_run to run in the
5-
# base repo context with access to secrets, vars, and OIDC.
6-
#
7-
# SHADOW MODE: Failures don't block PR merges.
8-
# Once validated, this will replace the label-based workflow (integration-test-deployment.yml).
3+
# ⚠️ FORK TEST VERSION — DO NOT MERGE
4+
# Stubbed for testing the workflow_run artifact handoff on a fork.
5+
# Real version: see commit 49066b8463
96

107
on:
118
workflow_run:
@@ -44,103 +41,43 @@ jobs:
4441
echo "base_sha=$(cat pr/base_sha)" >> "$GITHUB_OUTPUT"
4542
echo "reviewer=$(cat pr/reviewer)" >> "$GITHUB_OUTPUT"
4643
echo "has_snapshots=$(cat pr/has_snapshots)" >> "$GITHUB_OUTPUT"
44+
echo "::notice::PR #$(cat pr/pr_number) | head=$(cat pr/head_sha) | base=$(cat pr/base_sha) | reviewer=$(cat pr/reviewer) | snapshots=$(cat pr/has_snapshots)"
4745
46+
# FORK TEST: Skip real team check, just validate the handoff worked
4847
validate-approver:
4948
needs: download-pr-info
5049
if: needs.download-pr-info.outputs.has_snapshots == 'true'
5150
runs-on: ubuntu-latest
5251
outputs:
5352
is_member: ${{ steps.check_team.outputs.is_member }}
5453
steps:
55-
- name: Check if approver is CDK team member
54+
- name: "FORK TEST: Stub team check"
5655
id: check_team
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }}
59-
APPROVER: ${{ needs.download-pr-info.outputs.reviewer }}
6056
run: |
61-
if gh api "orgs/aws/teams/aws-cdk-team/memberships/${APPROVER}" --jq '.state' 2>/dev/null | grep -q "active"; then
62-
echo "${APPROVER} is an active CDK team member"
63-
echo "is_member=true" >> $GITHUB_OUTPUT
64-
else
65-
echo "${APPROVER} is not a CDK team member or membership is not active"
66-
echo "is_member=false" >> $GITHUB_OUTPUT
67-
fi
57+
echo "::notice::FORK TEST — skipping real team check for reviewer: ${{ needs.download-pr-info.outputs.reviewer }}"
58+
echo "is_member=true" >> $GITHUB_OUTPUT
6859
60+
# FORK TEST: Replace deployment with a summary of what would run
6961
integration_test_deployment_auto:
7062
needs: [download-pr-info, validate-approver]
7163
if: needs.validate-approver.outputs.is_member == 'true'
72-
runs-on: codebuild-aws-cdk-github-actions-deployment-integ-runner-${{ github.run_id }}-${{ github.run_attempt }}
73-
# Shadow mode: workflow reports success even if tests fail
64+
runs-on: ubuntu-latest
7465
continue-on-error: true
7566
name: 'Deploy integration test snapshots (Auto)'
76-
77-
permissions:
78-
id-token: write # Required for OIDC authentication with AWS Atmosphere
79-
contents: read
80-
81-
env:
82-
PR_BUILD: true
83-
8467
steps:
85-
- name: Checkout HEAD
86-
uses: actions/checkout@v6
87-
with:
88-
ref: ${{ needs.download-pr-info.outputs.head_sha }}
89-
fetch-depth: 0
90-
91-
- name: Setup Node.js
92-
uses: actions/setup-node@v6
93-
with:
94-
node-version: "lts/*"
95-
cache: "yarn"
96-
cache-dependency-path: |
97-
yarn.lock
98-
99-
- name: Set up Docker
100-
uses: docker/setup-buildx-action@v4
101-
102-
- name: Load Docker images
103-
id: docker-cache
104-
uses: actions/cache/restore@v5
105-
with:
106-
path: |
107-
~/.docker-images.tar
108-
key: docker-cache-${{ runner.os }}
109-
110-
- name: Restore Docker images
111-
if: ${{ steps.docker-cache.outputs.cache-hit }}
112-
run: docker image load --input ~/.docker-images.tar
113-
114-
- name: Cache build artifacts
115-
uses: actions/cache@v5
116-
with:
117-
path: |
118-
~/.s3buildcache
119-
key: s3buildcache-${{ runner.os }}
120-
121-
- name: Configure system settings
68+
- name: "FORK TEST: Deployment stub"
12269
run: |
123-
(command -v sysctl || sudo apt-get update && sudo apt-get install -y procps) && \
124-
sudo sysctl -w vm.max_map_count=2251954
125-
126-
- name: Install dependencies for Integration Tests
127-
run: yarn install --frozen-lockfile
128-
129-
- name: Build deployment-integ
130-
run: yarn --cwd tools/@aws-cdk/integration-test-deployment build
131-
132-
- name: Build Integration Test packages
133-
run: npx lerna run build --scope="{@aws-cdk/*,@aws-cdk-testing/framework-integ}"
134-
135-
- name: Run integration tests
136-
run: yarn run atmosphere-integ-test
137-
env:
138-
CDK_ATMOSPHERE_ENDPOINT: ${{ vars.CDK_ATMOSPHERE_ENDPOINT }}
139-
CDK_ATMOSPHERE_POOL: ${{ vars.CDK_ATMOSPHERE_POOL }}
140-
CDK_ATMOSPHERE_OIDC_ROLE: ${{ vars.CDK_ATMOSPHERE_OIDC_ROLE }}
141-
CDK_ATMOSPHERE_BATCH_SIZE: ${{ vars.CDK_ATMOSPHERE_BATCH_SIZE }}
142-
TARGET_BRANCH_COMMIT: ${{ needs.download-pr-info.outputs.base_sha }}
143-
SOURCE_BRANCH_COMMIT: ${{ needs.download-pr-info.outputs.head_sha }}
144-
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }}
145-
GITHUB_REPOSITORY: ${{ github.repository }}
146-
PR_NUMBER: ${{ needs.download-pr-info.outputs.pr_number }}
70+
echo "========================================="
71+
echo " FORK TEST — Full chain validated! ✅"
72+
echo "========================================="
73+
echo ""
74+
echo "PR Number: ${{ needs.download-pr-info.outputs.pr_number }}"
75+
echo "Head SHA: ${{ needs.download-pr-info.outputs.head_sha }}"
76+
echo "Base SHA: ${{ needs.download-pr-info.outputs.base_sha }}"
77+
echo "Reviewer: ${{ needs.download-pr-info.outputs.reviewer }}"
78+
echo "Snapshots: ${{ needs.download-pr-info.outputs.has_snapshots }}"
79+
echo ""
80+
echo "In production, this job would:"
81+
echo " 1. Run on codebuild runner"
82+
echo " 2. Authenticate via OIDC to AWS Atmosphere"
83+
echo " 3. Build and deploy integration tests"

0 commit comments

Comments
 (0)