#!/bin/bash -ex LOGDIR=/home/zuul/zuul-output/logs # Set to indiciate an error return RETURN=0 FAILURE_REASON="" if [[ ${NODEPOOL_FUNCTIONAL_CHECK:-} == "installed" ]]; then NODEPOOL_INSTALL=${NODEPOOL_INSTALL:-~/.venv} NODEPOOL_CONFIG=${NODEPOOL_CONFIG:-/etc/nodepool/nodepool.yaml} NODEPOOL="$NODEPOOL_INSTALL/bin/nodepool -c $NODEPOOL_CONFIG" elif [[ ${NODEPOOL_FUNCTIONAL_CHECK:-} == "containers" ]]; then NODEPOOL="sudo podman exec nodepool_nodepool-launcher_1 nodepool" else echo "Running in unknown environment!" exit 1 fi cat > /tmp/ssh_wrapper < ${LOGDIR}/nodepool-image-list.txt $NODEPOOL list --detail > ${LOGDIR}/nodepool-list.txt builds=$(ls -l /var/log/nodepool/builds/ | grep $name | wc -l) if [[ ${builds} -ge 4 ]]; then echo "*** Build of $name failed at least 3 times, aborting" exit 1 fi sleep 10 done } function waitfornode { name=$1 state='ready' while ! $NODEPOOL list | grep $name | grep $state | grep "unlocked"; do $NODEPOOL image-list > ${LOGDIR}/nodepool-image-list.txt $NODEPOOL list --detail > ${LOGDIR}/nodepool-list.txt sleep 10 done } # check that image built waitforimage test-image # check image was bootable waitfornode test-image # check ssh for root user sshintonode test-image # networkmanager check # TODO(jeblair): This should not run in all cases; in fact, most of # this checking should move into the dib repo #checknm test-image # userdata check set -o errexit # Show the built nodes $NODEPOOL list # Try to delete the nodes that were just built $NODEPOOL delete --now 0000000000 # show the deleted nodes (and their replacements may be building) $NODEPOOL list if [[ -n "${FAILURE_REASON}" ]]; then echo "${FAILURE_REASON}" fi exit $RETURN