From 1a258f41d55ac91e215b59225ae523d9c58f2979 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 24 Jan 2017 16:24:39 -0800 Subject: [PATCH] Clone zuul into workspace in gate-zuul-nodepool In order to use the run-tox macro, we need zuul to be in the job workspace. Change-Id: I59881626625b36d5f93a38277e8aa07cf2e27800 --- jenkins/jobs/infra.yaml | 4 ++-- jenkins/jobs/macros.yaml | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/jenkins/jobs/infra.yaml b/jenkins/jobs/infra.yaml index 0e6a3bf450..0cca63f19f 100644 --- a/jenkins/jobs/infra.yaml +++ b/jenkins/jobs/infra.yaml @@ -447,9 +447,9 @@ node: ubuntu-xenial builders: - - zuul-clone: + - zuul-clone-workspace: project: openstack-infra/zuul - - shell: openstack-infra/zuul/tools/nodepool-integration-setup.sh + - shell: tools/nodepool-integration-setup.sh - run-tox: envlist: 'nodepool' diff --git a/jenkins/jobs/macros.yaml b/jenkins/jobs/macros.yaml index 550fa15cc7..82d4eee651 100644 --- a/jenkins/jobs/macros.yaml +++ b/jenkins/jobs/macros.yaml @@ -321,6 +321,33 @@ /usr/zuul-env/bin/zuul-cloner --cache-dir /opt/git \ git://git.openstack.org {project} +- builder: + name: zuul-clone-workspace + builders: + - shell: | + #!/bin/bash -xe + CLONEMAP=`mktemp` + function cleanup {{ + # In cases where zuul-cloner is aborted during a git + # clone operation, git will remove the git work tree in + # its cleanup. The work tree in these jobs is the + # workspace directory, which means that subsequent + # jenkins post-build actions can not run because the + # workspace has been removed. + # To reduce the likelyhood of this having an impact, + # recreate the workspace directory if needed + mkdir -p $WORKSPACE + rm -f $CLONEMAP + }} + trap cleanup EXIT + cat > $CLONEMAP << EOF + clonemap: + - name: {project} + dest: . + EOF + /usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \ + git://git.openstack.org {project} + - builder: name: revoke-sudo builders: