Commit 3036e0da authored by intrigeri's avatar intrigeri
Browse files

Move the default JOB_SNIPPET to a class constant, and make it optional to...

Move the default JOB_SNIPPET to a class constant, and make it optional to configure it via the constructor.
parent cd3cb57f
......@@ -10,7 +10,21 @@ class BuildTailsISOJob:
'''<p>This job is managed by jenkins-job-builder. Do not edit it through this web interface, your changes would be overwritten.</p>
<p>You can <a href="http://nightly.tails.boum.org/%(job_name)s/">download build results</a>.</p>'''
def __init__(self, snippet, branch):
JOB_SNIPPET = '''node: isobuilder1 || isobuilder2
builders:
- build_Tails_ISO
- clean_Archives
triggers:
- pollscm: '@weekly'
- timed: '@daily'
wrappers:
- timestamps
- workspace-cleanup:
dirmatch: true
include:
- "**"'''
def __init__(self, branch, snippet = JOB_SNIPPET):
assert type(branch['branch_name']) is str
assert branch['branch_name'].__len__() > 0
assert type(branch['job_name']) is str
......@@ -49,24 +63,9 @@ def get_active_branches():
},
]
JOB_SNIPPET = '''node: isobuilder1 || isobuilder2
builders:
- build_Tails_ISO
- clean_Archives
triggers:
- pollscm: '@weekly'
- timed: '@daily'
wrappers:
- timestamps
- workspace-cleanup:
dirmatch: true
include:
- "**"'''
if __name__ == "__main__":
for branch in get_active_branches():
job = BuildTailsISOJob(JOB_SNIPPET, branch)
job = BuildTailsISOJob(branch)
job_filename = "%s.yaml" % branch['job_name']
with open(job_filename, 'w') as job_file:
job_file.write(str(job))
......
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