1
+ # This workflow will build and the traffic generator image to each region whenever there is an update made to the traffic-generator folder.
2
+ # This image will be used by EKS and K8s test to call sample app endpoints
3
+ name : Create and Push Traffic Generator Image
4
+
5
+ on :
6
+ workflow_dispatch :
7
+ push :
8
+ branches :
9
+ - main
10
+ paths :
11
+ - ' traffic-generator/**'
12
+
13
+ permissions :
14
+ id-token : write
15
+ contents : read
16
+
17
+ env :
18
+ E2E_TEST_ACCOUNT_ID : ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}
19
+ E2E_TEST_ROLE_NAME : ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }}
20
+
21
+ jobs :
22
+ build-and-push-image :
23
+ runs-on : ubuntu-latest
24
+ strategy :
25
+ matrix :
26
+ aws-region : ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1',
27
+ ' ap-southeast-2' ,'ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1',
28
+ ' eu-south-1' ,'eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1',
29
+ ' us-east-1' ,'us-east-2', 'us-west-1', 'us-west-2']
30
+ steps :
31
+ - name : Checkout repository
32
+ uses : actions/checkout@v4
33
+
34
+ - name : Configure AWS Credentials
35
+ uses : aws-actions/configure-aws-credentials@v4
36
+ with :
37
+ role-to-assume : arn:aws:iam::${{ env.E2E_TEST_ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
38
+ aws-region : us-east-1
39
+
40
+ - name : Retrieve account
41
+ uses : aws-actions/aws-secretsmanager-get-secrets@v1
42
+ with :
43
+ secret-ids : |
44
+ ACCOUNT_ID, region-account/${{ matrix.aws-region }}
45
+
46
+ - name : Configure AWS Credentials
47
+ uses : aws-actions/configure-aws-credentials@v4
48
+ with :
49
+ role-to-assume : arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
50
+ aws-region : ${{ matrix.aws-region }}
51
+
52
+ - name : Login to Amazon ECR
53
+ id : login-ecr
54
+ uses : aws-actions/amazon-ecr-login@v2
55
+
56
+ - name : Build, tag, and push image to Amazon ECR
57
+ working-directory : traffic-generator
58
+ env :
59
+ REGISTRY : ${{ steps.login-ecr.outputs.registry }}
60
+ REPOSITORY : e2e-test-resource
61
+ IMAGE_TAG : traffic-generator
62
+ run : |
63
+ docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
64
+ docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
65
+
66
+ upload-files :
67
+ runs-on : ubuntu-latest
68
+ strategy :
69
+ matrix :
70
+ aws-region : ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1',
71
+ ' ap-southeast-2' ,'ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1',
72
+ ' eu-south-1' ,'eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1',
73
+ ' us-east-1' ,'us-east-2', 'us-west-1', 'us-west-2']
74
+ steps :
75
+ - name : Checkout repository
76
+ uses : actions/checkout@v4
77
+
78
+ - name : Configure AWS Credentials
79
+ uses : aws-actions/configure-aws-credentials@v4
80
+ with :
81
+ role-to-assume : arn:aws:iam::${{ env.E2E_TEST_ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
82
+ aws-region : us-east-1
83
+
84
+ - name : Retrieve account
85
+ uses : aws-actions/aws-secretsmanager-get-secrets@v1
86
+ with :
87
+ secret-ids : |
88
+ ACCOUNT_ID, region-account/${{ matrix.aws-region }}
89
+
90
+ - name : Configure AWS Credentials
91
+ uses : aws-actions/configure-aws-credentials@v4
92
+ with :
93
+ role-to-assume : arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
94
+ aws-region : ${{ matrix.aws-region }}
95
+
96
+ - name : Upload traffic generator files
97
+ working-directory : traffic-generator
98
+ run : |
99
+ zip traffic-generator.zip ./index.js ./package.json
100
+ aws s3 cp traffic-generator.zip s3://aws-appsignals-sample-app-prod-${{ matrix.aws-region }}/traffic-generator.zip
0 commit comments