File tree Expand file tree Collapse file tree 1 file changed +42
-2
lines changed
Expand file tree Collapse file tree 1 file changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -880,9 +880,49 @@ requirements_json_test:
880880package-oci :
881881 needs : [ build ]
882882
883- # Publish OCI images after deployment to Maven Central is successful.
884- publishing-gate :
883+ # Verify Maven Central deployment is publicly available before publishing OCI images
884+ verify_maven_central_deployment :
885+ image : curlimages/curl:8.15.0 # minimum docker image for curling: https://hub.docker.com/r/curlimages/curl
886+ stage : publish
885887 needs : [ deploy_to_maven_central ]
888+ rules :
889+ - if : ' $POPULATE_CACHE'
890+ when : never
891+ - if : ' $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
892+ when : on_success
893+ - when : manual
894+ allow_failure : true
895+ script :
896+ - |
897+ export VERSION=1.51.2 # hardcoded VERSION for testing
898+ # export VERSION=${CI_COMMIT_TAG##v}
899+ MAVEN_URL="https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/${VERSION}/dd-java-agent-${VERSION}.jar"
900+ echo "Checking URL: $MAVEN_URL"
901+ # Wait 30 min for the release to be available
902+ TRY=0
903+ MAX_TRIES=60
904+ DELAY=30
905+ while [ $TRY -lt $MAX_TRIES ]; do
906+ if curl -s -I "$MAVEN_URL" | grep -q "^HTTP/.* 200"; then
907+ break
908+ fi
909+ sleep $DELAY
910+ TRY=$((TRY + 1))
911+ if [ $TRY -eq $MAX_TRIES ]; then
912+ echo "The release is not available after 30 mins. Manually re-run the job to try again."
913+ exit 1
914+ fi
915+ done
916+
917+ publishing-gate :
918+ needs : [ verify_maven_central_deployment ]
919+ rules :
920+ - if : ' $POPULATE_CACHE'
921+ when : never
922+ - if : ' $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
923+ when : on_success
924+ - when : manual
925+ allow_failure : true
886926
887927configure_system_tests :
888928 variables :
You can’t perform that action at this time.
0 commit comments