Skip to content

Commit 72a4d58

Browse files
committed
refactor(ci): align kinesis E2E infra with repo patterns
- Revert unrelated whitespace changes to infra/lib/stack.ts and infra/lib/github/github.ts - Replace manual pubspec_overrides.yaml with aft bootstrap - Update workflow to match repo conventions (action versions, submodule init, log_cw_metric_wrapper, timeout, defaults) - Remove IAM user, access key, and Secrets Manager secret from backend.ts (credentials managed outside stack)
1 parent d5ce6c8 commit 72a4d58

4 files changed

Lines changed: 109 additions & 128 deletions

File tree

.github/workflows/kinesis_e2e.yaml

Lines changed: 98 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,64 @@
11
name: Kinesis E2E Tests
22
on:
3+
push:
4+
branches:
5+
- main
6+
- stable
7+
paths:
8+
- "packages/kinesis/**"
9+
- ".github/workflows/kinesis_e2e.yaml"
310
pull_request:
411
paths:
512
- "packages/kinesis/**"
613
- ".github/workflows/kinesis_e2e.yaml"
714
workflow_dispatch:
815

16+
defaults:
17+
run:
18+
shell: bash
19+
20+
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
21+
permissions:
22+
id-token: write
23+
contents: read
24+
925
concurrency:
1026
group: ${{ github.workflow }}-${{ github.ref }}
1127
cancel-in-progress: true
1228

1329
jobs:
1430
kinesis-data-streams-e2e:
1531
runs-on: ubuntu-latest
16-
permissions:
17-
id-token: write
18-
contents: read
32+
timeout-minutes: 30
1933
steps:
20-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # 4.0.0
34+
- name: Git Checkout
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
36+
37+
- name: Git Submodules
38+
run: git submodule update --init
39+
40+
- name: Setup Flutter
41+
uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # 2.21.0
2142
with:
22-
persist-credentials: false
43+
cache: true
44+
channel: stable
2345

24-
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 # v1
46+
- name: Setup Dart
47+
uses: dart-lang/setup-dart@03a180dbe1de8ea7fb700663cbb7d24ca4bbe82c # main
2548
with:
2649
sdk: stable
2750

51+
- name: Install native sqlite3
52+
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
53+
54+
- name: Setup aft
55+
run: dart pub global activate -spath packages/aft
56+
57+
- name: Bootstrap
58+
id: bootstrap
59+
timeout-minutes: 20
60+
run: aft bootstrap --fail-fast --include=aws_kinesis_datastreams --verbose
61+
2862
- name: Configure AWS credentials
2963
uses: aws-actions/configure-aws-credentials@04b98b3f9e85f563fb061be8751a0352327246b0 # 3.0.1
3064
with:
@@ -38,38 +72,6 @@ jobs:
3872
KINESIS_E2E,${{ secrets.KINESIS_E2E_SECRET_ARN }}
3973
parse-json-secrets: true
4074

41-
- name: Install native sqlite3
42-
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
43-
44-
- name: Create pubspec overrides
45-
working-directory: packages/kinesis/aws_kinesis_datastreams
46-
run: |
47-
cat > pubspec_overrides.yaml << 'EOF'
48-
dependency_overrides:
49-
amplify_core:
50-
path: ../../amplify_core
51-
amplify_db_common_dart:
52-
path: ../../common/amplify_db_common_dart
53-
amplify_foundation_dart:
54-
path: ../../amplify_foundation/amplify_foundation_dart
55-
amplify_foundation_dart_bridge:
56-
path: ../../amplify_foundation/amplify_foundation_dart_bridge
57-
amplify_lints:
58-
path: ../../amplify_lints
59-
aws_common:
60-
path: ../../aws_common
61-
aws_signature_v4:
62-
path: ../../aws_signature_v4
63-
smithy:
64-
path: ../../smithy/smithy
65-
smithy_aws:
66-
path: ../../smithy/smithy_aws
67-
EOF
68-
69-
- name: Install dependencies
70-
run: dart pub get
71-
working-directory: packages/kinesis/aws_kinesis_datastreams
72-
7375
- name: Run E2E tests
7476
working-directory: packages/kinesis/aws_kinesis_datastreams
7577
env:
@@ -79,20 +81,55 @@ jobs:
7981
TEST_STREAM_NAME: ${{ env.KINESIS_E2E_STREAM_NAME }}
8082
run: dart test test/e2e/ --tags=e2e
8183

84+
- name: Log success/failure
85+
if: always()
86+
uses: ./.github/composite_actions/log_cw_metric_wrapper
87+
with:
88+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
89+
aws-region: ${{ secrets.AWS_REGION }}
90+
91+
job-status: ${{ job.status }}
92+
github-token: ${{ secrets.GITHUB_TOKEN }}
93+
94+
test-type: e2e
95+
working-directory: packages/kinesis/aws_kinesis_datastreams
96+
97+
framework: dart
98+
flutter-dart-channel: stable
99+
dart-compiler: vm
100+
82101
firehose-e2e:
83102
runs-on: ubuntu-latest
84-
permissions:
85-
id-token: write
86-
contents: read
103+
timeout-minutes: 30
87104
steps:
88-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # 4.0.0
105+
- name: Git Checkout
106+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
107+
108+
- name: Git Submodules
109+
run: git submodule update --init
110+
111+
- name: Setup Flutter
112+
uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # 2.21.0
89113
with:
90-
persist-credentials: false
114+
cache: true
115+
channel: stable
91116

92-
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 # v1
117+
- name: Setup Dart
118+
uses: dart-lang/setup-dart@03a180dbe1de8ea7fb700663cbb7d24ca4bbe82c # main
93119
with:
94120
sdk: stable
95121

122+
- name: Install native sqlite3
123+
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
124+
125+
- name: Setup aft
126+
run: dart pub global activate -spath packages/aft
127+
128+
- name: Bootstrap
129+
id: bootstrap
130+
timeout-minutes: 20
131+
run: aft bootstrap --fail-fast --include=aws_amazon_firehose --verbose
132+
96133
- name: Configure AWS credentials
97134
uses: aws-actions/configure-aws-credentials@04b98b3f9e85f563fb061be8751a0352327246b0 # 3.0.1
98135
with:
@@ -106,34 +143,6 @@ jobs:
106143
KINESIS_E2E,${{ secrets.KINESIS_E2E_SECRET_ARN }}
107144
parse-json-secrets: true
108145

109-
- name: Install native sqlite3
110-
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
111-
112-
- name: Create pubspec overrides
113-
working-directory: packages/kinesis/aws_amazon_firehose
114-
run: |
115-
cat > pubspec_overrides.yaml << 'EOF'
116-
dependency_overrides:
117-
amplify_core:
118-
path: ../../amplify_core
119-
amplify_foundation_dart:
120-
path: ../../amplify_foundation/amplify_foundation_dart
121-
amplify_foundation_dart_bridge:
122-
path: ../../amplify_foundation/amplify_foundation_dart_bridge
123-
aws_common:
124-
path: ../../aws_common
125-
aws_signature_v4:
126-
path: ../../aws_signature_v4
127-
smithy:
128-
path: ../../smithy/smithy
129-
smithy_aws:
130-
path: ../../smithy/smithy_aws
131-
EOF
132-
133-
- name: Install dependencies
134-
run: dart pub get
135-
working-directory: packages/kinesis/aws_amazon_firehose
136-
137146
- name: Run E2E tests
138147
working-directory: packages/kinesis/aws_amazon_firehose
139148
env:
@@ -142,3 +151,20 @@ jobs:
142151
TEST_REGION: ${{ secrets.AWS_REGION }}
143152
TEST_DELIVERY_STREAM_NAME: ${{ env.KINESIS_E2E_DELIVERY_STREAM_NAME }}
144153
run: dart test test/e2e/ --tags=e2e
154+
155+
- name: Log success/failure
156+
if: always()
157+
uses: ./.github/composite_actions/log_cw_metric_wrapper
158+
with:
159+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
160+
aws-region: ${{ secrets.AWS_REGION }}
161+
162+
job-status: ${{ job.status }}
163+
github-token: ${{ secrets.GITHUB_TOKEN }}
164+
165+
test-type: e2e
166+
working-directory: packages/kinesis/aws_amazon_firehose
167+
168+
framework: dart
169+
flutter-dart-channel: stable
170+
dart-compiler: vm

infra-gen2/backends/kinesis/main/amplify/backend.ts

Lines changed: 8 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,23 @@ import * as iam from "aws-cdk-lib/aws-iam";
77
import * as kinesis from "aws-cdk-lib/aws-kinesis";
88
import * as firehose from "aws-cdk-lib/aws-kinesisfirehose";
99
import * as s3 from "aws-cdk-lib/aws-s3";
10-
import * as secretsmanager from "aws-cdk-lib/aws-secretsmanager";
1110

1211
/**
1312
* Kinesis E2E test backend.
1413
*
15-
* No Amplify categories (auth, storage, etc.) are needed — we only use the
16-
* Amplify backend as an entry-point into CDK to provision Kinesis Data
17-
* Streams and Amazon Data Firehose resources for E2E testing.
14+
* Provisions Kinesis Data Streams and Amazon Data Firehose resources
15+
* for E2E testing. No Amplify categories are needed — the Amplify
16+
* backend is used only as a CDK entry-point.
17+
*
18+
* Test credentials and resource names are stored in a dedicated
19+
* Secrets Manager secret managed outside this stack.
1820
*/
1921
const backend = defineBackend({});
2022

2123
const kinesisStack = backend.createStack("KinesisTestResources");
2224

2325
// --- Kinesis Data Stream ---
24-
const stream = new kinesis.Stream(kinesisStack, "TestStream", {
26+
new kinesis.Stream(kinesisStack, "TestStream", {
2527
streamName: "kinesis-e2e-data-stream",
2628
shardCount: 1,
2729
retentionPeriod: cdk.Duration.hours(24),
@@ -42,7 +44,7 @@ const firehoseRole = new iam.Role(kinesisStack, "FirehoseS3Role", {
4244
bucket.grantReadWrite(firehoseRole);
4345

4446
// --- Firehose delivery stream ---
45-
const deliveryStream = new firehose.CfnDeliveryStream(
47+
new firehose.CfnDeliveryStream(
4648
kinesisStack,
4749
"TestDeliveryStream",
4850
{
@@ -58,50 +60,3 @@ const deliveryStream = new firehose.CfnDeliveryStream(
5860
},
5961
},
6062
);
61-
62-
// --- IAM user for E2E tests ---
63-
const testUser = new iam.User(kinesisStack, "TestUser", {
64-
userName: "kinesis-e2e-test-user",
65-
});
66-
67-
testUser.addToPolicy(
68-
new iam.PolicyStatement({
69-
effect: iam.Effect.ALLOW,
70-
actions: [
71-
"kinesis:PutRecords",
72-
"kinesis:DescribeStream",
73-
"kinesis:ListShards",
74-
],
75-
resources: [stream.streamArn],
76-
}),
77-
);
78-
79-
testUser.addToPolicy(
80-
new iam.PolicyStatement({
81-
effect: iam.Effect.ALLOW,
82-
actions: [
83-
"firehose:PutRecordBatch",
84-
"firehose:DescribeDeliveryStream",
85-
],
86-
resources: [deliveryStream.attrArn],
87-
}),
88-
);
89-
90-
const accessKey = new iam.AccessKey(kinesisStack, "TestAccessKey", {
91-
user: testUser,
92-
});
93-
94-
// Store all E2E config in a single Secrets Manager secret.
95-
// Keys are prefixed with KINESIS_E2E_ after parse-json-secrets expansion in CI.
96-
new secretsmanager.Secret(kinesisStack, "KinesisE2ESecret", {
97-
secretName: "kinesis-e2e",
98-
description: "Kinesis E2E test credentials and resource names",
99-
secretObjectValue: {
100-
ACCESS_KEY_ID: cdk.SecretValue.unsafePlainText(accessKey.accessKeyId),
101-
SECRET_ACCESS_KEY: accessKey.secretAccessKey,
102-
STREAM_NAME: cdk.SecretValue.unsafePlainText(stream.streamName),
103-
DELIVERY_STREAM_NAME: cdk.SecretValue.unsafePlainText(
104-
deliveryStream.deliveryStreamName!,
105-
),
106-
},
107-
});

infra/lib/github/github.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class GitHubStack extends Stack {
3232
constructor(scope: Construct, id: string, props: GitHubStackProps) {
3333
super(scope, id, props);
3434

35+
// const { analytics, auth, storage } = props;
3536
const { auth } = props;
3637

3738
const afsSecrets = new secrets.Secret(this, "AfsSecrets", {

infra/lib/stack.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import * as cdk from "aws-cdk-lib";
55
import * as cognito from "aws-cdk-lib/aws-cognito";
66
import { Construct } from "constructs";
77
import {
8-
AuthIntegrationTestStack,
9-
AuthIntegrationTestStackEnvironmentProps,
8+
AuthIntegrationTestStack,
9+
AuthIntegrationTestStackEnvironmentProps,
1010
} from "./auth/stack";
1111
import { env } from "./common";
1212
import { GitHubStack } from "./github/github";
@@ -284,7 +284,6 @@ export class AmplifyFlutterIntegStack extends cdk.Stack {
284284
}
285285
);
286286

287-
288287
new cdk.CfnOutput(this, "Categories", {
289288
value: JSON.stringify({
290289
auth: {

0 commit comments

Comments
 (0)