Added MOS 24.2: different bug fixes

List of changes:
- use fresh heat image as a base for toolset image
- added cacert secret for public endpoints at rally and toolset
- rally creates env with public endpoints
- fixed rally openstack dry-run scenario typo
- added setting ext gw info for heat-router in prepare.sh
- added label to set image tag in dockerfile

Related-PROD: PROD-37187

Change-Id: I83c91c8ab20f39087f7db7b32f67dd7b2130d5e7
diff --git a/scripts/prepare.sh b/scripts/prepare.sh
index b190f5b..cdf6b12 100644
--- a/scripts/prepare.sh
+++ b/scripts/prepare.sh
@@ -302,6 +302,7 @@
       echo "# Checking that the external network ${CUSTOM_PUBLIC_NET_NAME} is present on the cloud"
       network_exists=$(openstack network show "$CUSTOM_PUBLIC_NET_NAME" -c id -f value 2>/dev/null)
       if [ -n "$network_exists" ]; then
+        TEST_PUBLIC_NET=${CUSTOM_PUBLIC_NET_NAME}
         echo router set ${router} --external-gateway ${CUSTOM_PUBLIC_NET_NAME} >>${cmds}
         process_cmds
       else
@@ -313,9 +314,26 @@
       echo "# Selecting a random external network as an external gateway for the router"
       # if the custom network is not set or is empty, select the first external network
       external=$(openstack network list --external -c Name -f value | head -n1)
+      TEST_PUBLIC_NET=${external}
       echo router set ${router} --external-gateway ${external} >>${cmds}
       process_cmds
     fi
+
+    # set external gateway info for the Heat router if it is not set (required for Heat Tempest tests)
+    external_gateway_info=$(openstack router show heat-router -f json -c external_gateway_info | jq -r '.external_gateway_info')
+    if [[ "$external_gateway_info" == "null" ]]; then
+      echo "# Setting external gw info for heat-router using ${TEST_PUBLIC_NET}"
+      openstack router set --external-gateway ${TEST_PUBLIC_NET} heat-router
+      if [[ $? -eq 0 ]]; then
+        echo "# External gateway set successfully for heat-router"
+        openstack router show heat-router -c external_gateway_info
+      else
+        echo "# Failed to set external gateway for heat-router"
+      fi
+    else
+      echo "# Router heat-router already has an external gateway"
+      openstack router show heat-router -c external_gateway_info
+    fi
 }
 
 function _get_image() {