Skip to content

Commit 3feedd7

Browse files
committed
Add workflow and debugging
1 parent 7ae2a66 commit 3feedd7

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

.gitlab-ci.yml

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,35 @@ 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:
804+
stage: publish
805+
image: registry.ddbuild.io/images/dd-octo-sts-ci-base:v68058725-73f34e7-2025.06-1
806+
tags: [ "arch:amd64" ]
807+
808+
id_tokens:
809+
DDOCTOSTS_ID_TOKEN:
810+
aud: dd-octo-sts
811+
812+
rules:
813+
- if: '$POPULATE_CACHE'
814+
when: never
815+
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
816+
when: on_success
817+
818+
script:
819+
- dd-octo-sts version
820+
- dd-octo-sts debug --scope DataDog/dd-trace-java --policy dd-trace-java.release
821+
- dd-octo-sts token --scope DataDog/dd-trace-java --policy dd-trace-java.release > github-token.txt
822+
# DEBUG
823+
- echo "Token file exists:" $(test -f github-token.txt && echo "YES" || echo "NO")
824+
- echo "Token file size:" $(wc -c < github-token.txt) "bytes"
825+
- echo "Token preview:" $(head -c 10 github-token.txt)...
826+
827+
artifacts:
828+
paths:
829+
- github-token.txt
830+
expire_in: 1 hour # tokens generated by dd-octo-sts only last for 1 hour
831+
803832
deploy_artifacts_to_github:
804833
stage: publish
805834
image: registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
@@ -814,16 +843,21 @@ deploy_artifacts_to_github:
814843
- job: deploy_to_maven_central
815844
# The deploy_to_maven_central job is not run for release candidate versions
816845
optional: true
846+
- job: get_github_token
847+
817848
script:
818-
- aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.gh_release_token --with-decryption --query "Parameter.Value" --out text > github-token.txt
849+
# - aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.gh_release_token --with-decryption --query "Parameter.Value" --out text > github-token.txt
850+
# Debug token reception
851+
- echo "Token file exists:" $(test -f github-token.txt && echo "YES" || echo "NO")
852+
- echo "Token file size:" $(wc -c < github-token.txt) "bytes"
819853
- gh auth login --with-token < github-token.txt
820854
- gh auth status # Maybe helpful to have this output in logs?
821-
- export VERSION=${CI_COMMIT_TAG##v} # remove "v" from front of tag to get version
822-
- 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
823-
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent.jar
824-
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar
825-
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-api/build/libs/dd-trace-api-${VERSION}.jar
826-
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-ot/build/libs/dd-trace-ot-${VERSION}.jar
855+
# - export VERSION=${CI_COMMIT_TAG##v} # remove "v" from front of tag to get version
856+
# - 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
857+
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent.jar
858+
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar
859+
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-api/build/libs/dd-trace-api-${VERSION}.jar
860+
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-ot/build/libs/dd-trace-ot-${VERSION}.jar
827861
retry:
828862
max: 2
829863
when: always

0 commit comments

Comments
 (0)