From 041c1795db9249b423622b21191cb88d22594451 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Wed, 9 Jan 2019 18:08:14 +0100 Subject: [PATCH] Recover CI run detection in imagebuild The new zuul jobs use just /opt/stack instead of /opt/stack/new, breaking the constraints handling and using dependencies from source. This changes corrects it by accepting both directories. Change-Id: I8d6f8c99e1ab5f26e3537630d0f6086e02a2b1ec --- imagebuild/common/generate_upper_constraints.sh | 6 +++++- imagebuild/tinyipa/build-tinyipa.sh | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/imagebuild/common/generate_upper_constraints.sh b/imagebuild/common/generate_upper_constraints.sh index 6d36d3298..a3802936a 100755 --- a/imagebuild/common/generate_upper_constraints.sh +++ b/imagebuild/common/generate_upper_constraints.sh @@ -58,7 +58,11 @@ download_uc() { } copy_new_requirements_uc() { - copy "/opt/stack/new/requirements/upper-constraints.txt" "${DESTINATION}" + if [ -e "/opt/stack/new/requirements" ]; then + copy "/opt/stack/new/requirements/upper-constraints.txt" "${DESTINATION}" + elif [ -e "/opt/stack/requirements" ]; then + copy "/opt/stack/requirements/upper-constraints.txt" "${DESTINATION}" + fi } download_from_tox_ini_url() { diff --git a/imagebuild/tinyipa/build-tinyipa.sh b/imagebuild/tinyipa/build-tinyipa.sh index 085eef23e..7d1ebd401 100755 --- a/imagebuild/tinyipa/build-tinyipa.sh +++ b/imagebuild/tinyipa/build-tinyipa.sh @@ -104,12 +104,20 @@ sudo mount --bind /proc $BUILDDIR/proc sudo mount --bind /dev/pts $BUILDDIR/dev/pts if [ -d /opt/stack/new ]; then + CI_DIR=/opt/stack/new +elif [ -d /opt/stack ]; then + CI_DIR=/opt/stack +else + CI_DIR= +fi + +if [ -n "$CI_DIR" ]; then # Running in CI environment, make checkouts available - $CHROOT_CMD mkdir -p /opt/stack/new - for project in $(ls /opt/stack/new); do + $CHROOT_CMD mkdir -p $CI_DIR + for project in $(ls $CI_DIR); do if grep -q "$project" $BUILDDIR/tmp/upper-constraints.txt && - [ -d "/opt/stack/new/$project/.git" ]; then - sudo cp -R "/opt/stack/new/$project" $BUILDDIR/opt/stack/new/ + [ -d "$CI_DIR/$project/.git" ]; then + sudo cp -R "$CI_DIR/$project" $BUILDDIR/$CI_DIR/ fi done fi