@@ -805,64 +805,66 @@ deploy_artifacts_to_github:
805805 stage : publish
806806 image : registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1
807807 tags : [ "arch:amd64" ]
808-
809808 id_tokens :
810809 DDOCTOSTS_ID_TOKEN :
811810 aud : dd-octo-sts
812-
813811 rules :
814812 - if : ' $POPULATE_CACHE'
815813 when : never
816814 - if : ' $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
817815 when : on_success
818-
819816 # Requires the deploy_to_maven_central job to have run first (the UP-TO-DATE gradle check across jobs is broken)
820817 # This will deploy the artifacts built from the publishToSonatype task to the GitHub release
821818 needs :
822819 - job : deploy_to_maven_central
823820 # The deploy_to_maven_central job is not run for release candidate versions
824821 optional : true
825-
826822 before_script :
827- # Get a token
823+ # Get token
828824 - dd-octo-sts version
829825 - dd-octo-sts debug --scope DataDog/dd-trace-java --policy self.gitlab.release
830826 - dd-octo-sts token --scope DataDog/dd-trace-java --policy self.gitlab.release > github-token.txt
831-
832- # TODO: This is a temporary solution to test the dd-octo-sts token during the release process. We should remove the AWS SSM token retrieval method once the dd-octo-sts token is provably working.
833827 script :
834- - |
835- deploy_to_github() {
836- gh auth login --with-token < github-token.txt
837- gh auth status
838- export VERSION=${CI_COMMIT_TAG##v} # remove "v" from front of tag to get the version
839- cp workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar workspace/dd-java-agent/build/libs/dd-java-agent.jar # upload two filenames
840- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent.jar
841- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar
842- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-api/build/libs/dd-trace-api-${VERSION}.jar
843- gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-ot/build/libs/dd-trace-ot-${VERSION}.jar
844- }
845-
846- # Try using the dd-octo-sts token first. If it fails, then fall back to the AWS SSM token.
847- # Also track which token was used successfully.
848- if ! deploy_to_github; then
849- echo "Using dd-octo-sts token failed. Now proceeding with the original AWS SSM token retrieval method..."
850- echo "USED_DD_OCTO_STS_TOKEN=false" > github_token_source.env
851- 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
852- deploy_to_github
853- else
854- echo "Using dd-octo-sts token succeeded. Github release artifacts were uploaded successfully."
855- echo "USED_DD_OCTO_STS_TOKEN=true" > github_token_source.env
856- fi
857-
828+ - gh auth login --with-token < github-token.txt
829+ - gh auth status # Maybe helpful to have this output in logs?
830+ - export VERSION=${CI_COMMIT_TAG##v} # remove "v" from front of tag to get version
831+ - 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
832+ - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent.jar
833+ - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar
834+ - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-api/build/libs/dd-trace-api-${VERSION}.jar
835+ - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-ot/build/libs/dd-trace-ot-${VERSION}.jar
858836 after_script :
859- # Only revoke the dd-octo-sts token if it was successfully used
860- - source github_token_source.env
861- - |
862- if [ "$USED_DD_OCTO_STS_TOKEN" = "true" ]; then
863- dd-octo-sts revoke -t $(cat github-token.txt)
864- fi
837+ - dd-octo-sts revoke -t $(cat github-token.txt)
838+ retry :
839+ max : 2
840+ when : always
865841
842+ # 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.
843+ # TODO: Remove this job once the dd-octo-sts token is provably working.
844+ deploy_artifacts_to_github_old :
845+ stage : publish
846+ image : registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
847+ rules :
848+ - if : ' $POPULATE_CACHE'
849+ when : never
850+ - if : ' $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
851+ when : manual
852+ # Requires the deploy_to_maven_central job to have run first (the UP-TO-DATE gradle check across jobs is broken)
853+ # This will deploy the artifacts built from the publishToSonatype task to the GitHub release
854+ needs :
855+ - job : deploy_to_maven_central
856+ # The deploy_to_maven_central job is not run for release candidate versions
857+ optional : true
858+ script :
859+ - 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
860+ - gh auth login --with-token < github-token.txt
861+ - gh auth status # Maybe helpful to have this output in logs?
862+ - export VERSION=${CI_COMMIT_TAG##v} # remove "v" from front of tag to get version
863+ - 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
864+ - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent.jar
865+ - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-java-agent/build/libs/dd-java-agent-${VERSION}.jar
866+ - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-api/build/libs/dd-trace-api-${VERSION}.jar
867+ - gh release upload --clobber --repo DataDog/dd-trace-java $CI_COMMIT_TAG workspace/dd-trace-ot/build/libs/dd-trace-ot-${VERSION}.jar
866868 retry :
867869 max : 2
868870 when : always
0 commit comments