aboutsummaryrefslogtreecommitdiffstats
path: root/jjb/common/include-agl-run-test-short.sh
diff options
context:
space:
mode:
authorJan-Simon Möller <jsmoeller@linuxfoundation.org>2017-01-25 23:30:06 +0100
committerJan-Simon Möller <jsmoeller@linuxfoundation.org>2017-01-25 23:41:56 +0100
commiteefb922b660fc02c16bb0289af53d7339f95dd88 (patch)
tree64792963095c416d0a9b691f8c4e11cdaee1cda3 /jjb/common/include-agl-run-test-short.sh
parentc7afa2e9eb426b05fe178a3c6935d620830efb6b (diff)
Add new ci jobs using multijob and control slave.
Change-Id: I4cbfe33ec05b4de1558834a902fe7b55bea4c31e Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'jjb/common/include-agl-run-test-short.sh')
-rw-r--r--jjb/common/include-agl-run-test-short.sh128
1 files changed, 128 insertions, 0 deletions
diff --git a/jjb/common/include-agl-run-test-short.sh b/jjb/common/include-agl-run-test-short.sh
new file mode 100644
index 00000000..0e382727
--- /dev/null
+++ b/jjb/common/include-agl-run-test-short.sh
@@ -0,0 +1,128 @@
+# (c) 2016 Jan-Simon Moeller dl9pf(at)gmx.de
+# License GPLv2
+
+################################################################################
+## Run SHORT CI test
+################################################################################
+
+
+set -x
+
+echo "## ${MACHINE} ##"
+cd $REPODIR
+
+echo "default keyring config"
+mkdir -p ~/.local/share/python_keyring/
+cat <<EOF > ~/.local/share/python_keyring/keyringrc.cfg
+[backend]
+default-keyring=keyring.backends.file.PlaintextKeyring
+EOF
+
+cat <<EOF > ~/.local/token
+$AGLLAVATOKEN
+EOF
+
+lava-tool auth-add --token-file ~/.local/token https://agl-jenkins-user@porter.automotivelinux.org
+rm ~/.local/token
+
+echo "## $TESTJOBFILE ##"
+
+if [ -n $TESTJOBFILE -a -e $TESTJOBFILE ] ; then
+ cp $TESTJOBFILE testjob.yaml
+else
+echo "!! NO TESTJOBFILE - trying to continue with a default !!"
+fi
+
+cat <<EOF > testjob.yaml
+# Your first LAVA JOB definition for a $MACHINE board
+device_type: @REPLACE_DEVICE_TYPE@
+job_name: AGL-short-smoke
+
+protocols:
+ lava-xnbd:
+ port: auto
+
+timeouts:
+ job:
+ minutes: 30
+ action:
+ minutes: 15
+ connection:
+ minutes: 5
+priority: medium
+visibility: public
+
+# ACTION_BLOCK
+actions:
+- deploy:
+ timeout:
+ minutes: 10
+ to: nbd
+ dtb:
+ url: '@REPLACE_URL_PREFIX@/@REPLACE_DTB@'
+ kernel:
+ url: '@REPLACE_URL_PREFIX@/@REPLACE_KERNEL@'
+ initramfs:
+ url: '@REPLACE_URL_PREFIX@/@REPLACE_INITRAMFS@'
+ allow_modify: false
+ nbdroot:
+ url: '@REPLACE_URL_PREFIX@/@REPLACE_NBDROOT@'
+ compression: @REPLACE_NBDROOT_COMPRESSION@
+ os: debian
+ failure_retry: 2
+
+# BOOT_BLOCK
+- boot:
+ method: @REPLACE_BOOT_METHOD@
+ commands: nbd
+ type: @REPLACE_BOOT_TYPE@
+ prompts: ["root@@REPLACE_MACHINE@:~"]
+ auto_login:
+ login_prompt: "login:"
+ username: root
+
+EOF
+
+CHID=${GERRIT_CHANGE_NUMBER}/${GERRIT_PATCHSET_NUMBER}/${MACHINE}
+# REPLACE_DEVICE_TYPE
+sed -i -e "s#@REPLACE_DEVICE_TYPE@#${DEVICE_TYPE}#g" testjob.yaml
+sed -i -e "s#@REPLACE_DTB@#${CHID}/${DEVICE_DTB}#g" testjob.yaml
+sed -i -e "s#@REPLACE_KERNEL@#${CHID}/${DEVICE_KERNEL}#g" testjob.yaml
+sed -i -e "s#@REPLACE_INITRAMFS@#${CHID}/${DEVICE_INITRAMFS}#g" testjob.yaml
+sed -i -e "s#@REPLACE_NBDROOT@#${CHID}/${DEVICE_NBDROOT}#g" testjob.yaml
+sed -i -e "s#@REPLACE_NBDROOT_COMPRESSION@#${DEVICE_NBDROOT_COMPRESSION}#g" testjob.yaml
+sed -i -e "s#@REPLACE_BOOT_METHOD@#${DEVICE_BOOT_METHOD}#g" testjob.yaml
+sed -i -e "s#@REPLACE_BOOT_TYPE@#${DEVICE_BOOT_TYPE}#g" testjob.yaml
+sed -i -e "s#@REPLACE_MACHINE@#${DEVICE_NAME}#g" testjob.yaml
+sed -i -e "s#@REPLACE_URL_PREFIX@#${DEVICE_URL_PREFIX}#g" testjob.yaml
+
+cat testjob.yaml
+
+lava-tool submit-job --block https://agl-jenkins-user@porter.automotivelinux.org testjob.yaml | tee .myjob
+
+MYJOB=`cat .myjob | grep "submitted as job" | sed -e "s#submitted as job id: ##g"`
+
+echo "#### JOBID: $MYJOB #####"
+
+( lava-tool job-status https://agl-jenkins-user@porter.automotivelinux.org $MYJOB | tee .status ) || true
+STATUS=`grep "Job Status:" .status | sed -e "s#Job Status: ##g"`
+
+if [ x"Complete" = x"$STATUS" ] ; then
+ echo "YAY! $STATUS"
+ curl -o plain_output.yaml https://porter.automotivelinux.org/scheduler/job/$MYJOB/log_file/plain
+ cat plain_output.yaml | grep '"target",' | sed -e 's#- {"dt".*"lvl".*"msg":."##g' -e 's#"}$##g'
+
+ # cleanup
+ #ssh -o StrictHostKeyChecking=no jenkins-slave@10.30.72.8 rm -rf /srv/download/AGL/upload/ci/${CHID}/
+
+ exit 0
+else
+ echo "Nooooooooo! $STATUS"
+ curl -o plain_output.yaml https://porter.automotivelinux.org/scheduler/job/$MYJOB/log_file/plain
+ cat plain_output.yaml | grep '"target",' | sed -e 's#- {"dt".*"lvl".*"msg":."##g' -e 's#"}$##g'
+
+ # cleanup
+ #ssh -o StrictHostKeyChecking=no jenkins-slave@10.30.72.8 rm -rf /srv/download/AGL/upload/ci/${CHID}/
+
+ exit 1
+fi