~verterok/ols-jenkaas/dd-siab-dependencies

« back to all changes in this revision

Viewing changes to project/run-tests

  • Committer: Vincent Ladeuil
  • Date: 2017-02-09 16:12:35 UTC
  • mfrom: (323.2.109 lander)
  • Revision ID: vila+ols@canonical.com-20170209161235-8igi05uo09s638fv
Unify lander with tests and jobs tags for validation without service interruption

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
VCS=$1
4
4
TRUNK=$2
5
5
VM=$3
6
 
WORKER="${VM}-worker-${PPID}"
7
6
SETUP_CMD=$4
8
7
LANDING_TESTS_CMD=$5
9
8
WORKDIR=$6
10
9
 
11
 
TREE_DIR=${WORKSPACE}/run-tests
 
10
TREE_DIR=${WORKSPACE}/${WORKDIR}
12
11
 
13
12
# Introspect
14
13
. ~/.config/jenkaas/environment
15
14
 
16
 
vm_status () ols-vms status $1
17
 
 
18
 
clean_up () {
19
 
    ssh-agent -k 2> /dev/null || true
20
 
    if [ "$(vm_status ${WORKER})" = "RUNNING" ] ; then
21
 
        ols-vms stop ${WORKER}
22
 
    fi
23
 
}
24
 
 
25
 
# handle exit cleanly
26
 
trap clean_up EXIT HUP INT TERM
27
 
 
28
15
if [ "${JENKAAS}" = "production" ] ; then
29
16
    # For my-ubuntu which is hosted on github, we need to use the proxy from
30
17
    # the slave itself.
44
31
 
45
32
cd ${TREE_DIR}
46
33
 
47
 
# We need the agent to update the dependencies
48
 
eval `ssh-agent -s`
49
 
ssh-add ~/.ssh/jenkins@${NODE_NAME}
50
 
 
51
 
ols-vms start -Ovm.backing=${VM} -Ovm.class=ephemeral-lxd ${WORKER}
52
 
 
53
 
SSH_OPTS="-Ossh.options=$(ols-vms config ${WORKER} ssh.options),-A"
54
 
OPTIONS="${SSH_OPTS} -Olaunchpad.login=${JENKAAS_LANDING_USER}"
55
 
# FIXME: Needs to reconcile bzr and git views about user name and email and
56
 
# how they are used -- vila 2016-09-29
57
 
THE_NAME=$(echo $JENKAAS_LANDING_EMAIL | sed -e 's/<.*//')
58
 
THE_EMAIL=$(echo $JENKAAS_LANDING_EMAIL | sed -e 's/.*</</')
59
 
ols-vms shell ${OPTIONS} "-Olaunchpad.login=${JENKAAS_LANDING_USER}" "-Ogit.name=${THE_NAME}" "-Ogit.email=${THE_EMAIL}" ${WORKER} @~/jenkaas/setup/lp-git-access
60
 
ols-vms shell ${OPTIONS} "-Olaunchpad.login=${JENKAAS_LANDING_USER}" "-Obzr.email=${JENKAAS_LANDING_EMAIL}" ${WORKER} @~/jenkaas/setup/lp-bzr-access
61
 
# With credentials
62
 
ols-vms shell ${SSH_OPTS} ${WORKER} @~/jenkaas/project/setup-trunk-with-${VCS} ${TRUNK} ${WORKDIR}
63
 
ols-vms shell ${SSH_OPTS} ${WORKER} "cd ${WORKDIR} && ${SETUP_CMD}"
64
 
# Without credentials
65
 
ols-vms shell ${WORKER} "cd ${WORKDIR} && ${LANDING_TESTS_CMD}"
66
 
ols-vms stop ${WORKER}
67
 
 
68
 
# We can stop the agent now
69
 
ssh-agent -k
 
34
~/jenkaas/ols-jenkaas run-in-worker ${VM} "with-credentials ${SETUP_CMD}" "${LANDING_TESTS_CMD}"