Merge ~morphis/snappy-hwe-snaps/+git/jenkins-jobs:introduce-ci-id-var into ~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-jobs:master
- Git
- lp:~morphis/snappy-hwe-snaps/+git/jenkins-jobs
- introduce-ci-id-var
- Merge into master
Status: | Merged |
---|---|
Approved by: | Alfonso Sanchez-Beato |
Approved revision: | 7d0f98c13cbd8f4b213a19b0ff1729b9929617cc |
Merged at revision: | 93c6b4fc075c28c48a8acce069fd6ea01dc89b21 |
Proposed branch: | ~morphis/snappy-hwe-snaps/+git/jenkins-jobs:introduce-ci-id-var |
Merge into: | ~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-jobs:master |
Diff against target: |
406 lines (+176/-82) 11 files modified
jobs/snap/common-job-prepare.sh (+2/-1) jobs/snap/snap-build-prepare.sh (+88/-0) jobs/snap/snap-build-prepare.yaml (+63/-0) jobs/snap/snap-build-worker.sh (+2/-62) jobs/snap/snap-build-worker.yaml (+4/-0) jobs/snap/snap-build.yaml (+5/-5) jobs/snap/snap-cleanup.sh (+1/-0) jobs/snap/snap-cleanup.yaml (+4/-4) jobs/snap/snap-project-jobs.yaml (+1/-0) jobs/snap/snap-test.sh (+3/-7) jobs/snap/snap-test.yaml (+3/-3) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alfonso Sanchez-Beato | Approve | ||
System Enablement Bot | continuous-integration | Approve | |
Konrad Zapałowicz (community) | Approve | ||
Jim Hodapp (community) | Approve | ||
Review via email: mp+331269@code.launchpad.net |
Commit message
Description of the change
Introduce new CI_ID variable which is handed from the top-level snap-build job to all subsequently triggered jobs and will identify the CI iteration. CI_ID is filled from BUILD_ID which is unique for each snap-build run.
This MP also changes the snap-test job to consume the same CI repository as the build job does so we have to merge target and source only once.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:044ee229735
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
Thanks, just one comment, see below.
Also, do we have a different BUILD_TAG for each architecture? We would need that too, or move the part that creates the repo from snap-build-worker (one per arch) to snap-build.
Simon Fels (morphis) wrote : | # |
Yeah, I have implemented a snap-build-prepare job locally already which will be the origin of the BUILD_ID variable and will prepare the repository once and for all subsequent builds.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:0dd187225f0
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:db10c6bd458
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
Looks good, just some minor nits.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:7d0f98c13cb
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
LGTM, thanks for the changes
Preview Diff
1 | diff --git a/jobs/snap/common-job-prepare.sh b/jobs/snap/common-job-prepare.sh | |||
2 | index 8c622ae..9b5b8f4 100644 | |||
3 | --- a/jobs/snap/common-job-prepare.sh | |||
4 | +++ b/jobs/snap/common-job-prepare.sh | |||
5 | @@ -47,11 +47,12 @@ cat << EOF > $WORKSPACE/.build_env | |||
6 | 47 | BOT_USERNAME={bot_username} | 47 | BOT_USERNAME={bot_username} |
7 | 48 | LAUNCHPAD_PROJECT={launchpad_project} | 48 | LAUNCHPAD_PROJECT={launchpad_project} |
8 | 49 | LAUNCHPAD_TEAM={launchpad_team} | 49 | LAUNCHPAD_TEAM={launchpad_team} |
10 | 50 | SNAP_BUILD_JOB={name}-snap-build | 50 | SNAP_BUILD_JOB={name}-snap-build-prepare |
11 | 51 | BUILD_SCRIPTS=$WORKSPACE/jenkins-jobs | 51 | BUILD_SCRIPTS=$WORKSPACE/jenkins-jobs |
12 | 52 | BUILD_ON_LAUNCHPAD={build_on_launchpad} | 52 | BUILD_ON_LAUNCHPAD={build_on_launchpad} |
13 | 53 | AUTO_MERGE={auto_merge} | 53 | AUTO_MERGE={auto_merge} |
14 | 54 | TRIGGER_CI={trigger_ci} | 54 | TRIGGER_CI={trigger_ci} |
15 | 55 | UPDATE_MPS={update_mps} | 55 | UPDATE_MPS={update_mps} |
16 | 56 | RUN_TESTS={run_tests} | 56 | RUN_TESTS={run_tests} |
17 | 57 | CI_REPO=ci-build-${{CI_ID}} | ||
18 | 57 | EOF | 58 | EOF |
19 | diff --git a/jobs/snap/snap-build-prepare.sh b/jobs/snap/snap-build-prepare.sh | |||
20 | 58 | new file mode 100644 | 59 | new file mode 100644 |
21 | index 0000000..77940d1 | |||
22 | --- /dev/null | |||
23 | +++ b/jobs/snap/snap-build-prepare.sh | |||
24 | @@ -0,0 +1,88 @@ | |||
25 | 1 | #!/bin/bash | ||
26 | 2 | # | ||
27 | 3 | # Copyright (C) 2017 Canonical Ltd | ||
28 | 4 | # | ||
29 | 5 | # This program is free software: you can redistribute it and/or modify | ||
30 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
31 | 7 | # published by the Free Software Foundation. | ||
32 | 8 | # | ||
33 | 9 | # This program is distributed in the hope that it will be useful, | ||
34 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
35 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
36 | 12 | # GNU General Public License for more details. | ||
37 | 13 | # | ||
38 | 14 | # You should have received a copy of the GNU General Public License | ||
39 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
40 | 16 | |||
41 | 17 | set -ex | ||
42 | 18 | |||
43 | 19 | . "$WORKSPACE/.build_env" | ||
44 | 20 | |||
45 | 21 | # CI_ID isn't specified yet when we're being called so initialize | ||
46 | 22 | # it here with the same value as we do in snap-build-prepare.yaml | ||
47 | 23 | if [ -z "$CI_ID" ]; then | ||
48 | 24 | CI_ID=$BUILD_ID | ||
49 | 25 | fi | ||
50 | 26 | |||
51 | 27 | rm -rf $WORKSPACE/src | ||
52 | 28 | |||
53 | 29 | git clone --no-checkout $TARGET_GIT_REPO $WORKSPACE/src | ||
54 | 30 | cd $WORKSPACE/src | ||
55 | 31 | for remote in $(git branch -r | grep -v origin/master); do | ||
56 | 32 | git checkout --track $remote | ||
57 | 33 | done | ||
58 | 34 | |||
59 | 35 | git checkout $TARGET_GIT_REPO_BRANCH | ||
60 | 36 | |||
61 | 37 | git config user.name "System Enablement CI Bot" | ||
62 | 38 | git config user.email "ce-system-enablement@lists.canonical.com" | ||
63 | 39 | |||
64 | 40 | if [ -n "$SOURCE_GIT_REPO" ]; then | ||
65 | 41 | git remote add other $SOURCE_GIT_REPO | ||
66 | 42 | git fetch other | ||
67 | 43 | git merge \ | ||
68 | 44 | --no-ff \ | ||
69 | 45 | -m "Merge remote tracking branch other/$SOURCE_GIT_REPO_BRANCH" \ | ||
70 | 46 | $REVISION | ||
71 | 47 | fi | ||
72 | 48 | |||
73 | 49 | # Try to find the correct branch we need to build from. In the case that | ||
74 | 50 | # $TARGET_GIT_REPO_BRANCH points us to an upstream component branch we | ||
75 | 51 | # will take master as the next suitable candidate. | ||
76 | 52 | CI_BRANCH= | ||
77 | 53 | SNAPCRAFT_YAML_PATH= | ||
78 | 54 | for branch in $TARGET_GIT_REPO_BRANCH master ; do | ||
79 | 55 | git checkout $branch | ||
80 | 56 | if [ -e snapcraft.yaml ]; then | ||
81 | 57 | SNAPCRAFT_YAML_PATH=snapcraft.yaml | ||
82 | 58 | elif [ -e snap/snapcraft.yaml ]; then | ||
83 | 59 | SNAPCRAFT_YAML_PATH=snap/snapcraft.yaml | ||
84 | 60 | fi | ||
85 | 61 | |||
86 | 62 | if [ -n "$SNAPCRAFT_YAML_PATH" ]; then | ||
87 | 63 | CI_BRANCH=$branch | ||
88 | 64 | break | ||
89 | 65 | fi | ||
90 | 66 | done | ||
91 | 67 | |||
92 | 68 | if [ -z "$CI_BRANCH" ]; then | ||
93 | 69 | echo "WARNING: Can't build snap as no snapcraft.yaml exists!" | ||
94 | 70 | exit 0 | ||
95 | 71 | fi | ||
96 | 72 | |||
97 | 73 | REPO_NAME=$(awk -v a="$TARGET_GIT_REPO" 'BEGIN{print substr(a, index(a, "+git/") + 5)}') | ||
98 | 74 | # We rely on the snapcraft.yaml to have the snap name in the first five lines | ||
99 | 75 | # which is the case for all our snaps. This is a bit lazy but the best way to | ||
100 | 76 | # ensure we don't fetch any other name: fields which might be present in the file. | ||
101 | 77 | SNAP_NAME=$(cat $SNAPCRAFT_YAML_PATH | grep -v ^\# | head -n 5 | grep "^name:" | awk '{print $2}') | ||
102 | 78 | SNAP_REV=$(git rev-parse --short HEAD) | ||
103 | 79 | CI_REPO=ci-build-$CI_ID | ||
104 | 80 | |||
105 | 81 | sed -i "s/~$LAUNCHPAD_TEAM\/$LAUNCHPAD_PROJECT\/+git\/$REPO_NAME/~$LAUNCHPAD_TEAM\/$LAUNCHPAD_PROJECT\/+git\/$CI_REPO/g" \ | ||
106 | 82 | $SNAPCRAFT_YAML_PATH | ||
107 | 83 | git add snapcraft.yaml | ||
108 | 84 | git commit -m "Update snapcraft.yaml to build from right repository" | ||
109 | 85 | |||
110 | 86 | git remote add jenkins-ci git+ssh://$BOT_USERNAME@git.launchpad.net/~$LAUNCHPAD_TEAM/$LAUNCHPAD_PROJECT/+git/$CI_REPO | ||
111 | 87 | git push jenkins-ci --all | ||
112 | 88 | git push jenkins-ci --tags | ||
113 | diff --git a/jobs/snap/snap-build-prepare.yaml b/jobs/snap/snap-build-prepare.yaml | |||
114 | 0 | new file mode 100644 | 89 | new file mode 100644 |
115 | index 0000000..49c504e | |||
116 | --- /dev/null | |||
117 | +++ b/jobs/snap/snap-build-prepare.yaml | |||
118 | @@ -0,0 +1,63 @@ | |||
119 | 1 | - job-template: | ||
120 | 2 | name: '{name}-snap-build-prepare' | ||
121 | 3 | project-type: freestyle | ||
122 | 4 | defaults: global | ||
123 | 5 | description: "" | ||
124 | 6 | display-name: "{name}-snap-build-prepare" | ||
125 | 7 | concurrent: true | ||
126 | 8 | node: snap && misc | ||
127 | 9 | properties: | ||
128 | 10 | - build-discarder: | ||
129 | 11 | num-to-keep: 10 | ||
130 | 12 | - rebuild | ||
131 | 13 | parameters: | ||
132 | 14 | - string: | ||
133 | 15 | name: TARGET_GIT_REPO | ||
134 | 16 | default: | ||
135 | 17 | description: "Target git repository" | ||
136 | 18 | - string: | ||
137 | 19 | name: TARGET_GIT_REPO_BRANCH | ||
138 | 20 | default: master | ||
139 | 21 | description: "Branch of the target git repository to build from" | ||
140 | 22 | - string: | ||
141 | 23 | name: SERIES | ||
142 | 24 | default: xenial | ||
143 | 25 | description: "Ubuntu archive series to build for" | ||
144 | 26 | - string: | ||
145 | 27 | name: FORCE | ||
146 | 28 | default: "0" | ||
147 | 29 | description: "Set to 1 to force the build" | ||
148 | 30 | - string: | ||
149 | 31 | name: SOURCE_GIT_REPO | ||
150 | 32 | default: | ||
151 | 33 | description: "Source git repository" | ||
152 | 34 | - string: | ||
153 | 35 | name: SOURCE_GIT_REPO_BRANCH | ||
154 | 36 | default: | ||
155 | 37 | description: "Branch of the source git repository to use" | ||
156 | 38 | - string: | ||
157 | 39 | name: MERGE_PROPOSAL | ||
158 | 40 | default: | ||
159 | 41 | description: "Link to the merge proposal this build relates to" | ||
160 | 42 | - string: | ||
161 | 43 | name: REVISION | ||
162 | 44 | default: | ||
163 | 45 | description: "Cleanup the whole workspace" | ||
164 | 46 | - string: | ||
165 | 47 | name: CLEANUP_WORKSPACE | ||
166 | 48 | default: "0" | ||
167 | 49 | description: "Cleanup the whole workspace" | ||
168 | 50 | builders: | ||
169 | 51 | - shell: | ||
170 | 52 | !include-raw: | ||
171 | 53 | - common-job-prepare.sh | ||
172 | 54 | - shell: | ||
173 | 55 | !include-raw-escape: | ||
174 | 56 | - snap-build-prepare.sh | ||
175 | 57 | - trigger-builds: | ||
176 | 58 | - project: '{name}-snap-build' | ||
177 | 59 | current-parameters: true | ||
178 | 60 | predefined-parameters: | | ||
179 | 61 | CI_ID=$BUILD_ID | ||
180 | 62 | RESULTS_ID=$BUILD_TAG | ||
181 | 63 | block: true | ||
182 | diff --git a/jobs/snap/snap-build-worker.sh b/jobs/snap/snap-build-worker.sh | |||
183 | index 02ee65c..99a1f75 100644 | |||
184 | --- a/jobs/snap/snap-build-worker.sh | |||
185 | +++ b/jobs/snap/snap-build-worker.sh | |||
186 | @@ -18,60 +18,9 @@ set -ex | |||
187 | 18 | 18 | ||
188 | 19 | . "$WORKSPACE/.build_env" | 19 | . "$WORKSPACE/.build_env" |
189 | 20 | 20 | ||
191 | 21 | rm -rf $WORKSPACE/src $WORKSPACE/results $WORKSPACE/build-props | 21 | rm -rf $WORKSPACE/src $WORKSPACE/results |
192 | 22 | 22 | ||
245 | 23 | git clone --no-checkout $TARGET_GIT_REPO $WORKSPACE/src | 23 | git clone git+ssh://$BOT_USERNAME@git.launchpad.net/~$LAUNCHPAD_TEAM/$LAUNCHPAD_PROJECT/+git/$CI_REPO $WORKSPACE/src |
194 | 24 | cd $WORKSPACE/src | ||
195 | 25 | for remote in `git branch -r | grep -v origin/master`; do git checkout --track $remote ; done | ||
196 | 26 | |||
197 | 27 | git checkout $TARGET_GIT_REPO_BRANCH | ||
198 | 28 | |||
199 | 29 | git config user.name "System Enablement CI Bot" | ||
200 | 30 | git config user.email "ce-system-enablement@lists.canonical.com" | ||
201 | 31 | |||
202 | 32 | if [ -n "$SOURCE_GIT_REPO" ]; then | ||
203 | 33 | git remote add other $SOURCE_GIT_REPO | ||
204 | 34 | git fetch other | ||
205 | 35 | git merge \ | ||
206 | 36 | --no-ff \ | ||
207 | 37 | -m "Merge remote tracking branch other/$SOURCE_GIT_REPO_BRANCH" \ | ||
208 | 38 | $REVISION | ||
209 | 39 | fi | ||
210 | 40 | |||
211 | 41 | # Try to find the correct branch we need to build from. In the case that | ||
212 | 42 | # $TARGET_GIT_REPO_BRANCH points us to an upstream component branch we | ||
213 | 43 | # will take master as the next suitable candidate. | ||
214 | 44 | CI_BRANCH= | ||
215 | 45 | SNAPCRAFT_YAML_PATH= | ||
216 | 46 | for branch in $TARGET_GIT_REPO_BRANCH master ; do | ||
217 | 47 | git checkout $branch | ||
218 | 48 | if [ -e snapcraft.yaml ]; then | ||
219 | 49 | SNAPCRAFT_YAML_PATH=snapcraft.yaml | ||
220 | 50 | elif [ -e snap/snapcraft.yaml ]; then | ||
221 | 51 | SNAPCRAFT_YAML_PATH=snap/snapcraft.yaml | ||
222 | 52 | fi | ||
223 | 53 | |||
224 | 54 | if [ -n "$SNAPCRAFT_YAML_PATH" ]; then | ||
225 | 55 | CI_BRANCH=$branch | ||
226 | 56 | break | ||
227 | 57 | fi | ||
228 | 58 | done | ||
229 | 59 | |||
230 | 60 | if [ -z "$CI_BRANCH" ]; then | ||
231 | 61 | echo "WARNING: Can't build snap as no snapcraft.yaml exists!" | ||
232 | 62 | exit 0 | ||
233 | 63 | fi | ||
234 | 64 | |||
235 | 65 | REPO_NAME=$(awk -v a="$TARGET_GIT_REPO" 'BEGIN{print substr(a, index(a, "+git/") + 5)}') | ||
236 | 66 | # We rely on the snapcraft.yaml to have the snap name in the first five lines | ||
237 | 67 | # which is the case for all our snaps. This is a bit lazy but the best way to | ||
238 | 68 | # ensure we don't fetch any other name: fields which might be present in the file. | ||
239 | 69 | SNAP_NAME=$(cat $SNAPCRAFT_YAML_PATH | grep -v ^\# | head -n 5 | grep "^name:" | awk '{print $2}') | ||
240 | 70 | SNAP_REV=$(git rev-parse --short HEAD) | ||
241 | 71 | CI_REPO=$REPO_NAME-$BUILD_ID-$SNAP_REV | ||
242 | 72 | |||
243 | 73 | sed -i "s/~$LAUNCHPAD_TEAM\/$LAUNCHPAD_PROJECT\/+git\/$REPO_NAME/~$LAUNCHPAD_TEAM\/$LAUNCHPAD_PROJECT\/+git\/$CI_REPO/g" \ | ||
244 | 74 | $SNAPCRAFT_YAML_PATH | ||
246 | 75 | 24 | ||
247 | 76 | # The project as two different options of how snaps can be build: | 25 | # The project as two different options of how snaps can be build: |
248 | 77 | # | 26 | # |
249 | @@ -118,15 +67,6 @@ if [ "$BUILD_ON_LAUNCHPAD" = False ]; then | |||
250 | 118 | --proxy=http://squid.internal:3128 \ | 67 | --proxy=http://squid.internal:3128 \ |
251 | 119 | $SNAPBUILD_EXTRA_ARGS | 68 | $SNAPBUILD_EXTRA_ARGS |
252 | 120 | else | 69 | else |
253 | 121 | git remote add jenkins-ci git+ssh://$BOT_USERNAME@git.launchpad.net/~$LAUNCHPAD_TEAM/$LAUNCHPAD_PROJECT/+git/$CI_REPO | ||
254 | 122 | git push jenkins-ci --all | ||
255 | 123 | git push jenkins-ci --tags | ||
256 | 124 | |||
257 | 125 | # Save repo name as soon as it gets created so it can be deleted by the cleanup | ||
258 | 126 | # job even if this job fails. | ||
259 | 127 | echo "CI_REPO=$CI_REPO" >> $WORKSPACE/build-props | ||
260 | 128 | echo "CI_BRANCH=$CI_BRANCH" >> $WORKSPACE/build-props | ||
261 | 129 | |||
262 | 130 | EXTRA_ARGS= | 70 | EXTRA_ARGS= |
263 | 131 | if [ -n "$ARCHITECTURE" ]; then | 71 | if [ -n "$ARCHITECTURE" ]; then |
264 | 132 | EXTRA_ARGS="$EXTRA_ARGS --architectures=$ARCHITECTURE" | 72 | EXTRA_ARGS="$EXTRA_ARGS --architectures=$ARCHITECTURE" |
265 | diff --git a/jobs/snap/snap-build-worker.yaml b/jobs/snap/snap-build-worker.yaml | |||
266 | index 6b45a89..6a306f5 100644 | |||
267 | --- a/jobs/snap/snap-build-worker.yaml | |||
268 | +++ b/jobs/snap/snap-build-worker.yaml | |||
269 | @@ -60,6 +60,10 @@ | |||
270 | 60 | default: stable | 60 | default: stable |
271 | 61 | description: "Channel of the core snap to use for testing the build snap" | 61 | description: "Channel of the core snap to use for testing the build snap" |
272 | 62 | - string: | 62 | - string: |
273 | 63 | name: CI_ID | ||
274 | 64 | default: '' | ||
275 | 65 | description: "Numeric id which will identify the CI iteration through all downstream builds" | ||
276 | 66 | - string: | ||
277 | 63 | name: RESULTS_ID | 67 | name: RESULTS_ID |
278 | 64 | default: '' | 68 | default: '' |
279 | 65 | description: "Alphanumeric identifier used to pass build artifacts through different jobs" | 69 | description: "Alphanumeric identifier used to pass build artifacts through different jobs" |
280 | diff --git a/jobs/snap/snap-build.yaml b/jobs/snap/snap-build.yaml | |||
281 | index e22e8d9..3aa338b 100644 | |||
282 | --- a/jobs/snap/snap-build.yaml | |||
283 | +++ b/jobs/snap/snap-build.yaml | |||
284 | @@ -49,12 +49,15 @@ | |||
285 | 49 | name: CLEANUP_WORKSPACE | 49 | name: CLEANUP_WORKSPACE |
286 | 50 | default: "0" | 50 | default: "0" |
287 | 51 | description: "Cleanup the whole workspace" | 51 | description: "Cleanup the whole workspace" |
288 | 52 | - string: | ||
289 | 53 | name: CI_ID | ||
290 | 54 | default: '' | ||
291 | 55 | description: "Numeric id which will identify the CI iteration through all downstream builds" | ||
292 | 52 | builders: | 56 | builders: |
293 | 53 | - trigger-builds: | 57 | - trigger-builds: |
294 | 54 | - project: '{name}-snap-build-worker' | 58 | - project: '{name}-snap-build-worker' |
295 | 55 | current-parameters: true | 59 | current-parameters: true |
296 | 56 | predefined-parameters: | | 60 | predefined-parameters: | |
297 | 57 | RESULTS_ID=$BUILD_TAG | ||
298 | 58 | ARCHITECTURE=$ARCHITECTURE | 61 | ARCHITECTURE=$ARCHITECTURE |
299 | 59 | block: true | 62 | block: true |
300 | 60 | - project: '{name}-snap-docs' | 63 | - project: '{name}-snap-docs' |
301 | @@ -63,13 +66,10 @@ | |||
302 | 63 | - project: '{name}-snap-test' | 66 | - project: '{name}-snap-test' |
303 | 64 | current-parameters: true | 67 | current-parameters: true |
304 | 65 | predefined-parameters: | | 68 | predefined-parameters: | |
306 | 66 | RESULTS_ID=$BUILD_TAG | 69 | ARCHITECTURE=$ARCHITECTURE |
307 | 67 | block: true | 70 | block: true |
308 | 68 | - project: '{name}-snap-cleanup' | 71 | - project: '{name}-snap-cleanup' |
309 | 69 | current-parameters: true | 72 | current-parameters: true |
310 | 70 | predefined-parameters: | | ||
311 | 71 | RESULTS_ID=$BUILD_TAG | ||
312 | 72 | property-file: build-props | ||
313 | 73 | publishers: | 73 | publishers: |
314 | 74 | - archive: | 74 | - archive: |
315 | 75 | artifacts: '**/*.snap' | 75 | artifacts: '**/*.snap' |
316 | diff --git a/jobs/snap/snap-cleanup.sh b/jobs/snap/snap-cleanup.sh | |||
317 | index bf0e03c..e1b42d6 100644 | |||
318 | --- a/jobs/snap/snap-cleanup.sh | |||
319 | +++ b/jobs/snap/snap-cleanup.sh | |||
320 | @@ -19,6 +19,7 @@ set -x | |||
321 | 19 | . "$WORKSPACE/.build_env" | 19 | . "$WORKSPACE/.build_env" |
322 | 20 | 20 | ||
323 | 21 | # Delete auxiliary repo used in the build | 21 | # Delete auxiliary repo used in the build |
324 | 22 | CI_REPO="ci-build-$CI_ID" | ||
325 | 22 | $BUILD_SCRIPTS/tools/delete-ci-repo.py \ | 23 | $BUILD_SCRIPTS/tools/delete-ci-repo.py \ |
326 | 23 | --git-repo=https://git.launchpad.net/~$LAUNCHPAD_TEAM/$LAUNCHPAD_PROJECT/+git/$CI_REPO | 24 | --git-repo=https://git.launchpad.net/~$LAUNCHPAD_TEAM/$LAUNCHPAD_PROJECT/+git/$CI_REPO |
327 | 24 | 25 | ||
328 | diff --git a/jobs/snap/snap-cleanup.yaml b/jobs/snap/snap-cleanup.yaml | |||
329 | index 8aa4a03..1086c68 100644 | |||
330 | --- a/jobs/snap/snap-cleanup.yaml | |||
331 | +++ b/jobs/snap/snap-cleanup.yaml | |||
332 | @@ -8,11 +8,11 @@ | |||
333 | 8 | node: snap && build | 8 | node: snap && build |
334 | 9 | parameters: | 9 | parameters: |
335 | 10 | - string: | 10 | - string: |
339 | 11 | name: CI_REPO | 11 | name: CI_ID |
340 | 12 | default: "" | 12 | default: '' |
341 | 13 | description: "Auxiliary repo for the build, that we will remove" | 13 | description: "Numeric id which will identify the CI iteration through all downstream builds" |
342 | 14 | - string: | 14 | - string: |
344 | 15 | name: "RESULTS_ID" | 15 | name: RESULTS_ID |
345 | 16 | default: "" | 16 | default: "" |
346 | 17 | description: "Alphanumeric Id of the results being staged on the remote worker" | 17 | description: "Alphanumeric Id of the results being staged on the remote worker" |
347 | 18 | - string: | 18 | - string: |
348 | diff --git a/jobs/snap/snap-project-jobs.yaml b/jobs/snap/snap-project-jobs.yaml | |||
349 | index 05e4f3f..2f9b0d8 100644 | |||
350 | --- a/jobs/snap/snap-project-jobs.yaml | |||
351 | +++ b/jobs/snap/snap-project-jobs.yaml | |||
352 | @@ -5,6 +5,7 @@ | |||
353 | 5 | - '{name}-snap-build-worker' | 5 | - '{name}-snap-build-worker' |
354 | 6 | - '{name}-snap-build-update-chroot' | 6 | - '{name}-snap-build-update-chroot' |
355 | 7 | - '{name}-snap-build' | 7 | - '{name}-snap-build' |
356 | 8 | - '{name}-snap-build-prepare' | ||
357 | 8 | - '{name}-snap-cleanup' | 9 | - '{name}-snap-cleanup' |
358 | 9 | - '{name}-snap-release' | 10 | - '{name}-snap-release' |
359 | 10 | - '{name}-snap-test' | 11 | - '{name}-snap-test' |
360 | diff --git a/jobs/snap/snap-test.sh b/jobs/snap/snap-test.sh | |||
361 | index 752b375..66876ed 100644 | |||
362 | --- a/jobs/snap/snap-test.sh | |||
363 | +++ b/jobs/snap/snap-test.sh | |||
364 | @@ -38,12 +38,9 @@ REMOTE_WORKSPACE=/home/$REMOTE_USER/$BUILD_TAG | |||
365 | 38 | REMOTE_RESULTS_BASE_DIR=/home/$REMOTE_USER/results | 38 | REMOTE_RESULTS_BASE_DIR=/home/$REMOTE_USER/results |
366 | 39 | 39 | ||
367 | 40 | tmp_srcdir=$(mktemp -d) | 40 | tmp_srcdir=$(mktemp -d) |
369 | 41 | git clone --depth 1 -b $SOURCE_GIT_REPO_BRANCH $SOURCE_GIT_REPO $tmp_srcdir/src | 41 | CI_REPO="ci-build-$CI_ID" |
370 | 42 | git clone --depth 1 -b $CI_BRANCH https://git.launchpad.net/~$LAUNCHPAD_TEAM/$LAUNCHPAD_PROJECT/+git/$CI_REPO | ||
371 | 42 | cd $tmp_srcdir/src | 43 | cd $tmp_srcdir/src |
372 | 43 | # This will fail as we have set set -e above when the revision isn't part of | ||
373 | 44 | # of the repository we've cloned. | ||
374 | 45 | git branch --contains $SOURCE_GIT_REPO_REVISION | grep "$SOURCE_GIT_REPO_BRANCH" | ||
375 | 46 | git checkout -b ci-test $SOURCE_GIT_REPO_REVISION | ||
376 | 47 | 44 | ||
377 | 48 | # Components have the ability to disable CI tests if they can't provide any. | 45 | # Components have the ability to disable CI tests if they can't provide any. |
378 | 49 | # This only accepted in a few cases and should be generally avoided. | 46 | # This only accepted in a few cases and should be generally avoided. |
379 | @@ -86,9 +83,8 @@ go build github.com/snapcore/spread/cmd/spread | |||
380 | 86 | mkdir /build/bin | 83 | mkdir /build/bin |
381 | 87 | cp spread /build/bin | 84 | cp spread /build/bin |
382 | 88 | 85 | ||
384 | 89 | git clone --depth 1 -b $SOURCE_GIT_REPO_BRANCH $SOURCE_GIT_REPO /build/src | 86 | git clone --depth 1 -b $CI_BRANCH https://git.launchpad.net/~$LAUNCHPAD_TEAM/$LAUNCHPAD_PROJECT/+git/$CI_REPO /build/src |
385 | 90 | cd /build/src | 87 | cd /build/src |
386 | 91 | git checkout -b ci-tests $SOURCE_GIT_REPO_REVISION | ||
387 | 92 | 88 | ||
388 | 93 | # Copy any stage results from previous generic-build-snap-worker builds | 89 | # Copy any stage results from previous generic-build-snap-worker builds |
389 | 94 | cp -v /build/results/*.snap /build/src | 90 | cp -v /build/results/*.snap /build/src |
390 | diff --git a/jobs/snap/snap-test.yaml b/jobs/snap/snap-test.yaml | |||
391 | index 9cc5cea..d0f18d5 100644 | |||
392 | --- a/jobs/snap/snap-test.yaml | |||
393 | +++ b/jobs/snap/snap-test.yaml | |||
394 | @@ -56,9 +56,9 @@ | |||
395 | 56 | default: "" | 56 | default: "" |
396 | 57 | description: "Branch on which the tests should be executed" | 57 | description: "Branch on which the tests should be executed" |
397 | 58 | - string: | 58 | - string: |
401 | 59 | name: CI_REPO | 59 | name: CI_ID |
402 | 60 | default: "" | 60 | default: '' |
403 | 61 | description: "Git repository to use for testing (MUST contain $CI_BRANCH)" | 61 | description: "Numeric id which will identify the CI iteration through all downstream builds" |
404 | 62 | builders: | 62 | builders: |
405 | 63 | - shell: | 63 | - shell: |
406 | 64 | !include-raw: | 64 | !include-raw: |
PASSED: Continuous integration, rev:7561421bf84 91bc08e65e25ce0 b3b61b6aa52ee5 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ 8/ /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= amd64/8 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= arm64/8 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= armhf/8 /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-build/ ARCHITECTURE= i386/8
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/ 8/rebuild
https:/