From cb83b4f9b0c96e9d94dbb1aef7cb87bdbbf90650 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 26 Apr 2019 10:40:07 -0500 Subject: [PATCH] Add playbook to pull remote repositories Set the stx_remote_repo, stx_remote_branch and stx_remote_dest variables to pull directly from the source repo to test. Change-Id: I6d5bb56c71c38c4274532c258a1682e578cedf10 Signed-off-by: Dean Troyer --- .zuul.yaml | 16 ++++++++++++++++ README.rst | 2 +- playbooks/fetch-remote-repo/pre.yaml | 23 +++++++++++++++++++++++ tox.ini | 14 ++------------ 4 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 playbooks/fetch-remote-repo/pre.yaml diff --git a/.zuul.yaml b/.zuul.yaml index e7c200a..c8e68a8 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,3 +1,19 @@ - project: templates: - noop-jobs + check: + jobs: + - stx-github-debug: + vars: + stx_remote_repo: https://github.com/starlingx-staging/tools-contrib.git + stx_remote_branch: master + +- job: + name: stx-github-debug + parent: tox + vars: + stx_remote_repo: https://github.com/starlingx-staging/tools.contrib.git + stx_remote_branch: master + stx_repo_dest: src/test-repo + tox_envlist: debug + pre-run: playbooks/fetch-remote-repo/pre.yaml diff --git a/README.rst b/README.rst index 048f8b9..205fb2d 100644 --- a/README.rst +++ b/README.rst @@ -4,4 +4,4 @@ tis-repo StarlingX Test In Staging -This repo contains test jobs for OpenDev Zuul that pull from starlingx-staging. +This repo contains test jobs for OpenDev Zuul that pull from remote repositores such as github.com. diff --git a/playbooks/fetch-remote-repo/pre.yaml b/playbooks/fetch-remote-repo/pre.yaml new file mode 100644 index 0000000..2bf97e3 --- /dev/null +++ b/playbooks/fetch-remote-repo/pre.yaml @@ -0,0 +1,23 @@ +# stx_repo_dest - Destination directory (relative to Zuul root) +# stx_remote_repo - URL for the repo to pull +# stx_remote_branch - Branch within repo to test + +- hosts: all + pre_tasks: + - name: Determine if repo directory exists already + stat: + path: "{{ stx_repo_dest }}" + register: stx_repo_exists + + - debug: + msg: "Cloning {{ stx_remote_repo }} branch {{ stx_remote_branch }}" + when: stx_repo_exists.stat.isdir is undefined + + - name: Clone remote repo + git: + # repo: https://github.com/starlingx-staging/stx-nova.git + # version: stx/stein.1 + repo: "{{ stx_remote_repo }}" + version: "{{ stx_remote_branch }}" + dest: "{{ stx_repo_dest }}" + when: stx_repo_exists.stat.isdir is undefined diff --git a/tox.ini b/tox.ini index 25c5388..2482104 100644 --- a/tox.ini +++ b/tox.ini @@ -22,15 +22,5 @@ setenv = [testenv:debug] envdir = {toxworkdir}/shared commands = - bash -c "pwd; cd ../../../stx-nova; git branch" - ls -l ../../../stx-nova - -[testenv:pep8] -envdir = {toxworkdir}/shared -commands = - bash -c "echo placeholder env: pep8" - -[testenv:functional] -envdir = {toxworkdir}/shared -commands = - bash -c "echo placeholder env: functional" + bash -c "pwd; cd ../../../test-repo; git branch" + ls -l ../../../test-repo