jjb/ansible: Add support for building SLES images
[lttng-ci.git] / pipelines / images / imagebuild.sh
index 340f71c744dbc3323fe75e9ce0a39f470f4523f0..8d164ae432c29df9eb2d34ef61fef3388a90bcf2 100644 (file)
@@ -49,7 +49,7 @@ if [[ ! "${MISSING_VARS}" == "0" ]] ; then
 fi
 
 # Default optional variables
-INSTANCE_START_TIMEOUT="${INSTANCE_START_TIMEOUT:-30}"
+INSTANCE_START_TIMEOUT="${INSTANCE_START_TIMEOUT:-60}"
 NETWORK_SLEEP="${NETWORK_SLEEP:-15}"
 
 # Dependencies
@@ -91,7 +91,7 @@ set +e
 TRIES_MAX=3
 TRIES=0
 while [[ "${TRIES}" -lt "${TRIES_MAX}" ]] ; do
-    if ! INSTANCE_NAME=$(lxc -q launch -e "${VM_ARG[@]}" -p default -p "${LXD_INSTANCE_PROFILE}" "${SOURCE_IMAGE_NAME}") ; then
+    if ! INSTANCE_NAME=$(lxc -q launch -e "${VM_ARG[@]}" -p default -p "${LXD_INSTANCE_PROFILE}" "${SOURCE_IMAGE_NAME}/${IMAGE_TYPE}") ; then
         # Try from images
         if ! INSTANCE_NAME=$(lxc -q launch -e "${VM_ARG[@]}" -p default -p "${LXD_INSTANCE_PROFILE}" images:"${SOURCE_IMAGE_NAME}") ; then
             TRIES=$((TRIES + 1))
@@ -189,11 +189,9 @@ LANG=C ANSIBLE_STRATEGY=linear ansible-playbook site.yml \
     -l "${INSTANCE_IP}" -i fake-inventory
 
 # Cleanup instance side
-# @TODO: Distro switch for apt/dnf/yum/etc.
-lxc exec "${INSTANCE_NAME}" -- apt-get clean
-lxc exec "${INSTANCE_NAME}" -- rm -rf /root/.ssh/authorized_keys2
-lxc exec "${INSTANCE_NAME}" -- cloud-init clean
-lxc exec "${INSTANCE_NAME}" -- bash -c 'history -cw'
+LANG=C ANSIBLE_STRATEGY=linear ansible-playbook \
+       playbooks/post-imagebuild-clean.yml \
+       -l "${INSTANCE_IP}" -i fake-inventory
 
 # Publish
 lxc publish "${INSTANCE_NAME}" --alias "${TARGET_IMAGE_NAME}" -f
This page took 0.022251 seconds and 4 git commands to generate.