forked from CentOS/sig-atomic-buildscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sig-atomic-testing.yml
193 lines (178 loc) · 6.34 KB
/
sig-atomic-testing.yml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
- defaults:
name: atomic-defaults
node: atomic-sig-ci-slave01
quiet-period: 0
wrappers:
- ansicolor
- workspace-cleanup
- timestamps
- scm:
name: atomic-scms
scm:
- git:
url: "https://github.com/cgwalters/centos-ci-skeleton"
basedir: cciskel
- git:
url: "https://github.com/cgwalters/sig-atomic-buildscripts"
basedir: sig-atomic-buildscripts
branches:
- pr-testing
- publisher:
name: macro-atomic-github-status
publishers:
- post-tasks:
- matches:
- log-text: .
operator: AND
escalate-status: true
run-if-job-successful: true
script: |
#!/bin/bash
set -xeuo pipefail
if test -f skip.stamp; then
exit 0
fi
. github-post-env.txt
GH_STATE=failure
if test -f success.stamp; then
GH_STATE=success
fi
export GH_STATE
exec $WORKSPACE/sig-atomic-buildscripts/centos-ci/github-status
- builder:
name: macro-atomic-rdgo-github-try-builder
builders:
- shell: |
#!/bin/sh
set -xeuo pipefail
sig-atomic-buildscripts/centos-ci/github-pr-is-closed "${{GIT_BRANCH#origin/}}" github-pr-is-closed.stamp
if test -f github-pr-is-closed.stamp; then
touch skip.stamp
else
if "${{GIT_BRANCH#pr/}}" = "${{GIT_BRANCH}}"; then
type=homu
else
type=pr
fi
if test {origintype} '!=' ${{type}}; then
touch skip.stamp
fi
fi
- conditional-step:
condition-kind: shell
condition-command: test ! -f ${{WORKSPACE}}/github-pr-is-closed.stamp
steps:
- shell: |
#!/bin/bash
set -xeuo pipefail
env GH_STATE=pending sig-atomic-buildscripts/centos-ci/github-status
cat > github-post-env.txt << EOF
GIT_COMMIT=${{TARGET_GIT_COMMIT:-${{GIT_COMMIT}}}}
GIT_URL=${{GIT_URL}}
BUILD_URL=${{BUILD_URL}}
EOF
- macro-cciskel-duffy-prepared-allocate:
jobclass: builder
duffytimeoutsecs: 360
playbook: sig-atomic-buildscripts/centos-ci/setup/setup-system.yml
- shell: |
#!/bin/bash
set -xeuo pipefail
(set +x;
echo "GIT_URL=${{GIT_URL}}"
echo "TARGET_GIT_COMMIT=${{TARGET_GIT_COMMIT:-}}"
echo "GIT_COMMIT=${{GIT_COMMIT}}"
echo "GIT_BRANCH=${{GIT_BRANCH#origin/}}"
)
export GIT_COMMIT="${{TARGET_GIT_COMMIT:-${{GIT_COMMIT}}}}"
(echo -n "export RSYNC_PASSWORD=" && cat ~/duffy.key | cut -c '-13') > rsync-password.sh
rsync -q -Hrlptv --stats -e ssh sig-atomic-buildscripts ~/github-token.txt rsync-password.sh "prbuilder@${{DUFFY_HOST}}:"
mkdir jenkins-git
mv ${{WORKSPACE}}/{projname} jenkins-git
rsync -q -Hrlptv --stats -e ssh jenkins-git/ prbuilder@${{DUFFY_HOST}}:jenkins-git/
build_success=true
if ! ssh -tt prbuilder@${{DUFFY_HOST}} ./sig-atomic-buildscripts/centos-ci/run-pr-build "${{GIT_URL}}" jenkins-git/{projname} "${{GIT_COMMIT}}"; then
build_success=false
fi
rsync -q -Hrlptv --stats -e ssh prbuilder@${{DUFFY_HOST}}:build-logs ${{WORKSPACE}}/build-logs || true
# Exit with code from the build
if test "${{build_success}}" = "false"; then
echo 'Build failed, see logs above'; exit 1
fi
touch success.stamp
- job-template:
name: atomic-rdgo-homu-{projname}
defaults: atomic-defaults
description: |
Homu queue processing - builds auto and try branches
JJB Code Location: <a href="https://github.com/CentOS/sig-atomic-buildscripts">https://github.com/CentOS/sig-atomic-buildscripts</a><br>
Managed by Jenkins Job Builder. Do not edit via web.<br>
scm:
- atomic-scms
- git:
url: "{giturl}"
basedir: "{projname}"
branches:
- auto
- try
triggers:
- github
builders:
- macro-atomic-rdgo-github-try-builder:
projname: "{projname}"
origintype: homu
publishers:
- macro-cciskel-duffy-deallocate
- macro-atomic-github-status
- archive:
artifacts: 'build-logs/**'
allow-empty: 'true'
- job-template:
name: atomic-rdgo-pr-{projname}
defaults: atomic-defaults
parameters:
- string:
name: TARGET_GIT_COMMIT
default: ""
description: |
Pull request processing
JJB Code Location: <a href="https://github.com/CentOS/sig-atomic-buildscripts">https://github.com/CentOS/sig-atomic-buildscripts</a><br>
Managed by Jenkins Job Builder. Do not edit via web.<br>
scm:
- atomic-scms
- git:
url: "{giturl}"
basedir: "{projname}"
refspec: "+refs/pull/*/head:refs/remotes/origin/pr/*"
triggers:
- github
builders:
- macro-atomic-rdgo-github-try-builder:
projname: "{projname}"
origintype: pr
publishers:
- macro-cciskel-duffy-deallocate
- macro-atomic-github-status
- archive:
artifacts: 'build-logs/**'
allow-empty: 'true'
# Our list of jobs that have both Homu and PRs
- project:
name: atomic-rdgo-homu-and-pr-project
projname:
- cgwalters-playground:
giturl: https://github.com/cgwalters/playground
- ostree:
giturl: https://github.com/ostreedev/ostree
- rpm-ostree:
giturl: https://github.com/projectatomic/rpm-ostree
jobs:
- atomic-rdgo-homu-{projname}
- atomic-rdgo-pr-{projname}
- project:
name: atomic-rdgo-pr-only
projname:
- skopeo:
giturl: https://github.com/projectatomic/skopeo
jobs:
- atomic-rdgo-pr-{projname}