Create a gist now

Instantly share code, notes, and snippets.

@sainoky /repo_tag.sh
Last active Aug 29, 2015

What would you like to do?
#!/bin/sh
if test $# -ne 3; then
echo "usage: $0 <Jenkins job URL> <project> <Git dir>"
exit 1
fi
JOB_URL=$1
PROJECT=$2
GIT_DIR=$3
# Assumes the Build ID is saved as buildid.txt
BUILDID=`curl $JOB_URL/buildid.txt`
HASH=`curl $JOB_URL/manifest_static.xml | \
grep $PROJECT | sed 's/.*revision="\([0-9a-f]*\)".*/\1/'`
git --git-dir $GIT_DIR tag -f $BUILDID $HASH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment