diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 17ae69d25fc..b6782b02c0d 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -347,12 +347,14 @@ jobs: ARTIFACTORY_SERVER: ((artifactory-server)) ARTIFACTORY_USERNAME: ((artifactory-username)) ARTIFACTORY_PASSWORD: ((artifactory-password)) + BINTRAY_SUBJECT: ((bintray-subject)) + BINTRAY_REPO: ((bintray-repo)) - name: sync-to-maven-central serial: true plan: - get: spring-boot-ci-image - get: git-repo - trigger: false + trigger: true - get: artifactory-repo trigger: false passed: [promote-release] diff --git a/ci/scripts/promote.sh b/ci/scripts/promote.sh index 29c3b7e89a3..499787829e5 100755 --- a/ci/scripts/promote.sh +++ b/ci/scripts/promote.sh @@ -39,10 +39,30 @@ if [[ $RELEASE_TYPE = "RELEASE" ]]; then --max-time 2700 \ -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ -H "Content-type:application/json" \ - -d "{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\"}" \ + -d "{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}" \ -f \ -X \ - POST "${ARTIFACTORY_SERVER}/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to publish" >&2; exit 1; } + POST "${ARTIFACTORY_SERVER}/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to distribute" >&2; exit 1; } + + echo "Waiting for artifacts to be published" + ARTIFACTS_PUBLISHED=false + WAIT_TIME=5 + COUNTER=0 + while [ $ARTIFACTS_PUBLISHED == "false" ] && [ $COUNTER -lt 24 ]; do + result=$(curl https://api.bintray.com/packages/${BINTRAY_SUBJECT}/${BINTRAY_REPO}/$groupId ) + versions=$( echo $result | jq -r '.versions' ) + exists=$(echo $versions | grep $version) + if [ $? -eq 0 ]; then + ARTIFACTS_PUBLISHED=true + fi + COUNTER=$(( $COUNTER + 1)) + echo $COUNTER + sleep WAIT_TIME + done + if [ $ARTIFACTS_PUBLISHED == "false" ]; then + echo "Failed to publish" + exit 1 + fi fi