Skip to content

Commit 753f8a1

Browse files
sarahchen6mtoffl01
authored andcommitted
Add workflow and debugging
(cherry picked from commit 3feedd7)
1 parent dcad7a1 commit 753f8a1

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
@@ -797,6 +797,35 @@ deploy_to_sonatype:
797797
- 'workspace/dd-trace-api/build/libs/*.jar'
798798
- 'workspace/dd-trace-ot/build/libs/*.jar'
799799

800+
get_github_token:
801+
stage: publish
802+
image: registry.ddbuild.io/images/dd-octo-sts-ci-base:v68058725-73f34e7-2025.06-1
803+
tags: [ "arch:amd64" ]
804+
805+
id_tokens:
806+
DDOCTOSTS_ID_TOKEN:
807+
aud: dd-octo-sts
808+
809+
rules:
810+
- if: '$POPULATE_CACHE'
811+
when: never
812+
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
813+
when: on_success
814+
815+
script:
816+
- dd-octo-sts version
817+
- dd-octo-sts debug --scope DataDog/dd-trace-java --policy dd-trace-java.release
818+
- dd-octo-sts token --scope DataDog/dd-trace-java --policy dd-trace-java.release > github-token.txt
819+
# DEBUG
820+
- echo "Token file exists:" $(test -f github-token.txt && echo "YES" || echo "NO")
821+
- echo "Token file size:" $(wc -c < github-token.txt) "bytes"
822+
- echo "Token preview:" $(head -c 10 github-token.txt)...
823+
824+
artifacts:
825+
paths:
826+
- github-token.txt
827+
expire_in: 1 hour # tokens generated by dd-octo-sts only last for 1 hour
828+
800829
deploy_artifacts_to_github:
801830
stage: publish
802831
image: registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
@@ -811,16 +840,21 @@ deploy_artifacts_to_github:
811840
- job: deploy_to_sonatype
812841
# The deploy_to_sonatype job is not run for release candidate versions
813842
optional: true
843+
- job: get_github_token
844+
814845
script:
815-
- 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
846+
# - 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
847+
# Debug token reception
848+
- echo "Token file exists:" $(test -f github-token.txt && echo "YES" || echo "NO")
849+
- echo "Token file size:" $(wc -c < github-token.txt) "bytes"
816850
- gh auth login --with-token < github-token.txt
817851
- gh auth status # Maybe helpful to have this output in logs?
818-
- export VERSION=${CI_COMMIT_TAG##v} # remove "v" from front of tag to get version
819-
- 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
820-
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent.jar
821-
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar
822-
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-api/build/libs/dd-trace-api-${VERSION}.jar
823-
- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-ot/build/libs/dd-trace-ot-${VERSION}.jar
852+
# - export VERSION=${CI_COMMIT_TAG##v} # remove "v" from front of tag to get version
853+
# - 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
854+
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent.jar
855+
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar
856+
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-api/build/libs/dd-trace-api-${VERSION}.jar
857+
# - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-ot/build/libs/dd-trace-ot-${VERSION}.jar
824858
retry:
825859
max: 2
826860
when: always

0 commit comments

Comments
 (0)