Fix: Update lf-activate-venv 98/102298/8
authorAnil Belur <abelur@linuxfoundation.org>
Tue, 6 Sep 2022 21:42:45 +0000 (07:42 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 14 Sep 2022 01:44:03 +0000 (11:44 +1000)
Add lf-activate-venv to install lftools, OS deps before
using the CLI. This sets the required environment.

The change requires the releng/global-jjb CR: 70597
and a updated release of global-jjb.

Change-Id: Ic3efbdec3574bec17add3910785af1e503298965
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
jjb/integration/copy-common-functions.sh
jjb/integration/integration-get-slave-addresses.sh
jjb/opendaylight-infra-copy-ssh-keys.sh
jjb/opendaylight-infra-deploy-maven-site.sh
jjb/opendaylight-infra-stack.sh
jjb/opendaylight-infra-update-image-list.sh
jjb/packaging/openstack-k8s-cluster-delete.sh
jjb/packaging/openstack-k8s-config-export.sh
jjb/packaging/openstack-k8s-create-with-template.sh

index 1ff42d0910536b544f3bb6e2f763f46e659c96f0..660dbacaf6a3dc1eb174dae20e358d2f4d96bb0a 100644 (file)
@@ -7,7 +7,14 @@
 # script is executing rather than being sourced. When executed the condition
 # is true and copies the script. In the false path this copy below is skipped
 # and the sourcing continues so that the appended common-function.sh ends up sourced.
-if [ "${BASH_SOURCE[0]}" == "${0}" ]; then
+if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
+    # shellcheck disable=SC1090
+    . ~/lf-env.sh
+
+    lf-activate-venv --python python3 \
+        python-heatclient \
+        python-openstackclient
+
     echo "Copying common-functions.sh to /tmp"
     cp "${0}" /tmp/common-functions.sh
 
index 2546d31f68c819b3315cf640a5d1749d03116286..98cd3db7b34038a182f2222752aad9157730587d 100644 (file)
@@ -1,4 +1,13 @@
 #!/bin/bash -l
+
+# shellcheck disable=SC1090
+. ~/lf-env.sh
+
+lf-activate-venv --python python3 \
+    python-heatclient \
+    python-openstackclient \
+    yq
+
 # Get the Controller and Tools VM slave addresses
 
 set -x
index d80d9d8c4e15bc78e47f5b6b04e78ce36b6607a9..c8aa145964b254a15462765c26e5138a861f2d9a 100644 (file)
@@ -44,21 +44,10 @@ function copy-ssh-keys-to-slave() {
 # shellcheck disable=SC1090
 . ~/lf-env.sh
 
-
-# Check if openstack venv was previously created
-if [ -f "/tmp/.os_lf_venv" ]; then
-    os_lf_venv=$(cat "/tmp/.os_lf_venv")
-fi
-
-if [ -d "${os_lf_venv}" ] && [ -f "${os_lf_venv}/bin/openstack" ]; then
-    echo "Re-use existing venv: ${os_lf_venv}"
-    PATH=$os_lf_venv/bin:$PATH
-else
-    lf-activate-venv --python python3 \
-        python-heatclient \
-        python-openstackclient \
-        yq
-fi
+lf-activate-venv --python python3 \
+    python-heatclient \
+    python-openstackclient \
+    yq
 
 # Print the Stack outputs parameters so that we can identify which IPs belong
 # to which VM types.
index 7563499018e5740d2f17745b1d6e7a3ab359f695..bf674187c6a2326811180010b3059d7100f6b283 100644 (file)
@@ -15,17 +15,7 @@ set -eu -o pipefail
 # shellcheck disable=SC1090
 . ~/lf-env.sh
 
-# Check if openstack venv was previously created
-if [ -f "/tmp/.os_lf_venv" ]; then
-    os_lf_venv=$(cat "/tmp/.os_lf_venv")
-fi
-
-if [ -d "${os_lf_venv}" ] && [ -f "${os_lf_venv}/bin/openstack" ]; then
-    echo "Re-use existing venv: ${os_lf_venv}"
-    PATH=$os_lf_venv/bin:$PATH
-else
-    lf-activate-venv --python python3 lftools
-fi
+lf-activate-venv --python python3 lftools
 
 MAVEN_GROUP_ID=$(xmlstarlet sel \
       -N "x=http://maven.apache.org/POM/4.0.0" \
index 58ad381747124e312a3684aa37b11c960d0c13b7..2a3e0cee5881477660daeab66e597321bcc54d88 100644 (file)
@@ -19,22 +19,12 @@ fi
 # shellcheck disable=SC1090
 . ~/lf-env.sh
 
-# Check if openstack venv was previously created
-if [ -f "/tmp/.os_lf_venv" ]; then
-    os_lf_venv=$(cat "/tmp/.os_lf_venv")
-fi
-
-if [ -d "${os_lf_venv}" ] && [ -f "${os_lf_venv}/bin/openstack" ]; then
-    echo "Re-use existing venv: ${os_lf_venv}"
-    PATH=$os_lf_venv/bin:$PATH
-else
-    lf-activate-venv --python python3 \
-        decorator \
-        python-heatclient \
-        python-openstackclient \
-        python-magnumclient \
-        yq
-fi
+lf-activate-venv --python python3 \
+    decorator \
+    python-heatclient \
+    python-openstackclient \
+    python-magnumclient \
+    yq
 
 JOB_SUM=$(echo "$JOB_NAME" | sum | awk '{{ print $1 }}')
 VM_NAME="$JOB_SUM-$BUILD_NUMBER"
index c7ac71731cd2ac10abf868a035c16e896a2ed03c..c7229278578f38739e5a39e3e6723a7323de9fbd 100644 (file)
@@ -14,17 +14,7 @@ set -e -o pipefail
 # shellcheck disable=SC1090
 . ~/lf-env.sh
 
-# Check if openstack venv was previously created
-if [ -f "/tmp/.os_lf_venv" ]; then
-    os_lf_venv=$(cat "/tmp/.os_lf_venv")
-fi
-
-if [ -d "${os_lf_venv}" ] && [ -f "${os_lf_venv}/bin/openstack" ]; then
-    echo "Re-use existing venv: ${os_lf_venv}"
-    PATH=$os_lf_venv/bin:$PATH
-else
-    lf-activate-venv --python python3 python-openstackclient
-fi
+lf-activate-venv --python python3 python-openstackclient
 
 cat > "$WORKSPACE/docs/cloud-images.rst" << EOF
 Following are the list of published images available to Jenkins jobs.
index a43a457e3fbde1d4cb76623efd14c36e3e0f0e19..d638f47d10207ca9661af010e80a4974ad898d08 100644 (file)
 echo "---> Delete K8S cluster"
 
 set -eux -o pipefail
+
 # shellcheck disable=SC1090
 . ~/lf-env.sh
 
+lf-activate-venv --python python3 \
+    kubernetes \
+    python-heatclient \
+    python-openstackclient \
+    yq
+
 os_cloud="${OS_CLOUD:-vex}"
 cluster_name="${CLUSTER_NAME}"
 
index 5f834c7abf4abc5fa72ada980605e6780fc2918c..4d7de8099109be3ecf457958c8c997aacae523fc 100644 (file)
@@ -15,6 +15,12 @@ set -eux -o pipefail
 # shellcheck disable=SC1090
 . ~/lf-env.sh
 
+lf-activate-venv --python python3 \
+    kubernetes \
+    python-heatclient \
+    python-openstackclient \
+    yq
+
 OS_TIMEOUT=5             # Wait time in minutes for OpenStack cluster nodes to come up.
 CLUSTER_NODE_RETRIES=15  # Number of times to retry waiting for a cluster nodes.
 CLUSTER_NODE_SUCCESSFUL=false
index 4adcf8f91c1dcd54f562ae2522128a18d85bcb19..50dd89a36bcd8f05fd6e81c1807ceef36f521683 100644 (file)
 echo "---> Create K8S cluster with pre-existing template"
 
 set -eux -o pipefail
+
 # shellcheck disable=SC1090
 . ~/lf-env.sh
-lf-activate-venv python-openstackclient python-magnumclient
+
+lf-activate-venv --python python3 \
+    python-heatclient \
+    python-openstackclient \
+    yq
 
 OS_TIMEOUT=20       # Wait time in minutes for OpenStack cluster to come up.
 CLUSTER_RETRIES=3   # Number of times to retry creating a cluster.