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