summaryrefslogtreecommitdiff
path: root/commit-repo-tag.sh
diff options
context:
space:
mode:
authorEdward Hervey <edward@collabora.com>2013-11-15 16:46:48 +0100
committerEdward Hervey <edward@collabora.com>2013-11-15 16:54:44 +0100
commit86e034074fbdb145062312835b2342f30f3293fe (patch)
tree89ea550f7f2db70f7b6edf8c7cbc6fc3f605ed5c /commit-repo-tag.sh
parent85018e2e96c6bf22dbbf588f2aa43386c96b22ce (diff)
commit-repo-tag: Make script work without arguments in jenkins
Automatically picks up the BUILD_ID env variable
Diffstat (limited to 'commit-repo-tag.sh')
-rwxr-xr-xcommit-repo-tag.sh24
1 files changed, 14 insertions, 10 deletions
diff --git a/commit-repo-tag.sh b/commit-repo-tag.sh
index 79510ab..add3708 100755
--- a/commit-repo-tag.sh
+++ b/commit-repo-tag.sh
@@ -23,15 +23,17 @@ MANIFEST_FILENAME=default.xml
# Temporary file used to store the new manifest
TMP_M_FILENAME=`mktemp --suffix=.xml`
-if [ $# = 0 ];
+if [ -z $WORKSPACE ];
then
- echo "Usage: $0 <jenkins build number>"
- exit 42
+ echo "Out-of-jenkins build"
+ if [ $# = 0 ];
+ then
+ echo "Usage: $0 <jenkins build number>"
+ exit 42
+ fi
+ BUILD_ID=$1
fi
-# Get the jenkins build number
-BUILD_NUMBER=$1
-
if [ ! -d ".repo" ];
then
echo "Cannot find a repo directory. Aborting..."
@@ -70,17 +72,19 @@ then
# Commit new manifest file
git commit -F $TMP_C_FILENAME -- $MANIFEST_FILENAME || true
- echo "Tagging manifest for storaging."
+ echo "Tagging manifest for storage."
# Tag the new manifest version
CUR_DATE=`date +%Y%m%d`
- git tag -a "build_$CUR_DATE-$BUILD_NUMBER" \
- -m "Tagging manifest build $BUILD_NUMBER on $CURDATE"
+ git tag -a "build_$BUILD_ID" \
+ -m "Tagging manifest build $BUILD_ID"
echo "Pushing new manifest to the branch $BUILD_BRANCH"
# Push new manifest to the build branch
- git push --tags origin $BUILD_BRANCH
+ git push -v --tags origin $BUILD_BRANCH
+else
+ echo "No changes to push"
fi
# Remove temporary file