From 86d5cec0b9749f25891a240843ff4c79413ec727 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Fri, 28 Dec 2018 12:45:14 +0000 Subject: [PATCH] Add in-place execution mode for reproducer Adds command line option and environment variable that allows user to run reproducer without wiping tq[e] repositories on each run. When specified it will just pull and rebase them when they already exist. This allows us to test effects of changes made to these repositories and re-run reproducer multiple times. Change-Id: I7b489d5fba0e1f5dd0d34fff48107440cbc93c00 --- .../templates/reproducer-quickstart.sh.j2 | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/roles/create-reproducer-script/templates/reproducer-quickstart.sh.j2 b/roles/create-reproducer-script/templates/reproducer-quickstart.sh.j2 index 62bfb2a8d..a069462ef 100644 --- a/roles/create-reproducer-script/templates/reproducer-quickstart.sh.j2 +++ b/roles/create-reproducer-script/templates/reproducer-quickstart.sh.j2 @@ -19,6 +19,7 @@ : ${NODES_FILE:="{{ nodes_config }}"} : ${ZUUL_CHANGES:="{{ zuul_changes }}"} : ${EXTRA_PARAMS:=""} +: ${IN_PLACE:=false} SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" @@ -29,6 +30,9 @@ usage () { echo " -w, --workspace " echo " directory where the virtualenv, inventory files, etc." echo " are created. Defaults to creating a directory in /tmp" + echo " -i, --in-place" + echo " Avoid wiping tq[e] repositories if they already exist" + echo " and just pull --rebase them. [IN_PLACE=true]" echo " -v, --create-virtualenv" echo " create a virtualenv to install Ansible and dependencies." echo " Options to pass true/false. Defaults to true for OVB. " @@ -82,6 +86,11 @@ while [ "x$1" != "x" ]; do shift ;; + --in-place|-i) + IN_PLACE=true + shift + ;; + --create-virtualenv|-v) CREATE_VIRTUALENV=$2 shift @@ -209,11 +218,20 @@ export ZUUL_CHANGES # Start from a clean workspace mkdir -p $WORKSPACE cd $WORKSPACE -rm -rf tripleo-quickstart tripleo-quickstart-extras +[ "$IN_PLACE" == "true" ] || \ + rm -rf tripleo-quickstart tripleo-quickstart-extras # Clone quickstart and quickstart-extras -git clone https://github.com/openstack/tripleo-quickstart -git clone https://github.com/openstack/tripleo-quickstart-extras +for REPO in tripleo-quickstart tripleo-quickstart-extras +do + if [ -d "$REPO" ]; then + pushd $REPO + git pull --rebase + popd + else + git clone https://github.com/openstack/$REPO + fi +done # Set up a virtual env if requested if [ "$CREATE_VIRTUALENV" = "true" ]; then