-
Notifications
You must be signed in to change notification settings - Fork 263
436 lines (396 loc) · 18.6 KB
/
Copy pathPR-test.yml
File metadata and controls
436 lines (396 loc) · 18.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT
name: PR Test
permissions:
id-token: write
contents: read
env:
TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours
CWA_GITHUB_TEST_REPO_NAME: "aws/amazon-cloudwatch-agent-test"
CWA_GITHUB_TEST_REPO_URL: "https://github.com/aws/amazon-cloudwatch-agent-test.git"
CWA_GITHUB_TEST_REPO_BRANCH: "main"
KEY_NAME: ${{ secrets.KEY_NAME }}
PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }}
S3_INTEGRATION_BUCKET: ${{ vars.S3_INTEGRATION_BUCKET }}
on:
workflow_dispatch:
pull_request:
branches:
- main*
- feature*
- feature/**
types:
- opened
- synchronize
- reopened
- ready_for_review
- labeled
- unlabeled
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
CheckLabel:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.has_label }}
steps:
- id: check
env:
PR_FORK: ${{ github.event.pull_request.head.repo.fork }}
HAS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'ready for testing') }}
run: |
# Fork PRs never receive secrets or id-token permissions, so the
# integration tests cannot run even if the label is added. Maintainers
# must push the branch to this repo to run them.
if [[ "$PR_FORK" == "true" ]]; then
echo "Fork PR - integration tests cannot run (no access to secrets)."
echo "has_label=false" >> $GITHUB_OUTPUT
elif [[ "$HAS_LABEL" == "true" ]]; then
echo "has_label=true" >> $GITHUB_OUTPUT
else
echo "has_label=false" >> $GITHUB_OUTPUT
fi
BuildAndUpload:
needs: [ CheckLabel ]
if: needs.CheckLabel.outputs.should_run == 'true'
uses: ./.github/workflows/test-build.yml
secrets: inherit
permissions:
id-token: write
contents: read
with:
BucketKey: "integration-test/binary/${{ github.sha }}"
PackageBucketKey: "integration-test/packaging/${{ github.sha }}"
TerraformAWSAssumeRole: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
Bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
OutputEnvVariables:
name: 'OutputEnvVariables'
needs: [ CheckLabel ]
if: needs.CheckLabel.outputs.should_run == 'true'
runs-on: ubuntu-latest
outputs:
CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}
CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}
CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
steps:
- name: SetOutputs
id: set-outputs
run: |
CWA_GITHUB_TEST_REPO_BRANCH=${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}
echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT"
echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT"
echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}}" >> "$GITHUB_OUTPUT"
- name: Echo test variables
env:
GITHUB_SHA_VAL: ${{ github.sha }}
OUT_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}
OUT_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}
OUT_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
run: |
echo "build_id: $GITHUB_SHA_VAL"
echo "CWA_GITHUB_TEST_REPO_NAME: $OUT_REPO_NAME"
echo "CWA_GITHUB_TEST_REPO_URL: $OUT_REPO_URL"
echo "CWA_GITHUB_TEST_REPO_BRANCH: $OUT_REPO_BRANCH"
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
repository: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}
ref: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
- name: Set up Go 1.x
uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4.3.0
with:
go-version: ~1.26.4
StartLocalStack:
name: 'StartLocalStack'
needs: [ CheckLabel, OutputEnvVariables ]
if: needs.CheckLabel.outputs.should_run == 'true'
uses: ./.github/workflows/start-localstack.yml
secrets: inherit
permissions:
id-token: write
contents: read
with:
region: us-west-2
test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }}
github_sha: ${{ github.sha }}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
GenerateTestMatrix:
name: 'GenerateTestMatrix'
needs: [ CheckLabel, OutputEnvVariables ]
if: needs.CheckLabel.outputs.should_run == 'true'
runs-on: ubuntu-latest
outputs:
ec2_linux_matrix_0: ${{ steps.paginate-matrix.outputs.ec2_linux_matrix_0 }}
ec2_linux_matrix_1: ${{ steps.paginate-matrix.outputs.ec2_linux_matrix_1 }}
ec2_linux_matrix_2: ${{ steps.paginate-matrix.outputs.ec2_linux_matrix_2 }}
ec2_linux_matrix_3: ${{ steps.paginate-matrix.outputs.ec2_linux_matrix_3 }}
ec2_linux_matrix_4: ${{ steps.paginate-matrix.outputs.ec2_linux_matrix_4 }}
ec2_linux_matrix_page_count: ${{ steps.paginate-matrix.outputs.ec2_linux_matrix_page_count }}
ec2_selinux_matrix: ${{ steps.set-matrix.outputs.ec2_selinux_matrix }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}}
ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}}
- name: Set up Go 1.x
uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4.3.0
with:
go-version: ~1.26.4
- name: Install jq
run: sudo apt-get install -y jq
- name: Generate matrix
id: set-matrix
run: |
go run --tags=generator generator/test_case_generator.go
# Convert the output to valid JSON and filter out metric_value_benchmark tests
jq -c '[.[] | select(.test_dir != "./test/metric_value_benchmark")]' generator/resources/ec2_linux_complete_test_matrix.json > filtered_matrix.json
# Escape the JSON for GitHub Actions
MATRIX=$(jq -c -r '@json' filtered_matrix.json)
echo "ec2_linux_matrix=$MATRIX" >> $GITHUB_OUTPUT
jq -c '[.[] | select(.test_dir != "./test/metric_value_benchmark")]' generator/resources/ec2_selinux_complete_test_matrix.json > filtered_matrix_selinux.json
# Escape the JSON for GitHub Actions
MATRIX=$(jq -c -r '@json' filtered_matrix_selinux.json)
echo "ec2_selinux_matrix=$MATRIX" >> $GITHUB_OUTPUT
- name: Paginate ec2_linux_matrix
id: paginate-matrix
run: |
# GitHub Actions matrix limit is 256 jobs per workflow run.
# Use 200 per page for headroom. Up to 5 pages supported (1000 tests).
# Read the filtered matrix from the file written by the "Generate matrix"
# step instead of a step-level env var: the matrix can exceed the
# kernel's ARG_MAX (~2 MiB) on execve, which would prevent bash from
# starting for this step.
PAGE_SIZE=200
FULL_MATRIX=$(cat filtered_matrix.json)
TOTAL=$(echo "$FULL_MATRIX" | jq 'length')
PAGE_COUNT=$(( (TOTAL + PAGE_SIZE - 1) / PAGE_SIZE ))
if [ "$PAGE_COUNT" -gt 5 ]; then
echo "::error::ec2_linux_matrix has $TOTAL entries requiring $PAGE_COUNT pages, but only 5 are supported. Add more static page slots."
exit 1
fi
echo "ec2_linux total=$TOTAL pages=$PAGE_COUNT"
echo "ec2_linux_matrix_page_count=${PAGE_COUNT}" >> "$GITHUB_OUTPUT"
for (( i=0; i<PAGE_COUNT; i++ )); do
START=$(( i * PAGE_SIZE ))
PAGE=$(echo "$FULL_MATRIX" | jq -c ".[$START:$START+$PAGE_SIZE]" | jq -c -r '@json')
echo "ec2_linux_matrix_${i}=${PAGE}" >> "$GITHUB_OUTPUT"
done
- name: Echo test plan matrix
env:
EC2_LINUX_PAGE_COUNT: ${{ steps.paginate-matrix.outputs.ec2_linux_matrix_page_count }}
EC2_SELINUX_MATRIX: ${{ steps.set-matrix.outputs.ec2_selinux_matrix }}
run: |
echo "ec2_linux_matrix pages: $EC2_LINUX_PAGE_COUNT"
echo "ec2_selinux_matrix: $EC2_SELINUX_MATRIX"
EC2LinuxIntegrationTest-0:
name: 'EC2LinuxTests-0'
needs: [ CheckLabel, GenerateTestMatrix, OutputEnvVariables, StartLocalStack, BuildAndUpload ]
if: needs.CheckLabel.outputs.should_run == 'true'
uses: ./.github/workflows/ec2-integration-test.yml
permissions:
id-token: write
contents: read
with:
build_id: ${{ github.sha }}
test_dir: terraform/ec2/linux
job_id: ec2-linux-integration-test-0
test_props: ${{ needs.GenerateTestMatrix.outputs.ec2_linux_matrix_0 }}
test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }}
test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
localstack_host: ${{ needs.StartLocalStack.outputs.local_stack_host_name }}
region: us-west-2
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
is_selinux_test: false
secrets: inherit
EC2LinuxIntegrationTest-1:
name: 'EC2LinuxTests-1'
needs: [ CheckLabel, GenerateTestMatrix, OutputEnvVariables, StartLocalStack, BuildAndUpload ]
if: ${{ needs.CheckLabel.outputs.should_run == 'true' && needs.GenerateTestMatrix.outputs.ec2_linux_matrix_page_count > 1 }}
uses: ./.github/workflows/ec2-integration-test.yml
permissions:
id-token: write
contents: read
with:
build_id: ${{ github.sha }}
test_dir: terraform/ec2/linux
job_id: ec2-linux-integration-test-1
test_props: ${{ needs.GenerateTestMatrix.outputs.ec2_linux_matrix_1 }}
test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }}
test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
localstack_host: ${{ needs.StartLocalStack.outputs.local_stack_host_name }}
region: us-west-2
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
is_selinux_test: false
secrets: inherit
EC2LinuxIntegrationTest-2:
name: 'EC2LinuxTests-2'
needs: [ CheckLabel, GenerateTestMatrix, OutputEnvVariables, StartLocalStack, BuildAndUpload ]
if: ${{ needs.CheckLabel.outputs.should_run == 'true' && needs.GenerateTestMatrix.outputs.ec2_linux_matrix_page_count > 2 }}
uses: ./.github/workflows/ec2-integration-test.yml
permissions:
id-token: write
contents: read
with:
build_id: ${{ github.sha }}
test_dir: terraform/ec2/linux
job_id: ec2-linux-integration-test-2
test_props: ${{ needs.GenerateTestMatrix.outputs.ec2_linux_matrix_2 }}
test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }}
test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
localstack_host: ${{ needs.StartLocalStack.outputs.local_stack_host_name }}
region: us-west-2
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
is_selinux_test: false
secrets: inherit
EC2LinuxIntegrationTest-3:
name: 'EC2LinuxTests-3'
needs: [ CheckLabel, GenerateTestMatrix, OutputEnvVariables, StartLocalStack, BuildAndUpload ]
if: ${{ needs.CheckLabel.outputs.should_run == 'true' && needs.GenerateTestMatrix.outputs.ec2_linux_matrix_page_count > 3 }}
uses: ./.github/workflows/ec2-integration-test.yml
permissions:
id-token: write
contents: read
with:
build_id: ${{ github.sha }}
test_dir: terraform/ec2/linux
job_id: ec2-linux-integration-test-3
test_props: ${{ needs.GenerateTestMatrix.outputs.ec2_linux_matrix_3 }}
test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }}
test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
localstack_host: ${{ needs.StartLocalStack.outputs.local_stack_host_name }}
region: us-west-2
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
is_selinux_test: false
secrets: inherit
EC2LinuxIntegrationTest-4:
name: 'EC2LinuxTests-4'
needs: [ CheckLabel, GenerateTestMatrix, OutputEnvVariables, StartLocalStack, BuildAndUpload ]
if: ${{ needs.CheckLabel.outputs.should_run == 'true' && needs.GenerateTestMatrix.outputs.ec2_linux_matrix_page_count > 4 }}
uses: ./.github/workflows/ec2-integration-test.yml
permissions:
id-token: write
contents: read
with:
build_id: ${{ github.sha }}
test_dir: terraform/ec2/linux
job_id: ec2-linux-integration-test-4
test_props: ${{ needs.GenerateTestMatrix.outputs.ec2_linux_matrix_4 }}
test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }}
test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
localstack_host: ${{ needs.StartLocalStack.outputs.local_stack_host_name }}
region: us-west-2
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
is_selinux_test: false
secrets: inherit
EC2SELinuxIntegrationTest:
name: 'EC2SELinuxTests'
needs: [ CheckLabel, GenerateTestMatrix, OutputEnvVariables, StartLocalStack, BuildAndUpload ]
if: needs.CheckLabel.outputs.should_run == 'true'
uses: ./.github/workflows/ec2-integration-test.yml
permissions:
id-token: write
contents: read
with:
build_id: ${{ github.sha }}
test_dir: terraform/ec2/linux
job_id: ec2-linux-integration-test
test_props: ${{ needs.GenerateTestMatrix.outputs.ec2_selinux_matrix }}
test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }}
test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
localstack_host: ${{ needs.StartLocalStack.outputs.local_stack_host_name }}
region: us-west-2
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
is_selinux_test: true
secrets: inherit
StopLocalStack:
name: 'StopLocalStack'
needs: [ CheckLabel, StartLocalStack, EC2LinuxIntegrationTest-0, EC2LinuxIntegrationTest-1, EC2LinuxIntegrationTest-2, EC2LinuxIntegrationTest-3, EC2LinuxIntegrationTest-4, OutputEnvVariables ]
if: ${{ always() && needs.StartLocalStack.result == 'success' && needs.CheckLabel.outputs.should_run == 'true'}}
uses: ./.github/workflows/stop-localstack.yml
secrets: inherit
permissions:
id-token: write
contents: read
with:
region: us-west-2
test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
github_sha: ${{ github.sha }}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
IntegrationTestGate:
name: Check ready for testing label
runs-on: ubuntu-latest
steps:
- name: Check for ready for testing label
env:
PR_FORK: ${{ github.event.pull_request.head.repo.fork }}
PR_DRAFT: ${{ github.event.pull_request.draft }}
HAS_SKIP_TESTING: ${{ contains(github.event.pull_request.labels.*.name, 'skip testing') }}
HAS_READY_FOR_TESTING: ${{ contains(github.event.pull_request.labels.*.name, 'ready for testing') }}
run: |
if [[ "$PR_FORK" == "true" ]]; then
echo "Fork PR - integration tests skipped (no access to secrets). Push branch to this repo to run them."
exit 0
fi
if [[ "$PR_DRAFT" == "true" ]]; then
echo "Draft PR - skipping label check."
exit 0
fi
if [[ "$HAS_SKIP_TESTING" == "true" ]]; then
echo "'skip testing' label found - bypassing integration test requirement."
exit 0
fi
if [[ "$HAS_READY_FOR_TESTING" != "true" ]]; then
echo "Missing 'ready for testing' label. Please add before merging."
exit 1
fi
echo "'ready for testing' label found!"
verify-all:
name: Verify All PR Test Jobs
needs: [IntegrationTestGate, CheckLabel, BuildAndUpload, OutputEnvVariables, StartLocalStack,
GenerateTestMatrix, EC2LinuxIntegrationTest-0, EC2LinuxIntegrationTest-1,
EC2LinuxIntegrationTest-2, EC2LinuxIntegrationTest-3, EC2LinuxIntegrationTest-4,
EC2SELinuxIntegrationTest, StopLocalStack]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check Job Status
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
failed_jobs=()
successful_jobs=()
# Loop through all jobs in needs context
for job in $(echo "$NEEDS_JSON" | jq -r 'keys[]'); do
result=$(echo "$NEEDS_JSON" | jq -r ".[\"$job\"].result")
if [[ "$result" == "failure" ]]; then
failed_jobs+=("$job")
elif [[ "$result" == "success" ]]; then
successful_jobs+=("$job")
fi
done
echo "Successfully validated jobs:"
printf '%s\n' "${successful_jobs[@]}"
if [ ${#failed_jobs[@]} -ne 0 ]; then
echo -e "\nFailed jobs:"
printf '%s\n' "${failed_jobs[@]}"
exit 1
fi
echo -e "\nAll required jobs completed without failures!"