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
This commit is contained in:
Dmitry Tantsur 2019-01-09 18:08:14 +01:00
parent ea934658c3
commit 041c1795db
2 changed files with 17 additions and 5 deletions

View File

@ -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() {

View File

@ -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