Commit 32319964 authored by bertagaz's avatar bertagaz
Browse files

Use the Activebranches module from the Tails pythonlib.

Also now takes two arguments: pathes to a Tails and a jenkins-jobs Tails
repo.
parent f42be722
#!/usr/bin/python3
import yaml
from tailslib.jenkins import ActiveBranches
TAILS_RM_EMAIL = 'tails-rm@boum.org'
......@@ -65,9 +66,9 @@ wrappers:
return yaml.safe_dump([{'job': self.job}], default_flow_style=False)
def get_active_branches():
def get_active_branches(git_repo_path):
"""Retrieve the list of active branches using the Tails python library.
Now is just a stub returning a list of branch dict."""
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',
......@@ -78,12 +79,22 @@ def get_active_branches():
'job_recipients': 'release_managers',
'base_branch': True,
},
]
]"""
branches = ActiveBranches(git_repo_path)
return branches.compute()
if __name__ == "__main__":
for branch in get_active_branches():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("Tails_git_directory",
help="Full path to the .git directory of the local Tails git repo checkout.")
parser.add_argument("Jobs_directory",
help="Full path to the output directory of the Jenkins Jobs.")
args = parser.parse_args()
for branch in get_active_branches(args.Tails_git_directory):
job = BuildTailsISOJob(branch)
job_filename = "%s.yaml" % branch['job_name']
job_filename = args.Jobs_directory + "%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