File tree Expand file tree Collapse file tree 3 files changed +69
-1
lines changed Expand file tree Collapse file tree 3 files changed +69
-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 : |
25+ export CI_COMMIT_SHA=$(git rev-parse HEAD)
26+ export CI_COMMIT_BRANCH=$(git branch --contains "${CI_COMMIT_SHA}" | grep -v 'detached' | head -n 1 | awk '{print $2}')
27+ ./.github/scripts/aggregate_tested_versions.sh
28+
29+ - name : Show aggregated versions
30+ 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