-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated release pipeline script to create tags for releases off patch…
… branches in the format: 20190730.1-patch1
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
sourceBranch="$BUILD_SOURCEBRANCHNAME" | ||
|
||
if [ "$sourceBranch" == "master" ]; then | ||
echo "##vso[task.setvariable variable=ReleaseTagName;]$BUILD_BUILDNUMBER" | ||
elif [[ "$sourceBranch" == patch/* ]]; then | ||
IFS=/ | ||
read -ra branchNameParts <<< "$sourceBranch" | ||
|
||
# Name of the tag which is being patched (ex: 20190730.1) | ||
patchedTagName=${branchNameParts[1]} | ||
|
||
# We want tags for patch releases in the format: 20190730.1-patch1, 20190730.1-patch2 etc. | ||
baseReleaseTagUrl="https://github.com/microsoft/Oryx/releases/tag" | ||
patchNumber=0 | ||
|
||
# Increment patch numbers until we find one for which we have not created a release already | ||
while true; do | ||
patchNumber=$((patchNumber + 1)) | ||
fullPatchTagName="$patchedTagName-patch$patchNumber" | ||
releaseUrl="$baseReleaseTagUrl/$fullPatchTagName" | ||
|
||
curl -I "$releaseUrl" 1> /tmp/createReleaseTag.txt 2> /dev/null | ||
grep "HTTP/1.1 404 Not Found" /tmp/createReleaseTag.txt &> /dev/null | ||
exitCode=$? | ||
rm -f /tmp/createReleaseTag.txt | ||
if [ $exitCode -eq 0 ]; then | ||
echo "##vso[task.setvariable variable=ReleaseTagName;]$fullPatchTagName" | ||
break | ||
fi | ||
done | ||
fi |