Last active
August 29, 2015 13:57
-
-
Save alekseykorzun/9901938 to your computer and use it in GitHub Desktop.
Automaticly purge build tags that were cut by Jenkins
This file contains hidden or 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
# Purge old tags | |
tag_limit=8 | |
tag_current=`git tag -n |grep -i "jenkins-${JOB_NAME}" | wc -l` | |
if [ $tag_limit -lt $tag_current ]; then | |
tag_difference=`expr $tag_current - $tag_limit ` | |
git tag |grep -i "jenkins-${JOB_NAME}" | head -$tag_difference | xargs git push --delete origin | |
git tag |grep -i "jenkins-${JOB_NAME}" | head -$tag_difference | xargs git tag -d | |
fi | |
# Create tag | |
git push --tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment