Delete RC release during release tag pipeline
We create an RC tag to test the release pipeline and release note generation prior to creating the release tag. Once RC release notes are generated we review for accuracy, then cut release tag. During the release tag job we'd like to delete the RC tag.
Rough outline -> Implement logic to make API call to repo1 to delete releases containing an "RC"
Below is script used to selectively delete RC releases..
BB_PROJ_ID=2872
export REPO1_ACCESS_KEY=replace
for tag in $(curl -s --header "PRIVATE-TOKEN: $REPO1_ACCESS_KEY" "https://repo1.dso.mil/api/v4/projects/$BB_PROJ_ID/releases" | jq '.[] | select(.tag_name | contains("-rc")) | .tag_name' | tr -d '"')
do
echo "killng $tag..."
# to kill the release:
curl -s -X "DELETE" --header "PRIVATE-TOKEN: $REPO1_ACCESS_KEY" https://repo1.dso.mil/api/v4/projects/$BB_PROJ_ID/releases/$tag
done
Edited by Christopher O'Connell