Allow maven central sync to run several times

Update the "sync to maven central" CI job so that it can be rerun if
necessary. We now first check if artifacts are already published before
triggering the sync from Bintray.

Closes gh-16866
pull/17391/head
Phillip Webb 6 years ago
parent 84c6313332
commit 4894affbb6

@ -7,6 +7,18 @@ groupId=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].i
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
echo "Syncing ${buildName}/${buildNumber} to Maven Central" echo "Syncing ${buildName}/${buildNumber} to Maven Central"
publishStatus=$(curl \
-s \
-o /dev/null \
-I \
-w "%{http_code}"
"https://oss.sonatype.org/service/local/repositories/releases/content/org/springframework/boot/spring-boot/${version}/spring-boot-${version}.jar.sha1")
if [ ${publishStatus} == "200" ]; then
echo "Already published to Sonatype"
else
echo "Calling Bintray to sync to Sonatype"
curl \ curl \
-s \ -s \
--connect-timeout 240 \ --connect-timeout 240 \
@ -16,5 +28,7 @@ echo "Syncing ${buildName}/${buildNumber} to Maven Central"
-f \ -f \
-X \ -X \
POST "https://api.bintray.com/maven_central_sync/${BINTRAY_SUBJECT}/${BINTRAY_REPO}/${groupId}/versions/${version}" > /dev/null || { echo "Failed to sync" >&2; exit 1; } POST "https://api.bintray.com/maven_central_sync/${BINTRAY_SUBJECT}/${BINTRAY_REPO}/${groupId}/versions/${version}" > /dev/null || { echo "Failed to sync" >&2; exit 1; }
fi
echo "Sync complete" echo "Sync complete"
echo $version > version/version echo $version > version/version

Loading…
Cancel
Save