From f0d5fef41ecb5f9d4eaf8bb710c1e584c733cc6e Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Tue, 17 Oct 2017 10:37:30 -0600 Subject: git tagging --- salt/openbook/ansible/files/deploy-dev-env.sh | 2 +- salt/openbook/ansible/files/find_next_tag.sh | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 salt/openbook/ansible/files/find_next_tag.sh (limited to 'salt') diff --git a/salt/openbook/ansible/files/deploy-dev-env.sh b/salt/openbook/ansible/files/deploy-dev-env.sh index b47774e..176ae6f 100644 --- a/salt/openbook/ansible/files/deploy-dev-env.sh +++ b/salt/openbook/ansible/files/deploy-dev-env.sh @@ -8,5 +8,5 @@ rm -f env.yaml ln -s env.yaml.openbook env.yaml popd pushd ${buildroot} -ansible-playbook -i inventory_json.rb openbook_installer.yaml +ansible-playbook -vvv -i inventory_json.rb openbook_installer.yaml popd diff --git a/salt/openbook/ansible/files/find_next_tag.sh b/salt/openbook/ansible/files/find_next_tag.sh new file mode 100644 index 0000000..638215c --- /dev/null +++ b/salt/openbook/ansible/files/find_next_tag.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +cd "${1}" +basetag="${2}" + +lastbuild=$(git for-each-ref --sort=taggerdate --format '%(tag)' | grep -F "${basetag}" | tail -n 1 | awk -F. '{print $3}') +if [ "${lastbuild}" == "" ]; then + newtag="${basetag}.1" +else + newtag="${basetag}.$(( ${lastbuild} + 1 ))" +fi +git tag -a "build-${newtag}" -m "tagged by jenkins: $(date)" +git push origin "build-${newtag}" +echo -n "${newtag}" -- cgit v1.3