jjb: Allow cloud-init status to complete with an error for images
[lttng-ci.git] / pipelines / images / imagebuild.sh
index ecc192dae06bd0d3c166b2d20c2b8a91c51cabaf..1b36a0331f5d6290493742957d4089c1fe0f6c2d 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
@@ -132,7 +132,10 @@ done
 
 # Wait for cloud-init to finish
 if [[ "${VARIANT}" == "cloud" ]] ; then
-    lxc exec "${INSTANCE_NAME}" -- cloud-init status -w
+    # It's possible for cloud-init to fail, but to still be able to continue.
+    # Eg., a profile asks for netplan.io on a system that doesn't have that
+    # package available.
+    lxc exec "${INSTANCE_NAME}" -- cloud-init status -w || true
 fi
 
 # Wait for instance to have an ip address (@TODO: is there a better approach?)
@@ -189,11 +192,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.022766 seconds and 4 git commands to generate.