File tree Expand file tree Collapse file tree 3 files changed +68
-1
lines changed Expand file tree Collapse file tree 3 files changed +68
-1
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ ls -l
5+
6+ source ./.gitlab/download-circleci_artifact.sh
7+
8+ PROJECT_SLUG=" gh/DataDog/dd-trace-php"
9+ WORKFLOW_NAME=" build"
10+ ARTIFACT_NAME=" tested_versions.json"
11+ ARTIFACT_PATTERN=" tested_versions.json"
12+ OUTPUT_FILE=" aggregated_tested_versions.json"
13+
14+ RUNTIMES=(" 7.0" " 7.1" " 7.2" " 7.3" " 7.4" " 8.0" " 8.1" " 8.2" " 8.3" )
15+ JOB_NAMES=()
16+ for RUNTIME in " ${RUNTIMES[@]} " ; do
17+ JOB_NAMES+=(" integration-snapshots-test_integrations-${RUNTIME} " )
18+ JOB_NAMES+=(" integration-snapshots-test_web-${RUNTIME} " )
19+ done
20+
21+ TEMP_DIR=$( mktemp -d)
22+ cleanup () {
23+ rm -rf " ${TEMP_DIR} "
24+ }
25+ trap cleanup EXIT
26+
27+ for JOB_NAME in " ${JOB_NAMES[@]} " ; do
28+ echo " Processing job: ${JOB_NAME} "
29+ download_circleci_artifact " ${PROJECT_SLUG} " " ${WORKFLOW_NAME} " " ${JOB_NAME} " " ${ARTIFACT_PATTERN} " " ${TEMP_DIR} /${JOB_NAME} .json" 0
30+ done
31+
32+ echo " Aggregating JSON files..."
33+ jq -s ' reduce .[] as $item ({};
34+ reduce (keys_unsorted | .[]) as $key ($item;
35+ $item[$key] += ($item[$key] // [] | unique)
36+ )
37+ )' " ${TEMP_DIR} " /* .json > " ${OUTPUT_FILE} "
38+
39+ 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() {
2323 JOB_NAME=$3 # "Compile Loader Linux x86_64"
2424 ARTIFACT_PATTERN=$4 # "loader/modules/dd_library_loader.so"
2525 ARTIFACT_NAME=$5 # "dd_library_loader-x86_64-linux-gnu.so"
26+ REQUIRE_SUCCESS=${6:- 1} # Whether job status must be successful (default: 1)
2627
2728 # Circle CI workflow is not triggered by tags,
2829 # So we fallback to the release branch (eg. "ddtrace-1.3.0")
@@ -56,7 +57,7 @@ download_circleci_artifact() {
5657 continue
5758 fi
5859
59- if [[ " ${JOB_STATUS} " != " success" ]]; then
60+ if ${REQUIRE_SUCCESS} && [[ " ${JOB_STATUS} " != " success" ]]; then
6061 printf " CircleCI job is not successful:\n ${JOB} \n"
6162 exit 1
6263 fi
You can’t perform that action at this time.
0 commit comments