@@ -20,24 +20,34 @@ stages:
2020variables :
2121 REGISTRY : 486234852809.dkr.ecr.us-east-1.amazonaws.com
2222 BUILD_JOB_NAME : " build"
23+ DEPENDENCY_CACHE_POLICY : pull
24+ BUILD_CACHE_POLICY : pull
25+ GRADLE_VERSION : " 8.4" # must match gradle-wrapper.properties
2326
24- .common : &common
25- tags : [ "runner:main", "size:large " ]
27+ default :
28+ tags : [ "arch:amd64 " ]
2629
2730.gradle_build : &gradle_build
28- << : *common
2931 image : ghcr.io/datadog/dd-trace-java-docker-build:v23.10-base
3032 variables :
3133 GRADLE_OPTS : " -Dorg.gradle.jvmargs='-Xmx2560M -Xms2560M'"
32- GRADLE_ARGS : " -PskipTests --build-cache --stacktrace --no-daemon --parallel --max-workers=8 "
34+ GRADLE_ARGS : " -PskipTests --build-cache --stacktrace --no-daemon --parallel --max-workers=2 "
3335 KUBERNETES_CPU_REQUEST : 8
34- KUBERNETES_MEMORY_REQUEST : 4Gi
35- cache : &default_cache
36- key : ' $CI_SERVER_VERSION' # Reset the cache every time gitlab is upgraded. ~Every couple months
37- paths :
38- - .gradle/wrapper
39- - .gradle/caches
40- policy : pull
36+ KUBERNETES_MEMORY_REQUEST : 6Gi
37+ cache :
38+ - key : ' $CI_SERVER_VERSION-v2' # Dependencies cache. Reset the cache every time gitlab is upgraded. ~Every couple months
39+ paths :
40+ # Cached dependencies and wrappers for gradle
41+ - .gradle/wrapper
42+ - .gradle/caches
43+ - .gradle/notifications
44+ policy : $DEPENDENCY_CACHE_POLICY
45+ - key : $CI_PIPELINE_ID # Incremental build cache. Shared by all jobs in the pipeline
46+ paths :
47+ - .gradle/caches/$GRADLE_VERSION
48+ - .gradle/$GRADLE_VERSION/executionHistory
49+ - workspace
50+ policy : $BUILD_CACHE_POLICY
4151 before_script :
4252 - export GRADLE_USER_HOME=`pwd`/.gradle
4353 # for weird reasons, gradle will always "chmod 700" the .gradle folder
@@ -49,9 +59,12 @@ variables:
4959 - mv .gradle-copy .gradle
5060 - ls -la
5161
52- build : &build
53- << : * gradle_build
62+ build :
63+ extends : . gradle_build
5464 stage : build
65+ variables :
66+ BUILD_CACHE_POLICY : push
67+ DEPENDENCY_CACHE_POLICY : pull
5568 script :
5669 - ./gradlew clean :dd-java-agent:shadowJar :dd-trace-api:jar :dd-trace-ot:shadowJar $GRADLE_ARGS
5770 - echo UPSTREAM_TRACER_VERSION=$(java -jar workspace/dd-java-agent/build/libs/*.jar) >> upstream.env
@@ -66,16 +79,16 @@ build: &build
6679 reports :
6780 dotenv : build.env
6881
69- build_with_cache :
70- << : *build
82+ build_and_populate_dep_cache :
83+ extends : build
84+ variables :
85+ BUILD_CACHE_POLICY : push
86+ DEPENDENCY_CACHE_POLICY : push
7187 rules :
7288 - if : ' $POPULATE_CACHE'
7389 when : on_success
7490 - when : manual
7591 allow_failure : true
76- cache :
77- << : *default_cache
78- policy : push
7992
8093deploy_to_profiling_backend :
8194 stage : publish
@@ -149,7 +162,7 @@ deploy_to_di_backend:manual:
149162 UPSTREAM_COMMIT_SHORT_SHA : $CI_COMMIT_SHORT_SHA
150163
151164deploy_to_sonatype :
152- << : * gradle_build
165+ extends : . gradle_build
153166 stage : publish
154167 needs : [ build ]
155168 rules :
@@ -177,7 +190,6 @@ deploy_to_sonatype:
177190deploy_artifacts_to_github :
178191 stage : publish
179192 image : registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
180- tags : [ "arch:amd64" ]
181193 rules :
182194 - if : ' $POPULATE_CACHE'
183195 when : never
@@ -234,7 +246,6 @@ create_key:
234246 stage : generate-signing-key
235247 when : manual
236248 needs : [ ]
237- tags : [ "arch:amd64", "size:large" ]
238249 variables :
239250 PROJECT_NAME : " dd-trace-java"
240251 EXPORT_TO_KEYSERVER : " true"
0 commit comments