From 287ee0215249a069f2925760ada959cf095c9c16 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 13 Sep 2017 17:25:46 -0600 Subject: [PATCH] Add xstatic-check-version and xstatic-publish-to-pypi These are needed by xstatic jobs for migration. Change-Id: I01bfd5f255b400e4fb575f31fecffbe7a254d621 --- playbooks/xstatic/check-version.yaml | 26 +++++++++++++ playbooks/xstatic/xstatic_check_version.py | 39 +++++++++++++++++++ zuul.yaml | 44 +++++++++++++++++++++- 3 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 playbooks/xstatic/check-version.yaml create mode 100755 playbooks/xstatic/xstatic_check_version.py diff --git a/playbooks/xstatic/check-version.yaml b/playbooks/xstatic/check-version.yaml new file mode 100644 index 00000000..fd217dd1 --- /dev/null +++ b/playbooks/xstatic/check-version.yaml @@ -0,0 +1,26 @@ +- hosts: all + tasks: + - name: Copy version check script + copy: + src: xstatic_check_version.py + dest: xstatic_check_version.py + + - name: Make virtualenv + command: virtualenv .venv + + - name: Print pip version + command: .venv/bin/pip --version + + - name: Install setuptools_scm + command: .venv/bin/pip install setuptools_scm + + - name: Check version match + command: .venv/bin/python xstatic_check_version.py + + - name: Clean up after ourselves + file: + path: "{{ item }}" + state: absent + with_items: + - xstatic_check_version.py + - .venv diff --git a/playbooks/xstatic/xstatic_check_version.py b/playbooks/xstatic/xstatic_check_version.py new file mode 100755 index 00000000..d5fedaa9 --- /dev/null +++ b/playbooks/xstatic/xstatic_check_version.py @@ -0,0 +1,39 @@ +#! /usr/bin/env python +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import importlib +import os +import sys + +from setuptools_scm import get_version + +# add the xstatic repos checkout to the PYTHONPATH so we can +# import its contents +sys.path.append(os.getcwd()) + +xs = None +for name in os.listdir('xstatic/pkg'): + if os.path.isdir('xstatic/pkg/' + name): + if xs is not None: + sys.exit('More than one xstatic.pkg package found.') + xs = importlib.import_module('xstatic.pkg.' + name) + +if xs is None: + sys.exit('No xstatic.pkg package found.') + +git_version = get_version() +if git_version != xs.PACKAGE_VERSION: + sys.exit( + 'git tag version ({}) does not match package version ({})'.format( + git_version, xs.PACKAGE_VERSION)) diff --git a/zuul.yaml b/zuul.yaml index d702a7d8..96eab47b 100644 --- a/zuul.yaml +++ b/zuul.yaml @@ -204,6 +204,12 @@ required-projects: - openstack-infra/release-tools +- job: + name: xstatic-check-version + description: + Check version used by xstatic packages + run: playbooks/xstatic/check-version + - nodeset: name: centos-7 nodes: @@ -343,14 +349,48 @@ - announce-release: dependencies: - release-openstack-python - - propose-update-constraints + - propose-update-constraints: + dependencies: + - release-openstack-python release: jobs: - release-openstack-python - announce-release: dependencies: - release-openstack-python - - propose-update-constraints + - propose-update-constraints: + dependencies: + - release-openstack-python + +- project-template: + name: publish-xstatic-to-pypi + description: | + Publish an XStatic Python package to PyPI, then send release announcement + emails and propose updates to upper-constraints as needed. + pre-release: + jobs: + - xstatic-check-version + - release-openstack-python: + dependencies: + - xstatic-check-version + - announce-release: + dependencies: + - release-openstack-python + - propose-update-constraints: + dependencies: + - release-openstack-python + release: + jobs: + - xstatic-check-version + - release-openstack-python: + dependencies: + - xstatic-check-version + - announce-release: + dependencies: + - release-openstack-python + - propose-update-constraints: + dependencies: + - release-openstack-python - project-template: name: publish-to-pypi-quietly