File tree 3 files changed +66
-1
lines changed
3 files changed +66
-1
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ source ./../../.gitlab/download-circleci_artifact.sh
5
+
6
+ PROJECT_SLUG=" gh/DataDog/dd-trace-php"
7
+ WORKFLOW_NAME=" build"
8
+ ARTIFACT_NAME=" tested_versions.json"
9
+ ARTIFACT_PATTERN=" tested_versions.json"
10
+ OUTPUT_FILE=" aggregated_tested_versions.json"
11
+
12
+ RUNTIMES=(" 7.0" " 7.1" " 7.2" " 7.3" " 7.4" " 8.0" " 8.1" " 8.2" " 8.3" )
13
+ JOB_NAMES=()
14
+ for RUNTIME in " ${RUNTIMES[@]} " ; do
15
+ JOB_NAMES+=(" integration-snapshots-test_integrations-${RUNTIME} " )
16
+ JOB_NAMES+=(" integration-snapshots-test_web-${RUNTIME} " )
17
+ done
18
+
19
+ TEMP_DIR=$( mktemp -d)
20
+ cleanup () {
21
+ rm -rf " ${TEMP_DIR} "
22
+ }
23
+ trap cleanup EXIT
24
+
25
+ for JOB_NAME in " ${JOB_NAMES[@]} " ; do
26
+ echo " Processing job: ${JOB_NAME} "
27
+ download_circleci_artifact " ${PROJECT_SLUG} " " ${WORKFLOW_NAME} " " ${JOB_NAME} " " ${ARTIFACT_PATTERN} " " ${TEMP_DIR} /${JOB_NAME} .json" 0
28
+ done
29
+
30
+ echo " Aggregating JSON files..."
31
+ jq -s ' reduce .[] as $item ({};
32
+ reduce (keys_unsorted | .[]) as $key ($item;
33
+ $item[$key] += ($item[$key] // [] | unique)
34
+ )
35
+ )' " ${TEMP_DIR} " /* .json > " ${OUTPUT_FILE} "
36
+
37
+ echo " Aggregation complete. Output written to ${OUTPUT_FILE} "
Original file line number Diff line number Diff line change
1
+ name : Aggregate Tested Versions
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - " **" # For test purposes, always run the workflow
7
+ # - master # TODO: Uncomment this line to run the workflow only on master
8
+ workflow_dispatch :
9
+
10
+ jobs :
11
+ aggregate_tested_versions :
12
+ name : Aggregate Tested Versions
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - name : Checkout code
17
+ uses : actions/checkout@v4
18
+
19
+ # Let time for the CircleCI jobs to finish
20
+ - name : Wait for 5 minutes
21
+ run : sleep 300
22
+
23
+ - name : Run aggregation script
24
+ run : ./.github/scripts/aggregate_tested_versions.sh
25
+
26
+ - name : Show aggregated versions
27
+ run : cat ./.github/scripts/aggregated_versions.json
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ download_circleci_artifact() {
23
23
JOB_NAME=$3 # "Compile Loader Linux x86_64"
24
24
ARTIFACT_PATTERN=$4 # "loader/modules/dd_library_loader.so"
25
25
ARTIFACT_NAME=$5 # "dd_library_loader-x86_64-linux-gnu.so"
26
+ REQUIRE_SUCCESS=${6:- 1} # Whether job status must be successful (default: 1)
26
27
27
28
# Circle CI workflow is not triggered by tags,
28
29
# So we fallback to the release branch (eg. "ddtrace-1.3.0")
@@ -56,7 +57,7 @@ download_circleci_artifact() {
56
57
continue
57
58
fi
58
59
59
- if [[ " ${JOB_STATUS} " != " success" ]]; then
60
+ if ${REQUIRE_SUCCESS} && [[ " ${JOB_STATUS} " != " success" ]]; then
60
61
printf " CircleCI job is not successful:\n ${JOB} \n"
61
62
exit 1
62
63
fi
You can’t perform that action at this time.
0 commit comments