Skip to content

Commit 101e686

Browse files
committed
Override new publishing-gate job
1 parent 0752093 commit 101e686

File tree

1 file changed

+47
-44
lines changed

1 file changed

+47
-44
lines changed

.gitlab-ci.yml

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ stages:
99
- build
1010
- shared-pipeline
1111
- publish
12-
- publish-oci-images
1312
- benchmarks
1413
- macrobenchmarks
1514
- tests
@@ -142,6 +141,8 @@ default:
142141
CACHE_COMPRESSION_LEVEL: "slowest"
143142

144143
RUNTIME_AVAILABLE_PROCESSORS_OVERRIDE: 4 # Runtime.getRuntime().availableProcessors() returns incorrect or very high values in Kubernetes
144+
GIT_SUBMODULE_STRATEGY: normal
145+
GIT_SUBMODULE_DEPTH: 1
145146
cache:
146147
- key: dependency-$CACHE_TYPE # Dependencies cache
147148
paths:
@@ -192,6 +193,7 @@ default:
192193
after_script:
193194
- *cgroup_info
194195

196+
# TODO: Add a pre-release check to see if the dd-octo-sts token is working.
195197
# Checks and fail early if central credentials are incorrect, indeed, when a new token is generated
196198
# on the central publisher protal, it invalidates the old one. This checks prevents going further.
197199
# See https://datadoghq.atlassian.net/wiki/x/Oog5OgE
@@ -803,14 +805,54 @@ deploy_to_maven_central:
803805

804806
deploy_artifacts_to_github:
805807
stage: publish
806-
image: registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
808+
image: registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1
809+
tags: [ "arch:amd64" ]
810+
id_tokens:
811+
DDOCTOSTS_ID_TOKEN:
812+
aud: dd-octo-sts
807813
rules:
808814
- if: '$POPULATE_CACHE'
809815
when: never
810816
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
811817
when: on_success
812818
# Requires the deploy_to_maven_central job to have run first (the UP-TO-DATE gradle check across jobs is broken)
813819
# This will deploy the artifacts built from the publishToSonatype task to the GitHub release
820+
needs:
821+
- job: deploy_to_maven_central
822+
# The deploy_to_maven_central job is not run for release candidate versions
823+
optional: true
824+
before_script:
825+
# Get token
826+
- dd-octo-sts version
827+
- dd-octo-sts debug --scope DataDog/dd-trace-java --policy self.gitlab.release
828+
- dd-octo-sts token --scope DataDog/dd-trace-java --policy self.gitlab.release > github-token.txt
829+
script:
830+
- gh auth login --with-token < github-token.txt
831+
- gh auth status # Maybe helpful to have this output in logs?
832+
- export VERSION=${CI_COMMIT_TAG##v} # remove "v" from front of tag to get version
833+
- cp workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar workspace/dd-java-agent/build/libs/dd-java-agent.jar # we upload two filenames
834+
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent.jar
835+
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar
836+
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-api/build/libs/dd-trace-api-${VERSION}.jar
837+
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-ot/build/libs/dd-trace-ot-${VERSION}.jar
838+
after_script:
839+
- dd-octo-sts revoke -t $(cat github-token.txt)
840+
retry:
841+
max: 2
842+
when: always
843+
844+
# This is the original job that uses the AWS SSM token retrieval method. Allow manual triggering in case the dd-octo-sts token is not working.
845+
# TODO: Remove this job once the dd-octo-sts token is provably working.
846+
deploy_artifacts_to_github_old:
847+
stage: publish
848+
image: registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
849+
rules:
850+
- if: '$POPULATE_CACHE'
851+
when: never
852+
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
853+
when: manual
854+
# Requires the deploy_to_maven_central job to have run first (the UP-TO-DATE gradle check across jobs is broken)
855+
# This will deploy the artifacts built from the publishToSonatype task to the GitHub release
814856
needs:
815857
- job: deploy_to_maven_central
816858
# The deploy_to_maven_central job is not run for release candidate versions
@@ -839,48 +881,9 @@ requirements_json_test:
839881
package-oci:
840882
needs: [ build ]
841883

842-
# "needs" parameters are taken from the one-pipeline template: https://github.com/DataDog/libdatadog-build/blob/main/templates/one-pipeline.yml
843-
# but with an additional dependency on the deploy_to_maven_central job.
844-
internal-publish-lib-init-tags:
845-
stage: publish-oci-images
846-
needs:
847-
- job: deploy_to_maven_central
848-
- job: generate-lib-init-pinned-tag-values
849-
artifacts: true
850-
- job: create-multiarch-lib-injection-image
851-
852-
promote-oci-to-prod:
853-
stage: publish-oci-images
854-
needs:
855-
- job: deploy_to_maven_central
856-
- job: package-oci
857-
artifacts: true
858-
- job: oci-internal-publish
859-
artifacts: true
860-
861-
promote-oci-to-prod-beta:
862-
stage: publish-oci-images
863-
needs:
864-
- job: package-oci
865-
artifacts: true
866-
- job: oci-internal-publish
867-
artifacts: true
868-
869-
promote-oci-to-staging:
870-
stage: publish-oci-images
871-
needs:
872-
- job: package-oci
873-
artifacts: true
874-
- job: oci-internal-publish
875-
artifacts: true
876-
877-
publish-lib-init-pinned-tags:
878-
stage: publish-oci-images
879-
needs:
880-
- job: deploy_to_maven_central
881-
- job: generate-lib-init-pinned-tag-values
882-
artifacts: true
883-
- job: create-multiarch-lib-injection-image
884+
# Publish OCI images after deployment to Maven Central is successful.
885+
publishing-gate:
886+
needs: [ deploy_to_maven_central ]
884887

885888
configure_system_tests:
886889
variables:

0 commit comments

Comments
 (0)