Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / shell / rtd-verify.sh
index 61c1974..2894122 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -l
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2017 The Linux Foundation and others.
@@ -16,11 +16,34 @@ set -xe -o pipefail
 
 echo "---> Fetching project"
 if [ "$GERRIT_PROJECT" != "$PROJECT" ]; then
+    # Only test projects that are a submodule of docs
+    if ! git submodule | grep "$GERRIT_PROJECT"; then
+        echo "WARN: Project is not a submodule of docs. This likely means " \
+            "the project is not participating in the monolithic docs build " \
+            "and should have their own verify job. Quitting job run..."
+        exit 0
+    fi
+
     cd "docs/submodules/$GERRIT_PROJECT"
 fi
 
 git fetch origin "$GERRIT_REFSPEC" && git checkout FETCH_HEAD
-git submodule update
+git submodule update --init --recursive
+for submod in $(git config -f .gitmodules --get-regexp '^submodule\.(.+)\.url' | awk -e '{print $1}'); do
+    git config --get "$submod"
+done
+
+
+# shellcheck disable=SC1090
+. ~/lf-env.sh
+
+lf-activate-venv --venv-file /tmp/.toxenv tox virtualenv
+
+# When a new commands are added in lftools, the docs verify job needs to
+# run the new command which requires installing the lftools dev version
+if [[ $JOB_NAME == "lf-infra-lftools-rtd-verify-any" ]]; then
+    pip install -e .
+fi
 
 echo "---> Generating docs"
 cd "$WORKSPACE"