Commit a938c372 authored by Madhura Bhave's avatar Madhura Bhave

Switch to async promotion

Due to timeouts while distributing release artifacts,
this commit uses the async mode for distribution.

Before syncing to maven central, we need to check if all the artifacts
have been published to Bintray. This is done by hitting the Bintray API
till we get the version or until a timeout is reached.

Closes gh-12292
parent 9a64d3bf
...@@ -347,12 +347,14 @@ jobs: ...@@ -347,12 +347,14 @@ jobs:
ARTIFACTORY_SERVER: ((artifactory-server)) ARTIFACTORY_SERVER: ((artifactory-server))
ARTIFACTORY_USERNAME: ((artifactory-username)) ARTIFACTORY_USERNAME: ((artifactory-username))
ARTIFACTORY_PASSWORD: ((artifactory-password)) ARTIFACTORY_PASSWORD: ((artifactory-password))
BINTRAY_SUBJECT: ((bintray-subject))
BINTRAY_REPO: ((bintray-repo))
- name: sync-to-maven-central - name: sync-to-maven-central
serial: true serial: true
plan: plan:
- get: spring-boot-ci-image - get: spring-boot-ci-image
- get: git-repo - get: git-repo
trigger: false trigger: true
- get: artifactory-repo - get: artifactory-repo
trigger: false trigger: false
passed: [promote-release] passed: [promote-release]
......
...@@ -39,10 +39,30 @@ if [[ $RELEASE_TYPE = "RELEASE" ]]; then ...@@ -39,10 +39,30 @@ if [[ $RELEASE_TYPE = "RELEASE" ]]; then
--max-time 2700 \ --max-time 2700 \
-u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \
-H "Content-type:application/json" \ -H "Content-type:application/json" \
-d "{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\"}" \ -d "{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}" \
-f \ -f \
-X \ -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 fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment