From 50fe0392eda5606b2f6737ed6610fbc64aff419b Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Wed, 26 Sep 2018 19:53:35 -0400 Subject: [PATCH] Updates to versioning system. https://github.com/ansible/awx/issues?q=%22--first-parent%22 --- .gitignore | 1 - Makefile | 24 ++++------------------ VERSION | 1 + installer/roles/image_build/tasks/main.yml | 2 +- setup.py | 9 ++------ 5 files changed, 8 insertions(+), 29 deletions(-) create mode 100644 VERSION diff --git a/.gitignore b/.gitignore index 137c233c19..621101995d 100644 --- a/.gitignore +++ b/.gitignore @@ -112,7 +112,6 @@ local/ *.mo requirements/vendor .i18n_built -VERSION .idea/* # AWX python libs populated by requirements.txt diff --git a/Makefile b/Makefile index 75d4b44d45..9468563647 100644 --- a/Makefile +++ b/Makefile @@ -12,10 +12,7 @@ MANAGEMENT_COMMAND ?= awx-manage IMAGE_REPOSITORY_AUTH ?= IMAGE_REPOSITORY_BASE ?= https://gcr.io -VERSION=$(shell git describe --long --first-parent) -VERSION3=$(shell git describe --long --first-parent | sed 's/\-g.*//') -VERSION3DOT=$(shell git describe --long --first-parent | sed 's/\-g.*//' | sed 's/\-/\./') -RELEASE_VERSION=$(shell git describe --long --first-parent | sed 's@\([0-9.]\{1,\}\).*@\1@') +VERSION := $(shell cat VERSION) # NOTE: This defaults the container image version to the branch that's active COMPOSE_TAG ?= $(GIT_BRANCH) @@ -46,20 +43,9 @@ DATE := $(shell date -u +%Y%m%d%H%M) NAME ?= awx GIT_REMOTE_URL = $(shell git config --get remote.origin.url) -ifeq ($(OFFICIAL),yes) - VERSION_TARGET ?= $(RELEASE_VERSION) -else - VERSION_TARGET ?= $(VERSION3DOT) -endif - # TAR build parameters -ifeq ($(OFFICIAL),yes) - SDIST_TAR_NAME=$(NAME)-$(RELEASE_VERSION) - WHEEL_NAME=$(NAME)-$(RELEASE_VERSION) -else - SDIST_TAR_NAME=$(NAME)-$(VERSION3DOT) - WHEEL_NAME=$(NAME)-$(VERSION3DOT) -endif +SDIST_TAR_NAME=$(NAME)-$(VERSION) +WHEEL_NAME=$(NAME)-$(VERSION) SDIST_COMMAND ?= sdist WHEEL_COMMAND ?= bdist_wheel @@ -110,7 +96,6 @@ clean: clean-ui clean-dist rm -rf requirements/vendor rm -rf tmp rm -rf $(I18N_FLAG_FILE) - rm -f VERSION mkdir tmp rm -rf build $(NAME)-$(VERSION) *.egg-info find . -type f -regex ".*\.py[co]$$" -delete @@ -624,5 +609,4 @@ psql-container: docker run -it --net tools_default --rm postgres:9.6 sh -c 'exec psql -h "postgres" -p "5432" -U postgres' VERSION: - @echo $(VERSION_TARGET) > $@ - @echo "awx: $(VERSION_TARGET)" + @echo "awx: $(VERSION)" diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000..227cea2156 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.0.0 diff --git a/installer/roles/image_build/tasks/main.yml b/installer/roles/image_build/tasks/main.yml index c8b1d7d628..93fd436b6a 100644 --- a/installer/roles/image_build/tasks/main.yml +++ b/installer/roles/image_build/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Get Version from checkout if not provided - shell: "git describe --long --first-parent | sed 's/\\-g.*//' | sed 's/\\-/\\./'" + shell: "{{ lookup('file', playbook_dir + '/../VERSION') }}" delegate_to: localhost register: awx_version_command when: awx_version is not defined diff --git a/setup.py b/setup.py index 51c992e5e0..fadc6eb94c 100755 --- a/setup.py +++ b/setup.py @@ -22,13 +22,8 @@ docdir = "/usr/share/doc/awx" def get_version(): current_dir = os.path.dirname(os.path.abspath(__file__)) version_file = os.path.join(current_dir, 'VERSION') - if os.path.isfile(version_file): - with open(version_file, 'r') as file: - version = file.read().strip() - else: - version = subprocess.Popen("git describe --long | cut -d - -f 1-1", shell=True, stdout=subprocess.PIPE).stdout.read().strip() - return version - + with open(version_file, 'r') as file: + return file.read().strip() if os.path.exists("/etc/debian_version"): sysinit = "/etc/init.d"