This repository has been archived by the owner on Apr 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
beaker-in-a-box-tests.yaml
131 lines (125 loc) · 5.42 KB
/
beaker-in-a-box-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
- job-template:
name: beaker-in-a-box-tests-{distro}
description: |
Runs Beaker-in-a-box ansible playbook inside Beaker, for patches merged to master.
properties:
- build-discarder:
days-to-keep: 30
concurrent: true
node: fedora
scm:
- git:
browser: cgit
browser-url: https://git.beaker-project.org/cgit/beaker-in-a-box/
reference-repo: /var/lib/jenkins/gitreference/beaker-in-a-box
url: ssh://[email protected]:29418/beaker-in-a-box
credentials-id: "fac135e6-5a13-4cd0-8dd5-737da825099b"
choosing-strategy: gerrit
name: gerrit
refspec: +refs/heads/*:refs/remotes/gerrit/* $GERRIT_REFSPEC
# 'branches' key is meaningless with Gerrit Trigger, but the
# default value '**' causes a NullPointerException:
# https://issues.jenkins-ci.org/browse/JENKINS-27559
branches:
- master
merge:
remote: gerrit
branch: $GERRIT_BRANCH
changelog-against:
remote: gerrit
branch: $GERRIT_BRANCH
clean:
before: true
wipe-workspace: false
skip-tag: true
use-author: true
triggers:
- gerrit:
server-name: gerrit.beaker-project.org
projects:
- project-compare-type: PLAIN
project-pattern: beaker-in-a-box
branches:
- branch-compare-type: ANT
branch-pattern: "**"
trigger-on:
- comment-added-event:
approval-category: Ready-for-Checks
approval-value: 1
custom-url: "https://beaker-project.org/jenkins-results/$JOB_NAME/$BUILD_NUMBER/"
builders:
- shell: |
cat >client.conf <<EOF
HUB_URL="https://beaker-devel.app.eng.bos.redhat.com"
AUTH_METHOD="krbv"
EOF
export BEAKER_CLIENT_CONF=client.conf
k5start -U -f $JENKINS_KEYTAB
job_submit_output=$(bkr job-submit --xml - <<EOF
<job group="beakerdevs" retention_tag="scratch">
<whiteboard>$JOB_NAME #[$BUILD_NUMBER]($BUILD_URL) from Gerrit #[$GERRIT_CHANGE_NUMBER]($GERRIT_CHANGE_URL)</whiteboard>
<recipeSet priority="Medium">
<recipe ks_meta="fstype=xfs harness=restraint-rhts !install_task_requires" whiteboard="Beaker In A Box Playbook Test">
<repos />
<packages/>
<distroRequires>
<distro_arch op="=" value="x86_64" />
<distro_variant op="=" value="Workstation" />
<family op="=" value="{distro}"/>
</distroRequires>
<hostRequires>
<system_type value="Machine"/>
<key_value key="HVM" op="=" value="1" />
<diskspace op=">=" value="150" units="GB" />
</hostRequires>
<partitions/>
<task name="/distribution/check-install" role="STANDALONE" />
<task name="/distribution/beaker/Sanity/beaker-in-a-box" role="STANDALONE">
<fetch url="git://git.beaker-project.org/beaker-meta-tasks?master#Sanity/beaker-in-a-box-tests"/>
<params>
<param name="GERRIT_REFSPEC" value="$GERRIT_REFSPEC" />
<param name="ANSIBLE_PLAYBOOK_PARAMS" value="-vv" />
</params>
</task>
</recipe>
</recipeSet>
</job>
EOF
)
jobid=$(echo $job_submit_output | awk -F\' '{{print $2}}')
bkr job-watch $jobid || :
mkdir -p beaker/$jobid
bkr job-results --prettyxml $jobid | \
sed -e 's@[-a-zA-Z0-9.]*\.redhat\[email protected]@g' \
>beaker/$jobid/results.xml
bkr job-results --format=junit-xml $jobid >beaker/$jobid/junit.xml
bkr job-logs $jobid | grep -v debug/ | \
while read url ; do
# turn a URL like http://.../1234/logs/TESTOUT.log into 1234-TESTOUT.log
filename="$(echo "$url" | sed -r -e 's@^.*/([0-9]+)/logs/([^/]*$)@\1-\2@')"
curl -L -f -s -S -o "beaker/$jobid/$filename" "$url"
done
jobresult=$(xmlstarlet sel -t -v 'concat(/job/@status, "/", /job/@result)' <beaker/$jobid/results.xml)
if [[ "$jobresult" != "Completed/Pass" ]] ; then
exit 1
fi
wrappers:
- credentials-binding:
- file:
credential-id: "1fc5282d-0e61-4736-ace4-9ff23b065636"
variable: JENKINS_KEYTAB
- publish-over-ssh-post-build:
site: "beaker-project.org jenkins-results"
source: "beaker/**"
target: "$JOB_NAME/$BUILD_NUMBER"
publishers:
- archive:
artifacts: beaker/**
- junit:
results: beaker/*/junit.xml
- project:
name: beaker-in-a-box-tests
distro:
- Fedora27
jobs:
- beaker-in-a-box-tests-{distro}