Merge ~the-meulengracht/snappy-hwe-snaps/+git/jenkins-jobs:master into ~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-jobs:master

Proposed by Philip Meulengracht
Status: Merged
Approved by: Alfonso Sanchez-Beato
Approved revision: 09608e565bf593dfa8123f3d47b977b51df9c587
Merged at revision: 6e98ab97183668c16336e9f1fbd2f3b03f577761
Proposed branch: ~the-meulengracht/snappy-hwe-snaps/+git/jenkins-jobs:master
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/jenkins-jobs:master
Diff against target: 181 lines (+127/-9)
2 files modified
jobs/infrastructure/prepare-0-install.sh (+2/-5)
tools/vote-on-merge-proposal.py (+125/-4)
Reviewer Review Type Date Requested Status
System Enablement Bot continuous-integration Approve
Alfonso Sanchez-Beato Approve
Review via email: mp+422819@code.launchpad.net

Description of the change

Use the snap of documentation-builder instead of the python package, it caused conflicts.

Add missing methods from the JLP library that had been removed

To post a comment you must log in.
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

LGTM

review: Approve
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/jobs/infrastructure/prepare-0-install.sh b/jobs/infrastructure/prepare-0-install.sh
index afffe90..06a9f84 100644
--- a/jobs/infrastructure/prepare-0-install.sh
+++ b/jobs/infrastructure/prepare-0-install.sh
@@ -86,13 +86,10 @@ fi
86# Install snaps86# Install snaps
87$SUDO snap install snapcraft87$SUDO snap install snapcraft
88$SUDO snap install yq88$SUDO snap install yq
89$SUDO snap install documentation-builder
8990
90export http_proxy="{http_proxy}"91export http_proxy="{http_proxy}"
91export https_proxy="{https_proxy}"92export https_proxy="{http_proxy}"
9293
93# documentation-builder is normally available as a snap but we can't
94# use snaps yet on our agents.
95$SUDO pip3 install --upgrade pip94$SUDO pip3 install --upgrade pip
96$SUDO pip3 install --ignore-installed PyYAML
97$SUDO pip3 install jenkins-job-builder pid95$SUDO pip3 install jenkins-job-builder pid
98$SUDO pip3 install ubuntudesign.documentation-builder
diff --git a/tools/vote-on-merge-proposal.py b/tools/vote-on-merge-proposal.py
index 96838a7..89f7153 100755
--- a/tools/vote-on-merge-proposal.py
+++ b/tools/vote-on-merge-proposal.py
@@ -21,6 +21,7 @@ import time
21import logging21import logging
22import os22import os
23import re23import re
24from textwrap import dedent
24from shutil import rmtree25from shutil import rmtree
25from argparse import ArgumentParser26from argparse import ArgumentParser
26from launchpadlib.credentials import RequestTokenAuthorizationEngine27from launchpadlib.credentials import RequestTokenAuthorizationEngine
@@ -204,6 +205,128 @@ def get_vote_subject(mp):
204 mp.target_branch.display_name)205 mp.target_branch.display_name)
205206
206207
208def _get_result_line(result, url):
209 """Helper method for get_executed_test_runs_message.
210
211 Given a result and url it returns a string.
212 In case the result is failed it provides a link to console output:
213 FAILED: http://[...]/./distribution=quantal,flavor=amd64/267/console
214
215 In case the result is success or unstable (some tests failed) it provides
216 a link to the job:
217 SUCCESS: http://[...]/distribution=quantal,flavor=amd64/267
218
219 :param result: one of SUCCESS, UNSTABLE or FAILURE (comes from jenkins)
220 :param url: url of the build or configuration in case of matrix job
221 """
222
223 url = url.rstrip('/')
224 if result == 'SUCCESS' or result == 'UNSTABLE':
225 if url.endswith('console'):
226 # strip "/console"
227 url = url[:-8]
228 return "\n {result}: {output}".format(
229 result=result,
230 output=url)
231
232
233def get_executed_test_runs_message(url):
234 """Return a string with executed runs for a given jenkins build url.
235
236 :param url: url with jenkins build
237
238 This is an example result of this function:
239 ----snip----
240Executed test runs:
241 FAILURE: http://[...]/./distribution=raring,flavor=amd64/3/console
242 FAILURE: http://[...]/./distribution=raring,flavor=i386/3/console
243 SUCCESS: http://[...]/job-freestyle/7
244 deb: http://[...]/job-freestyle/7/artifact/work/output/*zip*/output.zip
245 UNSTABLE: http://jenkins/job/freestyle-downstream/12
246Coverity artifacts:
247 http://[...]/artifact/results/coverity/CID_10895.html
248 http://[...]/results/coverity/CID_10896.html
249 http://[...]/results/coverity/CID_10895.html
250 http://[...]/results/coverity/CID_10896.html
251 ----snip----
252 """
253
254 ret = "\nExecuted test runs:"
255 jenkins = jenkinsutils.get_json_jenkins()
256 builds = jenkinsutils.get_executed_builds(jenkins, url)
257 coverity_artifacts = []
258 for build in builds:
259 ret += _get_result_line(
260 build['result'],
261 jenkinsutils.hide_jenkins_url(build['output']))
262 if build['output'].endswith('console'):
263 build_url = build['output'][:-len('console')]
264 artifacts = jenkinsutils.get_coverity_artifacts(jenkins, build_url)
265 debs = jenkinsutils.get_deb_artifacts(jenkins, build_url)
266 if debs:
267 ret += "\n deb: {}".format(jenkinsutils.hide_jenkins_url(debs))
268 coverity_artifacts += artifacts
269 if coverity_artifacts:
270 ret += "\nCoverity artifacts:"
271 for artifact in coverity_artifacts:
272 ret += "\n {}".format(jenkinsutils.hide_jenkins_url(artifact))
273
274 return ret
275
276
277def format_message_for_mp_update(build_url, message=None,
278 include_rebuild_link=True):
279 """Return a formatted message that is then posted as comment to the merge
280 proposal.
281
282 The message consists of:
283 * message
284 * executed test-runs (and links to artifacts such as deb files)
285 * rubuild link
286
287 :params build_url: jenkins url of the build in question
288 :params message: custom message (usually PASSED/FAILED)
289 :include_rebuild_link: boolean which affects the generation of rebuild link
290
291 Example:
292 ----snip----
293 PASSED: Continuous integration, rev:114
294 http://s-jenkins.ubuntu-ci:8080/job/jenkins-launchpad-plugin-ci/267/
295 Executed test runs:
296 SUCCESS: http://[...]/distribution=quantal,flavor=amd64/267
297
298 Click here to trigger a rebuild:
299 http://s-jenkins.ubuntu-ci:8080/job/jenkins-launchpad-plugin-ci/267/rebuild
300 ----snip----
301
302 """
303 formatted_message = dedent('''\
304 {message}{build_url}{executed_test_runs}
305 ''')
306 if include_rebuild_link:
307 formatted_message = formatted_message + dedent('''\
308
309 Click here to trigger a rebuild:
310 {rebuild_url}
311 ''')
312 if not message:
313 message = ''
314 if not build_url:
315 build_url = ''
316 executed_test_runs_message = ''
317 else:
318 executed_test_runs_message = \
319 get_executed_test_runs_message(build_url)
320
321 rebuild_url = '{build_url}/rebuild'.format(
322 build_url=build_url.rstrip('/'))
323 return formatted_message.format(
324 message=message,
325 build_url=jenkinsutils.hide_jenkins_url(build_url),
326 rebuild_url=jenkinsutils.hide_jenkins_url(rebuild_url),
327 executed_test_runs=executed_test_runs_message)
328
329
207def approve_mp(mp, revision, build_url):330def approve_mp(mp, revision, build_url):
208 """Approve a given merge proposal a revision.331 """Approve a given merge proposal a revision.
209332
@@ -215,8 +338,7 @@ def approve_mp(mp, revision, build_url):
215 """338 """
216 state = 'PASSED: Continuous integration, rev:' + str(revision)339 state = 'PASSED: Continuous integration, rev:' + str(revision)
217 logger.debug(state)340 logger.debug(state)
218 content = jenkinsutils.format_message_for_mp_update(build_url,341 content = format_message_for_mp_update(build_url, state + "\n")
219 state + "\n")
220 mp.createComment(review_type=get_config_option('launchpad_review_type'),342 mp.createComment(review_type=get_config_option('launchpad_review_type'),
221 vote=LaunchpadVote.APPROVE, subject=get_vote_subject(mp),343 vote=LaunchpadVote.APPROVE, subject=get_vote_subject(mp),
222 content=content)344 content=content)
@@ -238,8 +360,7 @@ def disapprove_mp(mp, revision, build_url, reason=None):
238 state = "{state}\n{reason}".format(state=state, reason=reason)360 state = "{state}\n{reason}".format(state=state, reason=reason)
239361
240 logger.debug(state)362 logger.debug(state)
241 content = jenkinsutils.format_message_for_mp_update(363 content = format_message_for_mp_update(build_url, state + "\n")
242 build_url, state + "\n")
243 mp.createComment(review_type=get_config_option('launchpad_review_type'),364 mp.createComment(review_type=get_config_option('launchpad_review_type'),
244 vote=LaunchpadVote.NEEDS_FIXING,365 vote=LaunchpadVote.NEEDS_FIXING,
245 subject=get_vote_subject(mp),366 subject=get_vote_subject(mp),

Subscribers

People subscribed via source and target branches