jjb: Reduce output when downloading go during distrobuild
[lttng-ci.git] / pipelines / images / distrobuild.sh
index b5e624ff5b85da56ff6bf73b325b45916d5f236c..f02fd54935074c0ec117c97f2f601c94f1a11d9a 100644 (file)
@@ -52,7 +52,7 @@ if [[ ! "${MISSING_VARS}" == "0" ]] ; then
 fi
 
 # Optional variables
-INSTANCE_START_TIMEOUT="${INSTANCE_START_TIMEOUT:-30}"
+INSTANCE_START_TIMEOUT="${INSTANCE_START_TIMEOUT:-60}"
 VM_ARG=()
 
 # Install lxd-client
@@ -81,7 +81,7 @@ fi
 
 # Get go
 apt-get install -y wget
-wget "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O - | tar -C /usr/local -xzf -
+wget -q "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O - | tar -C /usr/local -xzf -
 export PATH="${PATH}:/usr/local/go/bin"
 
 # Install distrobuilder
@@ -111,6 +111,12 @@ EXTENSIONS=(
 )
 IMAGE_FILE=''
 for IMAGE_DIR in "${IMAGE_DIRS[@]}" ; do
+    for EXTENSION in "${EXTENSIONS[@]}" ; do
+        if [ -f "${IMAGE_DIR}/${OS}-${RELEASE}.${EXTENSION}" ] ; then
+            IMAGE_FILE="${IMAGE_DIR}/${OS}-${RELEASE}.${EXTENSION}"
+            break 2;
+        fi
+    done
     for EXTENSION in "${EXTENSIONS[@]}" ; do
         if [ -f "${IMAGE_DIR}/${OS}.${EXTENSION}" ] ; then
             IMAGE_FILE="${IMAGE_DIR}/${OS}.${EXTENSION}"
@@ -123,6 +129,16 @@ if [[ "${IMAGE_FILE}" == "" ]] ; then
     fail 1 "Unable to find image file for '${OS}' in ${IMAGE_DIRS[@]}"
 fi
 
+if grep -q -E 'XX[A-Za-z0-9_]+XX' "${IMAGE_FILE}" ; then
+    while read -r VAR ; do
+        echo "${VAR}"
+        SHELLVAR=$(echo "${VAR}" | sed 's/^XX//g' | sed 's/XX$//g')
+        set +x
+        sed -i "s/${VAR}/${!SHELLVAR:-VARIABLENOTFOUND}/g" "${IMAGE_FILE}"
+        set -x
+    done < <(grep -E -o 'XX[A-Za-z0-9_]+XX' "${IMAGE_FILE}")
+fi
+
 DISTROBUILDER_ARGS=(
     distrobuilder
     build-incus
@@ -175,6 +191,10 @@ if [[ "${ARCH}" == "i386" ]] ; then
     rm -rf "${TMP_DIR}"
 fi
 
+# When using `lxc image import` two images cannot have the same alias -
+# only the last image imported will keep the alias. Therefore, the
+# image type is appended as part of the alias.
+IMAGE_NAME="${IMAGE_NAME}/${IMAGE_TYPE}"
 lxc image import "${BUILD_DIR}/incus.tar.xz" "${ROOTFS}" --alias="${IMAGE_NAME}" ci:
 
 if [[ "${TEST}" == "true" ]] ; then
This page took 0.024942 seconds and 4 git commands to generate.