Skip to content

Commit

Permalink
Gather install logs in deployment-test if package fails to install
Browse files Browse the repository at this point in the history
Ticket: ENT-10989
Changelog: none
  • Loading branch information
craigcomstock committed Dec 6, 2023
1 parent 15bbe76 commit 3aa6932
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions ci/deployment-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,28 @@ COMPUTED_ROOT="$(readlink -e "$(dirname "$0")/../../")"
NTECH_ROOT=${NTECH_ROOT:-$COMPUTED_ROOT}
USER=${USER:-$(whoami)}

if [ ! -d /var/cfengine ]; then
# ci and local buildscripts should place built packages in $NTECH_ROOT/packages
sudo dpkg -i "$NTECH_ROOT"/packages/cfengine-nova-hub*deb
fi
# prepare artifacts dir
sudo mkdir -p "${NTECH_ROOT}/artifacts"
sudo chown "$USER" "${NTECH_ROOT}/artifacts"

# now that cfengine is probably installed, run cf-support if there is an error
trap failure ERR

function failure() {
sudo mkdir -p "${NTECH_ROOT}/artifacts"
sudo chown "$USER" "${NTECH_ROOT}/artifacts"
cd "${NTECH_ROOT}/artifacts"
sudo cf-support --yes > $$.cfsupportlog 2>&1 || cat $$.cfsupportlog
if command cf-support; then
sudo cf-support --yes > $$.cfsupportlog 2>&1 || cat $$.cfsupportlog
else
cp /var/log/CFEngine-Install* . # ${NTECH_ROOT}/artifacts cd previously
fi
rm $$.cfsupportlog
}

if [ ! -d /var/cfengine ]; then
# ci and local buildscripts should place built packages in $NTECH_ROOT/packages
sudo dpkg -i "$NTECH_ROOT"/packages/cfengine-nova-hub*deb
fi



AGENT_LOG="${NTECH_ROOT}/artifacts/agent.log"
if [ -f "$AGENT_LOG" ]; then
mv "$AGENT_LOG" "${AGENT_LOG}.$(date +%s)"
Expand Down

0 comments on commit 3aa6932

Please sign in to comment.