Get IPA buildimage POST job into healthcheck
This patch adds subunit output to the end of the buildimage job so that heathcheck will have information on success or failure of the job. This patch implements this using an exit trap, this is a temporary solution until Zuul can report the success/failure of jobs directly to healthcheck. This solution will only catch failures that occur during the actual image build process, any errors that occur inside the scp publisher's will not be detected by this change. Change-Id: Id26ed8f40cc659e065c598e2e7af760e8be42419
This commit is contained in:
parent
77dbe67b11
commit
51d4c78e8e
|
@ -30,6 +30,29 @@
|
|||
mkdir UPLOAD_RAW
|
||||
mkdir UPLOAD_TAR
|
||||
|
||||
JOBNAME={template-name}
|
||||
TRANS_START_TIME=$(date +%s)
|
||||
SUBUNIT_OUTPUT=testrepository.subunit
|
||||
ERRORS=1
|
||||
VENV=$(mktemp -d)
|
||||
virtualenv $VENV
|
||||
$VENV/bin/pip install -U os-testr
|
||||
|
||||
trap "finish" EXIT
|
||||
|
||||
function finish {{
|
||||
if [[ '$ERRORS' -eq 1 ]]; then
|
||||
$VENV/bin/generate-subunit $TRANS_START_TIME $SECONDS 'fail' $JOBNAME >> $SUBUNIT_OUTPUT
|
||||
else
|
||||
$VENV/bin/generate-subunit $TRANS_START_TIME $SECONDS 'success' $JOBNAME >> $SUBUNIT_OUTPUT
|
||||
fi
|
||||
gzip -9 $SUBUNIT_OUTPUT
|
||||
if [ "$VENV" != "" ] ; then
|
||||
rm -rf $VENV
|
||||
VENV=""
|
||||
fi
|
||||
}}
|
||||
|
||||
type="{image-type}"
|
||||
case $type in
|
||||
tinyipa)
|
||||
|
@ -47,6 +70,7 @@
|
|||
mv ipa-coreos*.tar.gz UPLOAD_TAR
|
||||
;;
|
||||
esac
|
||||
ERRORS=0
|
||||
|
||||
|
||||
publishers:
|
||||
|
@ -61,4 +85,11 @@
|
|||
target: 'tarballs/ironic-python-agent/{image-type}/'
|
||||
keep-hierarchy: false
|
||||
copy-after-failure: false
|
||||
- scp:
|
||||
site: 'static.openstack.org'
|
||||
files:
|
||||
- target: 'logs/$LOG_PATH'
|
||||
source: 'testrepository.subunit.gz'
|
||||
keep-hierarchy: false
|
||||
copy-after-failure: true
|
||||
- console-log
|
||||
|
|
Loading…
Reference in New Issue