Skip to content

Commit c7746fb

Browse files
committed
Allow promote script to be run again
1 parent d6496c0 commit c7746fb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ci/scripts/promote.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,16 @@ curl \
3030
-d "{\"status\": \"staged\", \"sourceRepo\": \"libs-staging-local\", \"targetRepo\": \"${targetRepo}\"}" \
3131
-f \
3232
-X \
33-
POST "${ARTIFACTORY_SERVER}/api/build/promote/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to promote" >&2; exit 1; }
33+
POST "${ARTIFACTORY_SERVER}/api/build/promote/${buildName}/${buildNumber}" > /dev/null || {
34+
result=$( curl -s -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} -f "${ARTIFACTORY_SERVER}/api/build/${buildName}/${buildNumber}" )
35+
resultRepo=$( echo $result | jq -r '.buildInfo.statuses[0].repository' )
36+
if [[ $resultRepo = "libs-release-local" ]]; then
37+
echo "Already promoted"
38+
else
39+
echo "Failed to promote" >&2
40+
exit 1
41+
fi
42+
}
3443

3544
if [[ $RELEASE_TYPE = "RELEASE" ]]; then
3645
curl \

0 commit comments

Comments
 (0)