Merge ~morphis/snappy-hwe-snaps/+git/build-scripts:feature/parallel-spread into ~snappy-hwe-team/snappy-hwe-snaps/+git/build-scripts:master

Proposed by Simon Fels
Status: Merged
Approved by: Jim Hodapp
Approved revision: 3f4f5f652e5f10f84f580c2db3c0d85b92b6a024
Merged at revision: 4894f2fd64470f4f78cecfbee2dc350fa0b9704c
Proposed branch: ~morphis/snappy-hwe-snaps/+git/build-scripts:feature/parallel-spread
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/build-scripts:master
Diff against target: 89 lines (+19/-21)
1 file modified
jobs/generic-run-snap-spread-tests (+19/-21)
Reviewer Review Type Date Requested Status
System Enablement Bot continuous-integration Approve
Jim Hodapp (community) Approve
Review via email: mp+316239@code.launchpad.net

Description of the change

Allow multiple spread jobs running in parallel by copying the spread binary into a job specific location.

To post a comment you must log in.
Revision history for this message
Jim Hodapp (jhodapp) wrote :

One question inline below.

review: Needs Information
Revision history for this message
Jim Hodapp (jhodapp) :
review: Approve
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/jobs/generic-run-snap-spread-tests b/jobs/generic-run-snap-spread-tests
2index ae9bd4d..5d3d025 100644
3--- a/jobs/generic-run-snap-spread-tests
4+++ b/jobs/generic-run-snap-spread-tests
5@@ -20,18 +20,11 @@ set -e
6 SSH_PATH="${JENKINS_HOME}/.ssh/"
7 SSH_KEY_PATH="${SSH_PATH}/bazaar.launchpad.net/system-enablement-ci-bot"
8
9-JENKINS_WORK_DIR=${JENKINS_HOME}/build
10-
11-if [ -e $JENKINS_WORK_DIR ] ; then
12- rm -rf $JENKINS_WORK_DIR
13- mkdir -p $JENKINS_WORK_DIR
14-fi
15-
16-cd $JENKINS_WORK_DIR
17-
18 SSH="ssh -i $SSH_KEY_PATH/id_rsa $REMOTE_USER@$REMOTE_WORKER"
19 SCP="scp -i $SSH_KEY_PATH/id_rsa"
20
21+REMOTE_WORKSPACE=/home/$REMOTE_USER/$BUILD_TAG
22+
23 # Do a quick check if tests are maybe disabled for the repository
24 # if not applicable.
25 tmpdir=`mktemp -d`
26@@ -41,7 +34,9 @@ if [ -e $tmpdir/src/.ci_tests_disabled ]; then
27 exit 0
28 fi
29
30-cat << EOF > build-spread.sh
31+$SSH mkdir -p $REMOTE_WORKSPACE/bin
32+
33+cat << EOF > $WORKSPACE/build-spread.sh
34 #!/bin/bash
35 set -x
36 set -e
37@@ -57,31 +52,32 @@ export DEBIAN_FRONTEND=noninteractive
38 export GOPATH=`mktemp -d`
39 go get -d -v github.com/snapcore/spread/...
40 go build github.com/snapcore/spread/cmd/spread
41-cp spread /usr/local/bin
42-which spread
43+cp spread $REMOTE_WORKSPACE/bin
44+# Remove old executables of spread
45+if [ -e /usr/local/bin/spread ]; then
46+ rm /usr/local/bin/spread
47+fi
48+PATH=$REMOTE_WORKSPACE/bin:$PATH which spread
49 rm -rf $GOPATH
50 EOF
51
52-# Make sure that we don't conflict with any other instances of this
53-# build job running at the same time.
54-if [ ! `lsof | grep spread$` ] ; then
55- $SCP build-spread.sh $REMOTE_USER@$REMOTE_WORKER:
56- $SSH chmod u+x build-spread.sh
57- $SSH sudo systemd-run --scope ./build-spread.sh
58-fi
59+$SCP $WORKSPACE/build-spread.sh $REMOTE_USER@$REMOTE_WORKER:
60+$SSH chmod u+x build-spread.sh
61+$SSH sudo systemd-run --scope ./build-spread.sh
62
63 if [ $($SSH snap list | grep ubuntu-image | wc -l) -eq 0 ] ; then
64 $SSH sudo snap install --edge --devmode ubuntu-image
65 fi
66 $SSH sudo apt install -y --force-yes kpartx qemu-kvm
67
68-cat << EOF > run-spread-tests.sh
69+cat << EOF > $WORKSPACE/run-spread-tests.sh
70 #!/bin/bash
71 set -x
72 set -e
73
74 export TERM=linux
75 export DEBIAN_FRONTEND=noninteractive
76+export PATH=$REMOTE_WORKSPACE/bin:$PATH
77
78 if [ -e "src_branch" ] ; then
79 rm -rf src_branch
80@@ -111,6 +107,8 @@ fi
81 rm -rf src_branch
82 EOF
83
84-$SCP run-spread-tests.sh $REMOTE_USER@$REMOTE_WORKER:
85+$SCP $WORKSPACE/run-spread-tests.sh $REMOTE_USER@$REMOTE_WORKER:
86 $SSH chmod u+x run-spread-tests.sh
87 $SSH sudo systemd-run --scope ./run-spread-tests.sh
88+
89+$SSH rm -rf $REMOTE_WORKSPACE

Subscribers

People subscribed via source and target branches

to all changes: