engine: Implement change dependency handling
[infra/cicd.git] / jjb / engine / scripts / deploy.sh
index d52bbfa5d8c748613be62577fa0f11acd679ad11..0302e776a54db534f8d2d24b9257af59022c0b3e 100755 (executable)
@@ -31,6 +31,14 @@ if [[ "$GERRIT_PROJECT" != "infra/engine" ]]; then
   cd "$WORKSPACE"
 fi
 
+# NOTE (fdegir): this variable is set by generate-change-metadata.sh script
+# if a dependency to engine repo is determined so we check out that refspec
+# to ensure we respect the dependency
+if [[ ! -z "${NORDIX_ENGINE_REFSPEC+x}" ]]; then
+  echo "Info  : Fetching dependent change ${NORDIX_ENGINE_REFSPEC} infra/engine"
+  git fetch "https://gerrit.nordix.org/infra/engine" ${NORDIX_ENGINE_REFSPEC} && git checkout FETCH_HEAD
+fi
+
 if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
   ENGINE_ROOT_DIR="/opt/engine/offline/git/engine"
 else
@@ -44,6 +52,10 @@ HEAT_ENVIRONMENT_FILENAME=${HEAT_ENVIRONMENT_FILENAME:-/tmp/heat}
 /bin/cp -f $OPENRC_FILE /tmp/openrc
 
 cd "$ENGINE_ROOT_DIR/engine"
-./deploy.sh -s "$STACK_TYPE" -b "$STACK_VERSION" -p "$PDF" -i "$IDF" -o /tmp/openrc -d "$DISTRO" -v
+./deploy.sh -s "$STACK_TYPE" -b "$STACK_VERSION" -c "$DEPLOY_SCENARIO" -p "$PDF" -i "$IDF" -o /tmp/openrc -d "$DISTRO" -v
+
+# NOTE (fdegir): we need inventory.ini for test execution
+/bin/rm -f /tmp/inventory.ini
+/bin/cp -f /opt/engine/.cache/config/inventory.ini /tmp/inventory.ini
 
 # vim: set ts=2 sw=2 expandtab: