@@ -119,6 +119,18 @@ default:
119119 - .gitlab/cgroup-info.sh
120120 - gitlab_section_end "cgroup-info"
121121
122+ .gitlab_base_ref_params : &gitlab_base_ref_params
123+ - |
124+ # FIXME: Disabled until we find a way to not hit GitHub API rate limit
125+ if false && [[ ! $CI_COMMIT_BRANCH =~ ^(master|release/.*)$ ]]; then
126+ export GIT_BASE_REF=$(.gitlab/find-gh-base-ref.sh)
127+ if [[ -n "$GIT_BASE_REF" ]]; then
128+ export GRADLE_PARAMS="$GRADLE_PARAMS -PgitBaseRef=origin/$GIT_BASE_REF"
129+ else
130+ echo "Failed to find base ref for PR" >&2
131+ fi
132+ fi
133+
122134.gradle_build : &gradle_build
123135 image : ghcr.io/datadog/dd-trace-java-docker-build:${BUILDER_IMAGE_VERSION_PREFIX}base
124136 stage : build
@@ -223,7 +235,8 @@ build_tests:
223235 MAVEN_OPTS : " -Xms64M -Xmx512M -Dorg.slf4j.simpleLogger.defaultLogLevel=debug" # FIXME: Build :smokeTest build fails unless mvn debug logging is on
224236
225237 script :
226- - ./gradlew clean $GRADLE_TARGET -PskipTests $GRADLE_ARGS
238+ - *gitlab_base_ref_params
239+ - ./gradlew clean $GRADLE_TARGET $GRADLE_PARAMS -PskipTests $GRADLE_ARGS
227240
228241populate_dep_cache :
229242 extends : build_tests
@@ -327,7 +340,8 @@ test_published_artifacts:
327340 variables :
328341 CACHE_TYPE : lib
329342 script :
330- - ./gradlew $GRADLE_TARGET -PskipTests -PrunBuildSrcTests -PskipSpotless -PtaskPartitionCount=$NORMALIZED_NODE_TOTAL -PtaskPartition=$NORMALIZED_NODE_INDEX $GRADLE_ARGS
343+ - *gitlab_base_ref_params
344+ - ./gradlew $GRADLE_TARGET $GRADLE_PARAMS -PskipTests -PrunBuildSrcTests -PskipSpotless -PtaskPartitionCount=$NORMALIZED_NODE_TOTAL -PtaskPartition=$NORMALIZED_NODE_INDEX $GRADLE_ARGS
331345 after_script :
332346 - *cgroup_info
333347 - source .gitlab/gitlab-utils.sh
@@ -460,6 +474,7 @@ muzzle-dep-report:
460474 - if : $CI_COMMIT_BRANCH == "master"
461475 when : on_success
462476 script :
477+ - *gitlab_base_ref_params
463478 - >
464479 if [ "$PROFILE_TESTS" == "true" ] && [ "$testJvm" != "ibm8" ] && [ "$testJvm" != "oracle8" ];
465480 then
@@ -506,7 +521,7 @@ muzzle-dep-report:
506521 CI_USE_TEST_AGENT : " true"
507522 CI_AGENT_HOST : local-agent
508523 services :
509- - name : ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.11.0
524+ - name : ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.24.1
510525 alias : local-agent
511526 variables :
512527 LOG_LEVEL : " DEBUG"
@@ -729,6 +744,7 @@ deploy_to_di_backend:manual:
729744 UPSTREAM_COMMIT_AUTHOR : $CI_COMMIT_AUTHOR
730745 UPSTREAM_COMMIT_SHORT_SHA : $CI_COMMIT_SHORT_SHA
731746
747+ # If the deploy_to_sonatype job is re-run, re-trigger the deploy_artifacts_to_github job as well so that the artifacts match.
732748deploy_to_sonatype :
733749 extends : .gradle_build
734750 stage : publish
@@ -746,8 +762,8 @@ deploy_to_sonatype:
746762 - when : manual
747763 allow_failure : true
748764 script :
749- - export SONATYPE_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.sonatype_username --with-decryption --query "Parameter.Value" --out text)
750- - export SONATYPE_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.sonatype_password --with-decryption --query "Parameter.Value" --out text)
765+ - export SONATYPE_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_username --with-decryption --query "Parameter.Value" --out text)
766+ - export SONATYPE_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_password --with-decryption --query "Parameter.Value" --out text)
751767 - export GPG_PRIVATE_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.signing.gpg_private_key --with-decryption --query "Parameter.Value" --out text)
752768 - export GPG_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.signing.gpg_passphrase --with-decryption --query "Parameter.Value" --out text)
753769 - ./gradlew -PbuildInfo.build.number=$CI_JOB_ID publishToSonatype closeSonatypeStagingRepository -PskipTests $GRADLE_ARGS
@@ -765,7 +781,7 @@ deploy_artifacts_to_github:
765781 when : never
766782 - if : ' $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
767783 when : on_success
768- # Requires the deploy_to_sonatype job to have run first the UP-TO-DATE gradle check across jobs is broken
784+ # Requires the deploy_to_sonatype job to have run first ( the UP-TO-DATE gradle check across jobs is broken)
769785 # This will deploy the artifacts built from the publishToSonatype task to the GitHub release
770786 needs :
771787 - job : deploy_to_sonatype
0 commit comments