Terraform: Add job name as VPC ID
[csit.git] / resources / libraries / bash / function / common.sh
index ce0c526..e56799e 100644 (file)
@@ -606,6 +606,7 @@ function prepare_topology () {
     # Prepare virtual testbed topology if needed based on flavor.
 
     # Variables read:
+    # - TEST_CODE - String affecting test selection, usually jenkins job name.
     # - NODENESS - Node multiplicity of testbed, either "2n" or "3n".
     # - FLAVOR - Node flavor string, e.g. "clx" or "skx".
     # Functions called:
@@ -618,10 +619,12 @@ function prepare_topology () {
     case_text="${NODENESS}_${FLAVOR}"
     case "${case_text}" in
         "2n_aws")
+            export TF_VAR_testbed_name="${TEST_CODE}"
             terraform_init || die "Failed to call terraform init."
             terraform_apply || die "Failed to call terraform apply."
             ;;
         "3n_aws")
+            export TF_VAR_testbed_name="${TEST_CODE}"
             terraform_init || die "Failed to call terraform init."
             terraform_apply || die "Failed to call terraform apply."
             ;;
@@ -864,7 +867,7 @@ function select_tags () {
     tfd="${JOB_SPECS_DIR}"
     case "${TEST_CODE}" in
         # Select specific performance tests based on jenkins job type variable.
-        *"vpp-device"* )
+        *"device"* )
             readarray -t test_tag_array <<< $(grep -v "#" \
                 ${tfd}/vpp_device/${DUT}-${NODENESS}-${FLAVOR}.md |
                 awk {"$awk_nics_sub_cmd"} || echo "devicetest") || die
@@ -982,12 +985,14 @@ function select_tags () {
 
     set +x
     if [[ "${TEST_CODE}" == "vpp-"* ]]; then
-        # Automatic prefixing for VPP jobs to limit the NIC used and
-        # traffic evaluation to MRR.
-        if [[ "${TEST_TAG_STRING-}" == *"nic_"* ]]; then
-            prefix="${prefix}mrrAND"
-        else
-            prefix="${prefix}mrrAND${default_nic}AND"
+        if [[ "${TEST_CODE}" != *"device"* ]]; then
+            # Automatic prefixing for VPP perf jobs to limit the NIC used and
+            # traffic evaluation to MRR.
+            if [[ "${TEST_TAG_STRING-}" == *"nic_"* ]]; then
+                prefix="${prefix}mrrAND"
+            else
+                prefix="${prefix}mrrAND${default_nic}AND"
+            fi
         fi
     fi
     for tag in "${test_tag_array[@]}"; do