Commit f42be722 authored by intrigeri's avatar intrigeri
Browse files

Handle the two (only?) cases wrt. email notification upon Jenkins build failure.

parent 57249549
......@@ -24,6 +24,11 @@ wrappers:
include:
- "**"'''
VALID_JOB_RECIPIENTS = [
'release_managers',
'whoever_broke_the_build',
]
def __init__(self, branch, snippet = JOB_SNIPPET):
assert type(branch['branch_name']) is str
assert branch['branch_name'].__len__() > 0
......@@ -32,6 +37,8 @@ wrappers:
assert type(branch['base_branch']) is bool
assert type(snippet) is str
assert snippet.__len__() > 0
assert type(branch['job_recipients']) is str
assert self.VALID_JOB_RECIPIENTS.count(branch['job_recipients'])
self.job = yaml.safe_load(snippet)
self.job['name'] = branch['job_name']
self.job['scm'] = [{'git': \
......@@ -40,8 +47,16 @@ wrappers:
'browser-url': 'https://git-tails.immerda.ch/tails/',
'url': 'gitolite@puppet-git.lizard:tails'}
}]
if branch['base_branch']:
self.job['publishers'] = [{'email': { 'recipients': TAILS_RM_EMAIL}}]
if branch['job_recipients'] == 'release_managers':
self.job['publishers'] = [
{'email': { 'recipients': TAILS_RM_EMAIL }}
]
elif branch['job_recipients'] == 'whoever_broke_the_build':
self.job['publishers'] = [
{'email': { 'sent-to-individuals': True }}
]
else:
raise ""
self.job['description'] = self.DESCRIPTION_TEMPLATE % {
'job_name': self.job['name']
}
......@@ -55,10 +70,12 @@ def get_active_branches():
Now is just a stub returning a list of branch dict."""
return [{'branch_name': 'feature/test_active_branch_job',
'job_name': 'build_Tails_ISO_feature-test_active_branch_job',
'job_recipients': 'whoever_broke_the_build',
'base_branch': False,
},
{'branch_name': 'bugfix/there_should_be_two_of_them',
'job_name': 'build_Tails_ISO_bugfix-there_should_be_two_of_them',
'job_recipients': 'release_managers',
'base_branch': True,
},
]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment