From 753655e91dc1071a64f711f25bc129dc2e9a88e0 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Fri, 19 Jan 2018 13:08:42 +0100 Subject: [PATCH] Convert legacy-tox-with-sudo-snap Convert legacy-tox-with-sudo-snap to Zuul v3 native job, update the template using it and move it to project-templates. Change-Id: Ib1350c60d0de2d41c2d1bc56ba2083068e70db76 --- playbooks/legacy/tox-with-sudo-snap/post.yaml | 67 ------------------ playbooks/legacy/tox-with-sudo-snap/run.yaml | 68 ------------------- zuul.d/jobs.yaml | 15 ++++ zuul.d/project-templates.yaml | 11 +++ zuul.d/zuul-legacy-jobs.yaml | 9 --- zuul.d/zuul-legacy-project-templates.yaml | 9 --- 6 files changed, 26 insertions(+), 153 deletions(-) delete mode 100644 playbooks/legacy/tox-with-sudo-snap/post.yaml delete mode 100644 playbooks/legacy/tox-with-sudo-snap/run.yaml diff --git a/playbooks/legacy/tox-with-sudo-snap/post.yaml b/playbooks/legacy/tox-with-sudo-snap/post.yaml deleted file mode 100644 index 68fbdf81..00000000 --- a/playbooks/legacy/tox-with-sudo-snap/post.yaml +++ /dev/null @@ -1,67 +0,0 @@ -- hosts: primary - tasks: - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=**/*nose_results.html - - --include=*/ - - --exclude=* - - --prune-empty-dirs - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=**/*testr_results.html.gz - - --include=*/ - - --exclude=* - - --prune-empty-dirs - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=/.testrepository/tmp* - - --include=*/ - - --exclude=* - - --prune-empty-dirs - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=**/*testrepository.subunit.gz - - --include=*/ - - --exclude=* - - --prune-empty-dirs - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}/tox' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=/.tox/*/log/* - - --include=*/ - - --exclude=* - - --prune-empty-dirs diff --git a/playbooks/legacy/tox-with-sudo-snap/run.yaml b/playbooks/legacy/tox-with-sudo-snap/run.yaml deleted file mode 100644 index 1d9136c5..00000000 --- a/playbooks/legacy/tox-with-sudo-snap/run.yaml +++ /dev/null @@ -1,68 +0,0 @@ -- hosts: all - name: Autoconverted job legacy-tox-with-sudo-snap from old job gate-{name}-tox-with-sudo-snap - tasks: - - - name: Ensure legacy workspace directory - file: - path: '{{ ansible_user_dir }}/workspace' - state: directory - - - shell: - cmd: | - set -e - set -x - CLONEMAP=`mktemp` - REQS_DIR=`mktemp -d` - function cleanup { - mkdir -p $WORKSPACE - rm -rf $CLONEMAP $REQS_DIR - } - trap cleanup EXIT - cat > $CLONEMAP << EOF - clonemap: - - name: $ZUUL_PROJECT - dest: . - EOF - # zuul cloner works poorly if there are 2 names that are the - # same in here. - if [[ "$ZUUL_PROJECT" != "openstack/requirements" ]]; then - cat >> $CLONEMAP << EOF - - name: openstack/requirements - dest: $REQS_DIR - EOF - fi - /usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \ - git://git.openstack.org $ZUUL_PROJECT openstack/requirements - # REQS_DIR is not set for openstack/requirements and there is also - # no need to copy in this case. - if [[ "$ZUUL_PROJECT" != "openstack/requirements" ]]; then - cp $REQS_DIR/upper-constraints.txt ./ - fi - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: /usr/local/jenkins/slave_scripts/install-distro-packages.sh - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: /usr/local/jenkins/slave_scripts/run-tox.sh snap - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - OUT=`git ls-files --other --exclude-standard --directory` - if [ -z "$OUT" ]; then - echo "No extra files created during test." - exit 0 - else - echo "The following un-ignored files were created during the test:" - echo "$OUT" - exit 0 # TODO: change to 1 to fail tests. - fi - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 3d86497d..82e18261 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -429,6 +429,21 @@ vars: tox_envlist: compare-cover +- job: + name: openstack-tox-snap-with-sudo + parent: openstack-tox-with-sudo + description: | + Run tox-based functional tests for an OpenStack Python project. + + Uses tox with the ``snap`` environment. + Sudo access is not revoked. + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ + - ^releasenotes/.*$ + vars: + tox_envlist: snap + - job: name: build-openstack-puppet-tarball description: | diff --git a/zuul.d/project-templates.yaml b/zuul.d/project-templates.yaml index 0f400a52..cf6721ad 100644 --- a/zuul.d/project-templates.yaml +++ b/zuul.d/project-templates.yaml @@ -839,3 +839,14 @@ post: jobs: - publish-openstack-python-branch-tarball + +- project-template: + name: snap-jobs + description: | + Run tests for snap repositories. + check: + jobs: + - openstack-tox-snap-with-sudo + gate: + jobs: + - openstack-tox-snap-with-sudo diff --git a/zuul.d/zuul-legacy-jobs.yaml b/zuul.d/zuul-legacy-jobs.yaml index 081fbe2a..b25c3a01 100644 --- a/zuul.d/zuul-legacy-jobs.yaml +++ b/zuul.d/zuul-legacy-jobs.yaml @@ -5114,15 +5114,6 @@ - openstack/devstack-plugin-zmq - openstack/tempest -- job: - name: legacy-tox-with-sudo-snap - parent: legacy-base - run: playbooks/legacy/tox-with-sudo-snap/run.yaml - post-run: playbooks/legacy/tox-with-sudo-snap/post.yaml - timeout: 2400 - required-projects: - - openstack/requirements - - job: name: legacy-tricircle-dsvm-functional parent: legacy-dsvm-base diff --git a/zuul.d/zuul-legacy-project-templates.yaml b/zuul.d/zuul-legacy-project-templates.yaml index f0b90ce6..9d1f6cfb 100644 --- a/zuul.d/zuul-legacy-project-templates.yaml +++ b/zuul.d/zuul-legacy-project-templates.yaml @@ -376,12 +376,3 @@ post: jobs: - publish-openstack-python-branch-tarball - -- project-template: - name: snap-jobs - check: - jobs: - - legacy-tox-with-sudo-snap - gate: - jobs: - - legacy-tox-with-sudo-snap