diff --git a/Jenkinsfile b/Jenkinsfile index d6a5f76df..0811bbd3b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,6 +5,7 @@ node('Node-Dev-100163') { checkout scm } stage('Cleanup') { + sh "make update_tag CURR_BRANCH=${env.BRANCH_NAME}" sh 'make clean_up' } stage('Build') { diff --git a/Makefile b/Makefile index 672485930..36fbb07e1 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,9 @@ DOCKER_PUSH=$(DOCKERCMD) push DOCKER_IMAGE=$(DOCKERCMD) image DEPLOY_PATH=${PWD}/deployment SETUP_PATH=${PWD}/setup -HASH := $(shell git rev-parse HEAD) CONFIG=odoo.conf ODOO_IMAGE=hub.nextzenos.com/nexterp/odoo -TAG := develop +TAG := $(shell rev-parse --abbrev-ref HEAD) CONTAINER_ID=odoo-${TAG} install: sudo apt -y update && \ @@ -39,6 +38,8 @@ run_server_docker: fi cd ${DEPLOY_PATH} &&\ ${DOCKER_COMPOSE_CMD} up -d +update_tag: + ${SETUP_PATH}/update_tag.sh $(CURR_BRANCH) restore_database: @echo "Checking for backup.zip in container..." @if sudo docker exec ${CONTAINER_ID} test -f /etc/odoo/backup/backup.zip; then \ diff --git a/setup/update_tag.sh b/setup/update_tag.sh new file mode 100755 index 000000000..5a49c6516 --- /dev/null +++ b/setup/update_tag.sh @@ -0,0 +1,3 @@ +#!/usr/bin/bash +set +x +sed -i "s/TAG := \$(shell rev-parse --abbrev-ref HEAD)/TAG := $1/g" Makefile