Skip to content

Commit cd8653a

Browse files
committed
Rework gitlab-ci workflow
1 parent 61872d8 commit cd8653a

File tree

1 file changed

+24
-33
lines changed

1 file changed

+24
-33
lines changed

.gitlab-ci.yml

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -800,12 +800,14 @@ deploy_to_maven_central:
800800
- 'workspace/dd-trace-api/build/libs/*.jar'
801801
- 'workspace/dd-trace-ot/build/libs/*.jar'
802802

803-
get_github_token:
803+
deploy_artifacts_to_github:
804804
stage: publish
805-
image: registry.ddbuild.io/images/dd-octo-sts-ci-base:v68058725-73f34e7-2025.06-1
806-
tags: [ "arch:amd64" ]
805+
image: registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
806+
tags: [ "docker-in-docker:amd64" ]
807807
needs: [] # DEBUG: Enforce no dependencies to run immediately
808-
808+
services:
809+
- docker:dind
810+
809811
id_tokens:
810812
DDOCTOSTS_ID_TOKEN:
811813
aud: dd-octo-sts
@@ -817,43 +819,28 @@ get_github_token:
817819
# when: on_success
818820
- when: manual # DEBUG: Allow manual trigger
819821
allow_failure: true
820-
821-
script:
822-
- dd-octo-sts version
823-
- dd-octo-sts debug --scope DataDog/dd-trace-java --policy dd-trace-java.release
824-
- dd-octo-sts token --scope DataDog/dd-trace-java --policy dd-trace-java.release > github-token.txt
825-
# DEBUG: Check token file
826-
- echo "Token file exists:" $(test -f github-token.txt && echo "YES" || echo "NO")
827-
- echo "Token file size:" $(wc -c < github-token.txt) "bytes"
828-
- echo "Token preview:" $(head -c 10 github-token.txt)...
829-
830-
artifacts:
831-
paths:
832-
- github-token.txt
833-
expire_in: 1 hour # tokens generated by dd-octo-sts only last for 1 hour
834-
835-
deploy_artifacts_to_github:
836-
stage: publish
837-
image: registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
838-
rules:
839-
- if: '$POPULATE_CACHE'
840-
when: never
841-
# - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
842-
# when: on_success
843-
- when: manual # DEBUG: Allow manual trigger
844-
allow_failure: true
845-
# Requires the deploy_to_maven_central job to have run first (the UP-TO-DATE gradle check across jobs is broken)
846-
# This will deploy the artifacts built from the publishToSonatype task to the GitHub release
822+
847823
needs:
848824
- job: deploy_to_maven_central
849825
# The deploy_to_maven_central job is not run for release candidate versions
850826
optional: true
851-
- job: get_github_token
852827

853828
script:
854-
# DEBUG: Check token file
829+
# Get GitHub token using dd-octo-sts in a container
830+
- docker run --rm
831+
-e DDOCTOSTS_ID_TOKEN
832+
-v $(pwd):/workspace
833+
registry.ddbuild.io/images/dd-octo-sts-ci-base:v68058725-73f34e7-2025.06-1
834+
sh -c "
835+
dd-octo-sts version &&
836+
dd-octo-sts debug --scope DataDog/dd-trace-java --policy dd-trace-java.release &&
837+
dd-octo-sts token --scope DataDog/dd-trace-java --policy dd-trace-java.release > /workspace/github-token.txt
838+
"
839+
840+
# Verify token was generated
855841
- echo "Token file exists:" $(test -f github-token.txt && echo "YES" || echo "NO")
856842
- echo "Token file size:" $(wc -c < github-token.txt) "bytes"
843+
- echo "Token preview:" $(head -c 10 github-token.txt)...
857844

858845
- gh auth login --with-token < github-token.txt
859846
- gh auth status # Maybe helpful to have this output in logs?
@@ -863,6 +850,10 @@ deploy_artifacts_to_github:
863850
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar
864851
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-api/build/libs/dd-trace-api-${VERSION}.jar
865852
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-ot/build/libs/dd-trace-ot-${VERSION}.jar
853+
854+
# Clean up token file
855+
- rm -f github-token.txt
856+
866857
retry:
867858
max: 2
868859
when: always

0 commit comments

Comments
 (0)