Merge ~kzapalowicz/snappy-hwe-snaps/+git/jenkins-jobs:feature/deb-builds into ~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-jobs:master
- Git
- lp:~kzapalowicz/snappy-hwe-snaps/+git/jenkins-jobs
- feature/deb-builds
- Merge into master
Status: | Work in progress |
---|---|
Proposed branch: | ~kzapalowicz/snappy-hwe-snaps/+git/jenkins-jobs:feature/deb-builds |
Merge into: | ~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-jobs:master |
Diff against target: |
883 lines (+799/-0) 14 files modified
jobs/deb/common-job-prepare.sh (+58/-0) jobs/deb/deb-build-prepare.sh (+85/-0) jobs/deb/deb-build-prepare.yaml (+63/-0) jobs/deb/deb-build-worker.sh (+57/-0) jobs/deb/deb-build-worker.yaml (+72/-0) jobs/deb/deb-build.yaml (+90/-0) jobs/deb/deb-cleanup.sh (+38/-0) jobs/deb/deb-cleanup.yaml (+32/-0) jobs/deb/deb-project-jobs.yaml (+9/-0) jobs/deb/deb-trigger-ci.sh (+29/-0) jobs/deb/deb-trigger-ci.yaml (+22/-0) jobs/deb/deb-update-mp.sh (+30/-0) jobs/deb/deb-update-mp.yaml (+31/-0) tools/debbuild.sh (+183/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
System Enablement Bot | continuous-integration | Approve | |
Simon Fels | Needs Fixing | ||
Review via email: mp+332172@code.launchpad.net |
Commit message
Description of the change
add jobs to build debian packages
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
- abb3609... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
tools: add script to build debian packages in a chroot
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:b4acd0874a0
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 6de89e2... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: remove automerger
- 5a3a2d5... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: remove documentation building job
- ed4b1ad... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs.deb: save build results in results dir
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:80296ee4c46
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 47391cd... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: add CI_ID to identify all downstream builds with single id
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:47391cd4b34
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Unmerged commits
- 47391cd... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: add CI_ID to identify all downstream builds with single id
- ed4b1ad... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs.deb: save build results in results dir
- 5a3a2d5... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: remove documentation building job
- 6de89e2... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: remove automerger
- abb3609... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
tools: add script to build debian packages in a chroot
- 040f450... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: add build worker
- 915a1a3... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: add update MP job
- 19fa7b6... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: add documentation building job
- b782ce6... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: add cleanup job
- 7a52a3e... by =?utf-8?q?Konrad_Zapa=C5=82owicz?= <email address hidden>
-
jobs/deb: add deb build job
Preview Diff
1 | diff --git a/jobs/deb/common-job-prepare.sh b/jobs/deb/common-job-prepare.sh | |||
2 | 0 | new file mode 100644 | 0 | new file mode 100644 |
3 | index 0000000..204a87d | |||
4 | --- /dev/null | |||
5 | +++ b/jobs/deb/common-job-prepare.sh | |||
6 | @@ -0,0 +1,58 @@ | |||
7 | 1 | #!/bin/sh -ex | ||
8 | 2 | # | ||
9 | 3 | # Copyright (C) 2017 Canonical Ltd | ||
10 | 4 | # | ||
11 | 5 | # This program is free software: you can redistribute it and/or modify | ||
12 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
13 | 7 | # published by the Free Software Foundation. | ||
14 | 8 | # | ||
15 | 9 | # This program is distributed in the hope that it will be useful, | ||
16 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | 12 | # GNU General Public License for more details. | ||
19 | 13 | # | ||
20 | 14 | # You should have received a copy of the GNU General Public License | ||
21 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
22 | 16 | |||
23 | 17 | # This is a common place to be a forwarder of varibles definied in | ||
24 | 18 | # the job definition. To avoid using templating in the actual job | ||
25 | 19 | # shell script we have a common .sh file which does this for us. | ||
26 | 20 | # | ||
27 | 21 | # Whenever you need something which is suitable for multiple jobs | ||
28 | 22 | # or originates from the job definition and needs to be added | ||
29 | 23 | # through a template variable inside the shell script this | ||
30 | 24 | # is the right place for it. | ||
31 | 25 | # | ||
32 | 26 | # This file will be sourced by all jobs. | ||
33 | 27 | |||
34 | 28 | JENKINS_JOBS_GIT_REPO="{jobs-git-repo}" | ||
35 | 29 | JENKINS_JOBS_GIT_REPO_BRANCH="{jobs-git-repo-branch}" | ||
36 | 30 | |||
37 | 31 | # Ensure we have a clean and empty workspace but keep our jenkins-jobs | ||
38 | 32 | # repository so we don't have to clone it again | ||
39 | 33 | for f in $(ls "${{WORKSPACE}}"); do | ||
40 | 34 | if [ "${{f}}" = jenkins-jobs ]; then | ||
41 | 35 | continue | ||
42 | 36 | fi | ||
43 | 37 | rm -rf "${{WORKSPACE}}"/"${{f}}" | ||
44 | 38 | done | ||
45 | 39 | |||
46 | 40 | if [ -e jenkins-jobs ] ; then | ||
47 | 41 | (cd jenkins-jobs ; git clean -fdx . ; git fetch origin ; git reset --hard origin/${{JENKINS_JOBS_GIT_REPO_BRANCH}}) | ||
48 | 42 | else | ||
49 | 43 | git clone -b ${{JENKINS_JOBS_GIT_REPO_BRANCH}} ${{JENKINS_JOBS_GIT_REPO}} | ||
50 | 44 | fi | ||
51 | 45 | |||
52 | 46 | cat << EOF > $WORKSPACE/.build_env | ||
53 | 47 | BOT_USERNAME={bot_username} | ||
54 | 48 | LAUNCHPAD_PROJECT={launchpad_project} | ||
55 | 49 | LAUNCHPAD_TEAM={launchpad_team} | ||
56 | 50 | DEB_BUILD_JOB={name}-deb-build-prepare | ||
57 | 51 | BUILD_SCRIPTS=$WORKSPACE/jenkins-jobs | ||
58 | 52 | BUILD_ON_LAUNCHPAD={build_on_launchpad} | ||
59 | 53 | AUTO_MERGE={auto_merge} | ||
60 | 54 | TRIGGER_CI={trigger_ci} | ||
61 | 55 | UPDATE_MPS={update_mps} | ||
62 | 56 | RUN_TESTS={run_tests} | ||
63 | 57 | CI_REPO=ci-build-${{CI_ID}} | ||
64 | 58 | EOF | ||
65 | diff --git a/jobs/deb/deb-build-prepare.sh b/jobs/deb/deb-build-prepare.sh | |||
66 | 0 | new file mode 100644 | 59 | new file mode 100644 |
67 | index 0000000..1ee6fae | |||
68 | --- /dev/null | |||
69 | +++ b/jobs/deb/deb-build-prepare.sh | |||
70 | @@ -0,0 +1,85 @@ | |||
71 | 1 | #!/bin/bash | ||
72 | 2 | # | ||
73 | 3 | # Copyright (C) 2017 Canonical Ltd | ||
74 | 4 | # | ||
75 | 5 | # This program is free software: you can redistribute it and/or modify | ||
76 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
77 | 7 | # published by the Free Software Foundation. | ||
78 | 8 | # | ||
79 | 9 | # This program is distributed in the hope that it will be useful, | ||
80 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
81 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
82 | 12 | # GNU General Public License for more details. | ||
83 | 13 | # | ||
84 | 14 | # You should have received a copy of the GNU General Public License | ||
85 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
86 | 16 | |||
87 | 17 | set -ex | ||
88 | 18 | |||
89 | 19 | . "$WORKSPACE/.build_env" | ||
90 | 20 | |||
91 | 21 | # CI_ID isn't specified yet when we're being called so initialize | ||
92 | 22 | # it here with the same value as we do in deb-build-prepare.yaml | ||
93 | 23 | if [ -z "$CI_ID" ]; then | ||
94 | 24 | CI_ID=$BUILD_ID | ||
95 | 25 | fi | ||
96 | 26 | |||
97 | 27 | rm -rf $WORKSPACE/src | ||
98 | 28 | |||
99 | 29 | git clone --no-checkout $TARGET_GIT_REPO $WORKSPACE/src | ||
100 | 30 | cd $WORKSPACE/src | ||
101 | 31 | for remote in $(git branch -r | grep -v origin/master); do | ||
102 | 32 | git checkout --track $remote | ||
103 | 33 | done | ||
104 | 34 | |||
105 | 35 | git checkout $TARGET_GIT_REPO_BRANCH | ||
106 | 36 | |||
107 | 37 | git config user.name "System Enablement CI Bot" | ||
108 | 38 | git config user.email "ce-system-enablement@lists.canonical.com" | ||
109 | 39 | |||
110 | 40 | if [ -n "$SOURCE_GIT_REPO" ]; then | ||
111 | 41 | git remote add other $SOURCE_GIT_REPO | ||
112 | 42 | git fetch other | ||
113 | 43 | git merge \ | ||
114 | 44 | --no-ff \ | ||
115 | 45 | -m "Merge remote tracking branch other/$SOURCE_GIT_REPO_BRANCH" \ | ||
116 | 46 | $REVISION | ||
117 | 47 | fi | ||
118 | 48 | |||
119 | 49 | # Try to find the correct branch we need to build from. In the case that | ||
120 | 50 | # $TARGET_GIT_REPO_BRANCH points us to an upstream component branch we | ||
121 | 51 | # will take master as the next suitable candidate. | ||
122 | 52 | CI_BRANCH= | ||
123 | 53 | DEBIAN_DIRECTORY_PATH= | ||
124 | 54 | for branch in $TARGET_GIT_REPO_BRANCH master ; do | ||
125 | 55 | git checkout $branch | ||
126 | 56 | if [ -d debian ]; then | ||
127 | 57 | DEBIAN_DIRECTORY_PATH=debian | ||
128 | 58 | fi | ||
129 | 59 | |||
130 | 60 | if [ -n "$DEBIAN_DIRECTORY_PATH" ]; then | ||
131 | 61 | CI_BRANCH=$branch | ||
132 | 62 | break | ||
133 | 63 | fi | ||
134 | 64 | done | ||
135 | 65 | |||
136 | 66 | if [ -z "$CI_BRANCH" ]; then | ||
137 | 67 | echo "WARNING: Can't build snap as no snapcraft.yaml exists!" | ||
138 | 68 | exit 0 | ||
139 | 69 | fi | ||
140 | 70 | |||
141 | 71 | # Now let's setup some variables that are important for the build process | ||
142 | 72 | |||
143 | 73 | REPO_NAME=$(awk -v a="$TARGET_GIT_REPO" 'BEGIN{print substr(a, index(a, "+git/") + 5)}') | ||
144 | 74 | # We rely on the snapcraft.yaml to have the snap name in the first five lines | ||
145 | 75 | # which is the case for all our snaps. This is a bit lazy but the best way to | ||
146 | 76 | # ensure we don't fetch any other name: fields which might be present in the file. | ||
147 | 77 | DEB_NAME=$(cat $DEBIAN_DIRECTORY_PATH/control | grep "^Source:" | awk '{print $2}') | ||
148 | 78 | DEB_REV=$(git rev-parse --short HEAD) | ||
149 | 79 | CI_REPO=ci-build-$CI_ID | ||
150 | 80 | |||
151 | 81 | # Push to CI repository | ||
152 | 82 | |||
153 | 83 | git remote add jenkins-ci git+ssh://$BOT_USERNAME@git.launchpad.net/~$LAUNCHPAD_TEAM/$LAUNCHPAD_PROJECT/+git/$CI_REPO | ||
154 | 84 | git push jenkins-ci --all | ||
155 | 85 | git push jenkins-ci --tags | ||
156 | diff --git a/jobs/deb/deb-build-prepare.yaml b/jobs/deb/deb-build-prepare.yaml | |||
157 | 0 | new file mode 100644 | 86 | new file mode 100644 |
158 | index 0000000..c75f803 | |||
159 | --- /dev/null | |||
160 | +++ b/jobs/deb/deb-build-prepare.yaml | |||
161 | @@ -0,0 +1,63 @@ | |||
162 | 1 | - job-template: | ||
163 | 2 | name: '{name}-deb-build-prepare' | ||
164 | 3 | project-type: freestyle | ||
165 | 4 | defaults: global | ||
166 | 5 | description: "" | ||
167 | 6 | display-name: "{name}-deb-build-prepare" | ||
168 | 7 | concurrent: true | ||
169 | 8 | node: deb && misc | ||
170 | 9 | properties: | ||
171 | 10 | - build-discarder: | ||
172 | 11 | num-to-kep: 10 | ||
173 | 12 | - rebuild | ||
174 | 13 | parameters: | ||
175 | 14 | - string: | ||
176 | 15 | name: TARGET_GIT_REPO | ||
177 | 16 | default: | ||
178 | 17 | description: "Target git repository" | ||
179 | 18 | - string: | ||
180 | 19 | name: TARGET_GIT_REPO_BRANCH | ||
181 | 20 | default: master | ||
182 | 21 | description: "Branch of the target git repository to build from" | ||
183 | 22 | - string: | ||
184 | 23 | name: SERIES | ||
185 | 24 | default: xenial | ||
186 | 25 | description: "Ubuntu archive series to build for" | ||
187 | 26 | - string: | ||
188 | 27 | name: FORCE | ||
189 | 28 | default: "0" | ||
190 | 29 | description: "Set to 1 to force the build" | ||
191 | 30 | - string: | ||
192 | 31 | name: SOURCE_GIT_REPO | ||
193 | 32 | default: | ||
194 | 33 | description: "Source git repository" | ||
195 | 34 | - string: | ||
196 | 35 | name: SOURCE_GIT_REPO_BRANCH | ||
197 | 36 | default: | ||
198 | 37 | description: "Branch of the source git repository to use" | ||
199 | 38 | - string: | ||
200 | 39 | name: MERGE_PROPOSAL | ||
201 | 40 | default: | ||
202 | 41 | description: "Link to the merge proposal this build relates to" | ||
203 | 42 | - string: | ||
204 | 43 | name: REVISION | ||
205 | 44 | default: | ||
206 | 45 | description: "Git revision that is being build" | ||
207 | 46 | - string: | ||
208 | 47 | name: CLEANUP_WORKSPACE | ||
209 | 48 | default: "0" | ||
210 | 49 | description: "Cleanup the whole workspace" | ||
211 | 50 | builders: | ||
212 | 51 | - shell: | ||
213 | 52 | !include-raw: | ||
214 | 53 | - common-job-prepare.sh | ||
215 | 54 | - shell: | ||
216 | 55 | !include-raw-escape: | ||
217 | 56 | - deb-build-prepare.sh | ||
218 | 57 | - trigger-builds: | ||
219 | 58 | - project: '{name}-deb-build' | ||
220 | 59 | current-parameters: true | ||
221 | 60 | predefined-parameters: | | ||
222 | 61 | CI_ID=$BUILD_ID | ||
223 | 62 | RESULTS_ID=$BUILD_TAG | ||
224 | 63 | block: true | ||
225 | diff --git a/jobs/deb/deb-build-worker.sh b/jobs/deb/deb-build-worker.sh | |||
226 | 0 | new file mode 100644 | 64 | new file mode 100644 |
227 | index 0000000..56c7481 | |||
228 | --- /dev/null | |||
229 | +++ b/jobs/deb/deb-build-worker.sh | |||
230 | @@ -0,0 +1,57 @@ | |||
231 | 1 | #!/bin/sh | ||
232 | 2 | # | ||
233 | 3 | # Copyright (C) 2017 Canonical Ltd | ||
234 | 4 | # | ||
235 | 5 | # This program is free software: you can redistribute it and/or modify | ||
236 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
237 | 7 | # published by the Free Software Foundation. | ||
238 | 8 | # | ||
239 | 9 | # This program is distributed in the hope that it will be useful, | ||
240 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
241 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
242 | 12 | # GNU General Public License for more details. | ||
243 | 13 | # | ||
244 | 14 | # You should have received a copy of the GNU General Public License | ||
245 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
246 | 16 | |||
247 | 17 | set -ex | ||
248 | 18 | |||
249 | 19 | . "$WORKSPACE/.build_env" | ||
250 | 20 | |||
251 | 21 | rm -rf $WORKSPACE/src $WORKSPACE/results | ||
252 | 22 | |||
253 | 23 | # Debian packages will be build in chroot for the host architecture using | ||
254 | 24 | # bits from https://launchpad.net/jenkaas-jobs to do the job. | ||
255 | 25 | |||
256 | 26 | DEBBUILD_EXTRA_ARGS= | ||
257 | 27 | |||
258 | 28 | sudo $BUILD_SCRIPTS/tools/debbuild.sh \ | ||
259 | 29 | --source-dir=$WORKSPACE/src \ | ||
260 | 30 | --results-dir=$WORKSPACE/results \ | ||
261 | 31 | --arch=$ARCHITECTURE \ | ||
262 | 32 | --series=$SERIES \ | ||
263 | 33 | --proxy=http://squid.internal:3128 \ | ||
264 | 34 | $DEBBUILD_EXTRA_ARGS | ||
265 | 35 | |||
266 | 36 | # Build is done, now copy the build artifacts to the remote location | ||
267 | 37 | |||
268 | 38 | if [ -z "$REMOTE_WORKER" ]; then | ||
269 | 39 | echo "INFO: No remote worker defined, not copying artifacts to it" | ||
270 | 40 | exit 0 | ||
271 | 41 | fi | ||
272 | 42 | |||
273 | 43 | SSH_PATH="${JENKINS_HOME}/.ssh/" | ||
274 | 44 | SSH_KEY_PATH="${SSH_PATH}/git.launchpad.net/$BOT_USERNAME" | ||
275 | 45 | SSH="ssh -i $SSH_KEY_PATH/id_rsa $REMOTE_USER@$REMOTE_WORKER" | ||
276 | 46 | SCP="scp -i $SSH_KEY_PATH/id_rsa" | ||
277 | 47 | |||
278 | 48 | REMOTE_RESULTS_BASE_DIR=/home/$REMOTE_USER/results | ||
279 | 49 | |||
280 | 50 | $SSH mkdir -p $REMOTE_RESULTS_BASE_DIR/$RESULTS_ID | ||
281 | 51 | $SCP $WORKSPACE/results/*.deb $REMOTE_USER@$REMOTE_WORKER:$REMOTE_RESULTS_BASE_DIR/$RESULTS_ID/ | ||
282 | 52 | |||
283 | 53 | # Save the id of our results so it can be used by a subsequent build | ||
284 | 54 | # in a properties file which is then being read from jenkins and its | ||
285 | 55 | # content passed as parameters to triggered builds. | ||
286 | 56 | echo "RESULTS_ID=$RESULTS_ID" >> $WORKSPACE/build-props | ||
287 | 57 | cat $WORKSPACE/build-props | ||
288 | diff --git a/jobs/deb/deb-build-worker.yaml b/jobs/deb/deb-build-worker.yaml | |||
289 | 0 | new file mode 100644 | 58 | new file mode 100644 |
290 | index 0000000..18b09b8 | |||
291 | --- /dev/null | |||
292 | +++ b/jobs/deb/deb-build-worker.yaml | |||
293 | @@ -0,0 +1,72 @@ | |||
294 | 1 | - job-template: | ||
295 | 2 | name: '{name}-deb-build-worker' | ||
296 | 3 | project-type: freestyle | ||
297 | 4 | defaults: global | ||
298 | 5 | description: "Build a deb on launchpad" | ||
299 | 6 | display-name: "{name}-deb-build-worker" | ||
300 | 7 | concurrent: true | ||
301 | 8 | node: deb && build | ||
302 | 9 | parameters: | ||
303 | 10 | - string: | ||
304 | 11 | name: ARCHITECTURE | ||
305 | 12 | default: amd64 | ||
306 | 13 | description: Architecture to build the deb for | ||
307 | 14 | - string: | ||
308 | 15 | name: TARGET_GIT_REPO | ||
309 | 16 | default: | ||
310 | 17 | description: "Target git repository" | ||
311 | 18 | - string: | ||
312 | 19 | name: TARGET_GIT_REPO_BRANCH | ||
313 | 20 | default: master | ||
314 | 21 | description: "Branch of the target git repository to build from" | ||
315 | 22 | - string: | ||
316 | 23 | name: SERIES | ||
317 | 24 | default: xenial | ||
318 | 25 | description: "Ubuntu archive series to build for" | ||
319 | 26 | - string: | ||
320 | 27 | name: FORCE | ||
321 | 28 | default: "0" | ||
322 | 29 | description: "Set to 1 to force the build" | ||
323 | 30 | - string: | ||
324 | 31 | name: SOURCE_GIT_REPO | ||
325 | 32 | default: | ||
326 | 33 | description: "Source git repository" | ||
327 | 34 | - string: | ||
328 | 35 | name: SOURCE_GIT_REPO_BRANCH | ||
329 | 36 | default: | ||
330 | 37 | description: "Branch of the source git repository to use" | ||
331 | 38 | - string: | ||
332 | 39 | name: MERGE_PROPOSAL | ||
333 | 40 | default: | ||
334 | 41 | description: "Link to the merge proposal this build relates to" | ||
335 | 42 | - string: | ||
336 | 43 | name: REVISION | ||
337 | 44 | default: | ||
338 | 45 | description: "Git revision that is being build" | ||
339 | 46 | - string: | ||
340 | 47 | name: CLEANUP_WORKSPACE | ||
341 | 48 | default: "0" | ||
342 | 49 | description: "Cleanup the whole workspace" | ||
343 | 50 | - string: | ||
344 | 51 | name: REMOTE_WORKER | ||
345 | 52 | default: "{obj:remote_worker}" | ||
346 | 53 | description: "The remote server to execute the spread jobs on. There's no need to change from the default value unless you know what you're doing." | ||
347 | 54 | - string: | ||
348 | 55 | name: REMOTE_USER | ||
349 | 56 | default: "{obj:remote_user}" | ||
350 | 57 | description: "The remote server username used to ssh to $REMOTE_WORKER." | ||
351 | 58 | - string: | ||
352 | 59 | name: CI_ID | ||
353 | 60 | default: '' | ||
354 | 61 | description: "Numeric id which will identify the CI iteration through all downstream builds" | ||
355 | 62 | - string: | ||
356 | 63 | name: RESULTS_ID | ||
357 | 64 | default: '' | ||
358 | 65 | description: "Alphanumeric identifier used to pass build artifacts through different jobs" | ||
359 | 66 | builders: | ||
360 | 67 | - shell: | ||
361 | 68 | !include-raw: | ||
362 | 69 | - common-job-prepare.sh | ||
363 | 70 | - shell: | ||
364 | 71 | !include-raw-escape: | ||
365 | 72 | - deb-build-worker.sh | ||
366 | diff --git a/jobs/deb/deb-build.yaml b/jobs/deb/deb-build.yaml | |||
367 | 0 | new file mode 100644 | 73 | new file mode 100644 |
368 | index 0000000..4a11d32 | |||
369 | --- /dev/null | |||
370 | +++ b/jobs/deb/deb-build.yaml | |||
371 | @@ -0,0 +1,90 @@ | |||
372 | 1 | - job-template: | ||
373 | 2 | name: '{name}-deb-build' | ||
374 | 3 | project-type: matrix | ||
375 | 4 | defaults: global | ||
376 | 5 | description: "Build a deb with subsequent test execution" | ||
377 | 6 | display-name: "{name}-deb-build" | ||
378 | 7 | concurrent: true | ||
379 | 8 | sequential: false | ||
380 | 9 | node: monitor | ||
381 | 10 | axes: | ||
382 | 11 | - axis: | ||
383 | 12 | type: user-defined | ||
384 | 13 | name: ARCHITECTURE | ||
385 | 14 | values: '{obj:build_architectures}' | ||
386 | 15 | parameters: | ||
387 | 16 | - string: | ||
388 | 17 | name: TARGET_GIT_REPO | ||
389 | 18 | default: | ||
390 | 19 | description: "Target git repository" | ||
391 | 20 | - string: | ||
392 | 21 | name: TARGET_GIT_REPO_BRANCH | ||
393 | 22 | default: master | ||
394 | 23 | description: "Branch of the target git repository to build from" | ||
395 | 24 | - string: | ||
396 | 25 | name: SERIES | ||
397 | 26 | default: xenial | ||
398 | 27 | description: "Ubuntu archive series to build for" | ||
399 | 28 | - string: | ||
400 | 29 | name: FORCE | ||
401 | 30 | default: "0" | ||
402 | 31 | description: "Set to 1 to force the build" | ||
403 | 32 | - string: | ||
404 | 33 | name: SOURCE_GIT_REPO | ||
405 | 34 | default: | ||
406 | 35 | description: "Source git repository" | ||
407 | 36 | - string: | ||
408 | 37 | name: SOURCE_GIT_REPO_BRANCH | ||
409 | 38 | default: | ||
410 | 39 | description: "Branch of the source git repository to use" | ||
411 | 40 | - string: | ||
412 | 41 | name: MERGE_PROPOSAL | ||
413 | 42 | default: | ||
414 | 43 | description: "Link to the merge proposal this build relates to" | ||
415 | 44 | - string: | ||
416 | 45 | name: REVISION | ||
417 | 46 | default: | ||
418 | 47 | description: "Cleanup the whole workspace" | ||
419 | 48 | - string: | ||
420 | 49 | name: CLEANUP_WORKSPACE | ||
421 | 50 | default: "0" | ||
422 | 51 | description: "Cleanup the whole workspace" | ||
423 | 52 | - string: | ||
424 | 53 | name: CI_ID | ||
425 | 54 | default: '' | ||
426 | 55 | description: "Numeric id which will identify the CI iteration through all downstream builds" | ||
427 | 56 | builders: | ||
428 | 57 | - trigger-builds: | ||
429 | 58 | - project: '{name}-deb-build-worker' | ||
430 | 59 | current-parameters: true | ||
431 | 60 | predefined-parameters: | | ||
432 | 61 | ARCHITECTURE=$ARCHITECTURE | ||
433 | 62 | block: true | ||
434 | 63 | - project: '{name}-deb-docs' | ||
435 | 64 | current-parameters: true | ||
436 | 65 | block: true | ||
437 | 66 | - project: '{name}-deb-cleanup' | ||
438 | 67 | current-parameters: true | ||
439 | 68 | publishers: | ||
440 | 69 | - archive: | ||
441 | 70 | artifacts: '**/*.deb' | ||
442 | 71 | latest-only: false | ||
443 | 72 | allow-empty: true | ||
444 | 73 | fingerprint: false | ||
445 | 74 | - trigger-parameterized-builds: | ||
446 | 75 | - project: '{name}-deb-update-mp' | ||
447 | 76 | condition: "SUCCESS" | ||
448 | 77 | predefined-parameters: | | ||
449 | 78 | CI_RESULT=PASSED | ||
450 | 79 | CI_BUILD=${{BUILD_URL}} | ||
451 | 80 | CI_BRANCH="${{SOURCE_GIT_REPO_BRANCH}}@${{SOURCE_GIT_REPO}}" | ||
452 | 81 | CI_MERGE_PROPOSAL=${{MERGE_PROPOSAL}} | ||
453 | 82 | CI_REVISION=${{REVISION}} | ||
454 | 83 | - project: '{name}-deb-update-mp' | ||
455 | 84 | condition: "UNSTABLE_OR_WORSE" | ||
456 | 85 | predefined-parameters: | | ||
457 | 86 | CI_RESULT=FAILED | ||
458 | 87 | CI_BUILD=${{BUILD_URL}} | ||
459 | 88 | CI_BRANCH="${{SOURCE_GIT_REPO_BRANCH}}@${{SOURCE_GIT_REPO}}" | ||
460 | 89 | CI_MERGE_PROPOSAL=${{MERGE_PROPOSAL}} | ||
461 | 90 | CI_REVISION=${{REVISION}} | ||
462 | diff --git a/jobs/deb/deb-cleanup.sh b/jobs/deb/deb-cleanup.sh | |||
463 | 0 | new file mode 100644 | 91 | new file mode 100644 |
464 | index 0000000..bf0e03c | |||
465 | --- /dev/null | |||
466 | +++ b/jobs/deb/deb-cleanup.sh | |||
467 | @@ -0,0 +1,38 @@ | |||
468 | 1 | #!/bin/sh | ||
469 | 2 | # | ||
470 | 3 | # Copyright (C) 2017 Canonical Ltd | ||
471 | 4 | # | ||
472 | 5 | # This program is free software: you can redistribute it and/or modify | ||
473 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
474 | 7 | # published by the Free Software Foundation. | ||
475 | 8 | # | ||
476 | 9 | # This program is distributed in the hope that it will be useful, | ||
477 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
478 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
479 | 12 | # GNU General Public License for more details. | ||
480 | 13 | # | ||
481 | 14 | # You should have received a copy of the GNU General Public License | ||
482 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
483 | 16 | |||
484 | 17 | set -x | ||
485 | 18 | |||
486 | 19 | . "$WORKSPACE/.build_env" | ||
487 | 20 | |||
488 | 21 | # Delete auxiliary repo used in the build | ||
489 | 22 | $BUILD_SCRIPTS/tools/delete-ci-repo.py \ | ||
490 | 23 | --git-repo=https://git.launchpad.net/~$LAUNCHPAD_TEAM/$LAUNCHPAD_PROJECT/+git/$CI_REPO | ||
491 | 24 | |||
492 | 25 | if [ -z "$REMOTE_WORKER" ]; then | ||
493 | 26 | echo "INFO: No remote system defined" | ||
494 | 27 | exit 0 | ||
495 | 28 | fi | ||
496 | 29 | |||
497 | 30 | SSH_PATH="${JENKINS_HOME}/.ssh/" | ||
498 | 31 | SSH_KEY_PATH="${SSH_PATH}/git.launchpad.net/$BOT_USERNAME" | ||
499 | 32 | SSH="ssh -i $SSH_KEY_PATH/id_rsa $REMOTE_USER@$REMOTE_WORKER" | ||
500 | 33 | REMOTE_RESULTS_BASE_DIR=/home/$REMOTE_USER/results | ||
501 | 34 | |||
502 | 35 | $SSH rm -rf $REMOTE_RESULTS_BASE_DIR/$RESULTS_ID | ||
503 | 36 | |||
504 | 37 | # Now remove any container that might have been left behind... | ||
505 | 38 | $SSH sudo docker rm \$\(sudo docker ps -q --filter=status=exited --filter=ancestor=snap-spread-tests\) || true | ||
506 | diff --git a/jobs/deb/deb-cleanup.yaml b/jobs/deb/deb-cleanup.yaml | |||
507 | 0 | new file mode 100644 | 39 | new file mode 100644 |
508 | index 0000000..1b6480e | |||
509 | --- /dev/null | |||
510 | +++ b/jobs/deb/deb-cleanup.yaml | |||
511 | @@ -0,0 +1,32 @@ | |||
512 | 1 | - job-template: | ||
513 | 2 | name: '{name}-deb-cleanup' | ||
514 | 3 | project-type: freestyle | ||
515 | 4 | defaults: global | ||
516 | 5 | description: "Cleanup artifacts left over from a deb build" | ||
517 | 6 | display-name: "{name}-deb-cleanup" | ||
518 | 7 | concurrent: true | ||
519 | 8 | node: deb && build | ||
520 | 9 | parameters: | ||
521 | 10 | - string: | ||
522 | 11 | name: CI_ID | ||
523 | 12 | default: '' | ||
524 | 13 | description: "Numeric id which will identify the CI iteration through all downstream builds" | ||
525 | 14 | - string: | ||
526 | 15 | name: RESULTS_ID | ||
527 | 16 | default: "" | ||
528 | 17 | description: "Alphanumeric Id of the results being staged on the remote worker" | ||
529 | 18 | - string: | ||
530 | 19 | name: REMOTE_WORKER | ||
531 | 20 | default: "{obj:remote_worker}" | ||
532 | 21 | description: "The remote server to execute the spread jobs on. There's no need to change from the default value unless you know what you're doing." | ||
533 | 22 | - string: | ||
534 | 23 | name: REMOTE_USER | ||
535 | 24 | default: "{obj:remote_user}" | ||
536 | 25 | description: "The remote server username used to ssh to $REMOTE_WORKER." | ||
537 | 26 | builders: | ||
538 | 27 | - shell: | ||
539 | 28 | !include-raw: | ||
540 | 29 | - common-job-prepare.sh | ||
541 | 30 | - shell: | ||
542 | 31 | !include-raw-escape: | ||
543 | 32 | - deb-cleanup.sh | ||
544 | diff --git a/jobs/deb/deb-project-jobs.yaml b/jobs/deb/deb-project-jobs.yaml | |||
545 | 0 | new file mode 100644 | 33 | new file mode 100644 |
546 | index 0000000..fbcef68 | |||
547 | --- /dev/null | |||
548 | +++ b/jobs/deb/deb-project-jobs.yaml | |||
549 | @@ -0,0 +1,9 @@ | |||
550 | 1 | - job-group: | ||
551 | 2 | name: deb-project-jobs | ||
552 | 3 | jobs: | ||
553 | 4 | - '{name}-deb-build-worker' | ||
554 | 5 | - '{name}-deb-build' | ||
555 | 6 | - '{name}-deb-build-prepare' | ||
556 | 7 | - '{name}-deb-cleanup' | ||
557 | 8 | - '{name}-deb-trigger-ci' | ||
558 | 9 | - '{name}-deb-update-mp' | ||
559 | diff --git a/jobs/deb/deb-trigger-ci.sh b/jobs/deb/deb-trigger-ci.sh | |||
560 | 0 | new file mode 100644 | 10 | new file mode 100644 |
561 | index 0000000..5430189 | |||
562 | --- /dev/null | |||
563 | +++ b/jobs/deb/deb-trigger-ci.sh | |||
564 | @@ -0,0 +1,29 @@ | |||
565 | 1 | #!/bin/bash | ||
566 | 2 | # | ||
567 | 3 | # Copyright (C) 2016 Canonical Ltd | ||
568 | 4 | # | ||
569 | 5 | # This program is free software: you can redistribute it and/or modify | ||
570 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
571 | 7 | # published by the Free Software Foundation. | ||
572 | 8 | # | ||
573 | 9 | # This program is distributed in the hope that it will be useful, | ||
574 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
575 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
576 | 12 | # GNU General Public License for more details. | ||
577 | 13 | # | ||
578 | 14 | # You should have received a copy of the GNU General Public License | ||
579 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
580 | 16 | |||
581 | 17 | set -ex | ||
582 | 18 | |||
583 | 19 | . "$WORKSPACE/.build_env" | ||
584 | 20 | |||
585 | 21 | if [ "$TRIGGER_CI" = False ]; then | ||
586 | 22 | echo "WARNING: CI is disabled" | ||
587 | 23 | exit 0 | ||
588 | 24 | fi | ||
589 | 25 | |||
590 | 26 | exec "$BUILD_SCRIPTS"/tools/trigger-ci.py \ | ||
591 | 27 | -p "$LAUNCHPAD_PROJECT" \ | ||
592 | 28 | -j "$DEB_BUILD_JOB" \ | ||
593 | 29 | -t "$LAUNCHPAD_TEAM" | ||
594 | diff --git a/jobs/deb/deb-trigger-ci.yaml b/jobs/deb/deb-trigger-ci.yaml | |||
595 | 0 | new file mode 100644 | 30 | new file mode 100644 |
596 | index 0000000..03d71ac | |||
597 | --- /dev/null | |||
598 | +++ b/jobs/deb/deb-trigger-ci.yaml | |||
599 | @@ -0,0 +1,22 @@ | |||
600 | 1 | - job-template: | ||
601 | 2 | name: '{name}-deb-trigger-ci' | ||
602 | 3 | project-type: freestyle | ||
603 | 4 | defaults: global | ||
604 | 5 | description: "Monitor Launchpad for new merge proposals" | ||
605 | 6 | display-name: "{name}-deb-trigger-ci" | ||
606 | 7 | concurrent: true | ||
607 | 8 | node: deb && misc | ||
608 | 9 | triggers: | ||
609 | 10 | - timed: # every five minutes | ||
610 | 11 | H/5 * * * * | ||
611 | 12 | properties: | ||
612 | 13 | - build-discarder: | ||
613 | 14 | num-to-keep: 10 | ||
614 | 15 | - rebuild | ||
615 | 16 | builders: | ||
616 | 17 | - shell: | ||
617 | 18 | !include-raw: | ||
618 | 19 | - common-job-prepare.sh | ||
619 | 20 | - shell: | ||
620 | 21 | !include-raw-escape: | ||
621 | 22 | - deb-trigger-ci.sh | ||
622 | diff --git a/jobs/deb/deb-update-mp.sh b/jobs/deb/deb-update-mp.sh | |||
623 | 0 | new file mode 100644 | 23 | new file mode 100644 |
624 | index 0000000..e70e35c | |||
625 | --- /dev/null | |||
626 | +++ b/jobs/deb/deb-update-mp.sh | |||
627 | @@ -0,0 +1,30 @@ | |||
628 | 1 | #!/bin/sh | ||
629 | 2 | # | ||
630 | 3 | # Copyright (C) 2017 Canonical Ltd | ||
631 | 4 | # | ||
632 | 5 | # This program is free software: you can redistribute it and/or modify | ||
633 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
634 | 7 | # published by the Free Software Foundation. | ||
635 | 8 | # | ||
636 | 9 | # This program is distributed in the hope that it will be useful, | ||
637 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
638 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
639 | 12 | # GNU General Public License for more details. | ||
640 | 13 | # | ||
641 | 14 | # You should have received a copy of the GNU General Public License | ||
642 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
643 | 16 | |||
644 | 17 | set -ex | ||
645 | 18 | |||
646 | 19 | . "$WORKSPACE/.build_env" | ||
647 | 20 | |||
648 | 21 | if [ "$UPDATE_MPS" = False ]; then | ||
649 | 22 | echo "WARNING: MP updates are disabled" | ||
650 | 23 | exit 0 | ||
651 | 24 | fi | ||
652 | 25 | |||
653 | 26 | exec $BUILD_SCRIPTS/tools/vote-on-merge-proposal.py \ | ||
654 | 27 | -s $CI_RESULT \ | ||
655 | 28 | -u $CI_BUILD \ | ||
656 | 29 | -r $CI_REVISION \ | ||
657 | 30 | -p $CI_MERGE_PROPOSAL | ||
658 | diff --git a/jobs/deb/deb-update-mp.yaml b/jobs/deb/deb-update-mp.yaml | |||
659 | 0 | new file mode 100644 | 31 | new file mode 100644 |
660 | index 0000000..6b26001 | |||
661 | --- /dev/null | |||
662 | +++ b/jobs/deb/deb-update-mp.yaml | |||
663 | @@ -0,0 +1,31 @@ | |||
664 | 1 | - job-template: | ||
665 | 2 | name: '{name}-deb-update-mp' | ||
666 | 3 | project-type: freestyle | ||
667 | 4 | defaults: global | ||
668 | 5 | description: "Update given merge-proposal with the result of the build" | ||
669 | 6 | display-name: "{name}-deb-update-mp" | ||
670 | 7 | concurrent: true | ||
671 | 8 | node: deb && misc | ||
672 | 9 | parameters: | ||
673 | 10 | - string: | ||
674 | 11 | name: CI_RESULT | ||
675 | 12 | description: Result of the CI build | ||
676 | 13 | - string: | ||
677 | 14 | name: CI_BUILD | ||
678 | 15 | description: Jenkins URL of the build | ||
679 | 16 | - string: | ||
680 | 17 | name: CI_BRANCH | ||
681 | 18 | description: Launchpad branch that was processed | ||
682 | 19 | - string: | ||
683 | 20 | name: CI_MERGE_PROPOSAL | ||
684 | 21 | description: Launchpad merge proposal that was processed | ||
685 | 22 | - string: | ||
686 | 23 | name: CI_REVISION | ||
687 | 24 | description: Revision of the processed branch | ||
688 | 25 | builders: | ||
689 | 26 | - shell: | ||
690 | 27 | !include-raw: | ||
691 | 28 | - common-job-prepare.sh | ||
692 | 29 | - shell: | ||
693 | 30 | !include-raw-escape: | ||
694 | 31 | - deb-update-mp.sh | ||
695 | diff --git a/tools/debbuild.sh b/tools/debbuild.sh | |||
696 | 0 | new file mode 100755 | 32 | new file mode 100755 |
697 | index 0000000..2ede0c9 | |||
698 | --- /dev/null | |||
699 | +++ b/tools/debbuild.sh | |||
700 | @@ -0,0 +1,183 @@ | |||
701 | 1 | #!/bin/sh | ||
702 | 2 | # | ||
703 | 3 | # Copyright (C) 2017 Canonical Ltd | ||
704 | 4 | # | ||
705 | 5 | # This program is free software: you can redistribute it and/or modify | ||
706 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
707 | 7 | # published by the Free Software Foundation. | ||
708 | 8 | # | ||
709 | 9 | # This program is distributed in the hope that it will be useful, | ||
710 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
711 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
712 | 12 | # GNU General Public License for more details. | ||
713 | 13 | # | ||
714 | 14 | # You should have received a copy of the GNU General Public License | ||
715 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
716 | 16 | |||
717 | 17 | set -ex | ||
718 | 18 | |||
719 | 19 | if [ "$(id -u)" -ne 0 ]; then | ||
720 | 20 | echo "ERROR: You have to run this script as root!" | ||
721 | 21 | exit 1 | ||
722 | 22 | fi | ||
723 | 23 | |||
724 | 24 | SERIES=xenial | ||
725 | 25 | SOURCE_DIR= | ||
726 | 26 | RESULTS_DIR= | ||
727 | 27 | # Whenever you change the chroot in a way which needs a regeneration | ||
728 | 28 | # on the build server bump the version here. This will tell the | ||
729 | 29 | # job which updates the chroots to generate a new one. | ||
730 | 30 | CHROOT_VERSION=1 | ||
731 | 31 | BUILD_ARCH=amd64 | ||
732 | 32 | TARGET_ARCH=amd64 | ||
733 | 33 | UPDATE_CHROOT=false | ||
734 | 34 | PROXY= | ||
735 | 35 | SNAPCRAFT_EXTRA_ARGS= | ||
736 | 36 | |||
737 | 37 | while [ -n "$1" ]; do | ||
738 | 38 | case "$1" in | ||
739 | 39 | --series=*) | ||
740 | 40 | SERIES=${1#*=} | ||
741 | 41 | shift | ||
742 | 42 | ;; | ||
743 | 43 | --source-dir=*) | ||
744 | 44 | SOURCE_DIR=${1#*=} | ||
745 | 45 | shift | ||
746 | 46 | ;; | ||
747 | 47 | --results-dir=*) | ||
748 | 48 | RESULTS_DIR=${1#*=} | ||
749 | 49 | shift | ||
750 | 50 | ;; | ||
751 | 51 | --arch=*) | ||
752 | 52 | TARGET_ARCH=${1#*=} | ||
753 | 53 | BUILD_ARCH=$TARGET_ARCH | ||
754 | 54 | shift | ||
755 | 55 | ;; | ||
756 | 56 | --update-chroot) | ||
757 | 57 | UPDATE_CHROOT=true | ||
758 | 58 | shift | ||
759 | 59 | ;; | ||
760 | 60 | --proxy=*) | ||
761 | 61 | PROXY=${1#*=} | ||
762 | 62 | shift | ||
763 | 63 | ;; | ||
764 | 64 | *) | ||
765 | 65 | echo "ERROR: Unknown options $1" | ||
766 | 66 | exit 1 | ||
767 | 67 | esac | ||
768 | 68 | done | ||
769 | 69 | |||
770 | 70 | if [ -z "$SERIES" ]; then | ||
771 | 71 | echo "ERROR: No series specified" | ||
772 | 72 | exit 1 | ||
773 | 73 | fi | ||
774 | 74 | |||
775 | 75 | CHROOT_STORE_PATH=/build/chroots | ||
776 | 76 | CHROOT_TARBALL=$SERIES-$BUILD_ARCH-$CHROOT_VERSION-rootfs.tar | ||
777 | 77 | |||
778 | 78 | if [ "$UPDATE_CHROOT" = true ]; then | ||
779 | 79 | if [ ! -e $CHROOT_STORE_PATH/$CHROOT_TARBALL ] ; then | ||
780 | 80 | mkdir -p /build/chroots | ||
781 | 81 | WORKDIR=$(mktemp -d) | ||
782 | 82 | mkdir -p $WORKDIR/rootfs | ||
783 | 83 | |||
784 | 84 | DEBOOTSTRAP=debootstrap | ||
785 | 85 | DEB_REPO_URL= | ||
786 | 86 | case "$BUILD_ARCH" in | ||
787 | 87 | amd64) | ||
788 | 88 | DEB_REPO_URL="http://archive.ubuntu.com/ubuntu/" | ||
789 | 89 | ;; | ||
790 | 90 | armhf) | ||
791 | 91 | DEBOOTSTRAP=qemu-debootstrap | ||
792 | 92 | DEB_REPO_URL="http://ports.ubuntu.com/ubuntu-ports" | ||
793 | 93 | ;; | ||
794 | 94 | *) | ||
795 | 95 | echo "ERROR: Unsupported architecture $BUILD_ARCH" | ||
796 | 96 | exit 1 | ||
797 | 97 | ;; | ||
798 | 98 | esac | ||
799 | 99 | |||
800 | 100 | cleanup() { | ||
801 | 101 | rm -rf $WORKDIR | ||
802 | 102 | } | ||
803 | 103 | |||
804 | 104 | trap cleanup INT EXIT | ||
805 | 105 | |||
806 | 106 | $DEBOOTSTRAP --components=main,universe --arch $BUILD_ARCH $SERIES $WORKDIR/rootfs | ||
807 | 107 | cat << EOF > $WORKDIR/rootfs/etc/apt/sources.list.d/updates.list | ||
808 | 108 | deb $DEB_REPO_URL $SERIES universe | ||
809 | 109 | deb $DEB_REPO_URL $SERIES-updates main universe | ||
810 | 110 | EOF | ||
811 | 111 | cat << EOF > $WORKDIR/rootfs/setup.sh | ||
812 | 112 | #!/bin/sh | ||
813 | 113 | set -ex | ||
814 | 114 | apt update | ||
815 | 115 | apt upgrade -y | ||
816 | 116 | apt install -y build-essential fakeroot | ||
817 | 117 | EOF | ||
818 | 118 | chmod +x $WORKDIR/rootfs/setup.sh | ||
819 | 119 | sudo chroot $WORKDIR/rootfs /setup.sh | ||
820 | 120 | rm $WORKDIR/rootfs/setup.sh | ||
821 | 121 | |||
822 | 122 | (cd $WORKDIR/rootfs; tar cf $CHROOT_STORE_PATH/$CHROOT_TARBALL .) | ||
823 | 123 | rm -rf $WORKDIR | ||
824 | 124 | fi | ||
825 | 125 | |||
826 | 126 | exit 0 | ||
827 | 127 | fi | ||
828 | 128 | |||
829 | 129 | if [ -z "$SOURCE_DIR" ]; then | ||
830 | 130 | echo "ERROR: No source dir specified" | ||
831 | 131 | exit 1 | ||
832 | 132 | fi | ||
833 | 133 | |||
834 | 134 | if [ -z "$RESULTS_DIR" ]; then | ||
835 | 135 | echo "ERROR: No results dir specified" | ||
836 | 136 | exit 1 | ||
837 | 137 | fi | ||
838 | 138 | |||
839 | 139 | BUILDDIR=$(mktemp -d) | ||
840 | 140 | |||
841 | 141 | cleanup() { | ||
842 | 142 | rm -rf $BUILDDIR | ||
843 | 143 | } | ||
844 | 144 | |||
845 | 145 | trap cleanup INT EXIT | ||
846 | 146 | |||
847 | 147 | if [ ! -e $CHROOT_STORE_PATH/$CHROOT_TARBALL ] ; then | ||
848 | 148 | echo "ERROR: Up to date chroot tarball doesn't exist. Please run the snap-build-update-chroot job!" | ||
849 | 149 | exit 1 | ||
850 | 150 | fi | ||
851 | 151 | |||
852 | 152 | tar xf $CHROOT_STORE_PATH/$CHROOT_TARBALL -C $BUILDDIR | ||
853 | 153 | |||
854 | 154 | cp -ra $SOURCE_DIR $BUILDDIR/src | ||
855 | 155 | |||
856 | 156 | cat << EOF > $BUILDDIR/do-build.sh | ||
857 | 157 | #!/bin/sh | ||
858 | 158 | set -ex | ||
859 | 159 | apt update | ||
860 | 160 | apt upgrade -y | ||
861 | 161 | |||
862 | 162 | export LC_ALL=C.UTF-8 | ||
863 | 163 | export LANG=C.UTF-8 | ||
864 | 164 | |||
865 | 165 | cd /src | ||
866 | 166 | |||
867 | 167 | DEBCONTROL=debian/control | ||
868 | 168 | PACKAGE=$(cat $DEBIANCONTROL | grep "Source:" | awk '{print $2}') | ||
869 | 169 | |||
870 | 170 | # Install build dependencies | ||
871 | 171 | sudo apt-get -y build-dep $PACKAGE | ||
872 | 172 | |||
873 | 173 | # To access certain things we need proxy in place | ||
874 | 174 | export http_proxy=$PROXY | ||
875 | 175 | export https_proxy=$PROXY | ||
876 | 176 | |||
877 | 177 | # Build the package | ||
878 | 178 | dpkg-buildpackage -us -uc | ||
879 | 179 | EOF | ||
880 | 180 | chmod +x $BUILDDIR/do-build.sh | ||
881 | 181 | |||
882 | 182 | sudo chroot $BUILDDIR /do-build.sh | ||
883 | 183 | sudo cp $BUILDDIR/*.[dsc,deb,changes] "$RESULTS_DIR" |
PASSED: Continuous integration, rev:81e57b33d30 4d83b31b0556db0 b746cd7c9f62c4 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ 31/ /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= amd64/31 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= arm64/31 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= armhf/31 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= i386/31
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ 31/rebuild
https:/