diff --git a/ci/jobgenerator.py b/ci/jobgenerator.py index c91b7d0..9805b84 100755 --- a/ci/jobgenerator.py +++ b/ci/jobgenerator.py @@ -147,6 +147,8 @@ class Generator: PACKAGING_BRANCH_S=s_branch, NAME=data["name"], DEFAULT_BRANCH=default_branch) + elif job_type == "release-mgmt": + package_config = template.render() else: raise ValueError("Invalid job type") @@ -194,7 +196,13 @@ class Generator: view = server.views.create("merger") view.add_job(job_name) + total_rel = set() + for release in package["releases"]: + # Add the release to the total release set, which is used to + # generate the management jobs + total_rel.add(release) + # Load the config given the current data package["release"] = release for jobtype in ["unstable", "stable"]: @@ -206,16 +214,31 @@ class Generator: job.update_config(package_config) else: job = server.create_job(job_name, str(package_config)) - # With an existing job we can assume it's already in an - # appropriate view. With new jobs, we should see if the - # view exists, and if it doesn't, create it - viewname = release + " " + jobtype - if viewname in server.views: - view = server.views[viewname] - else: - view = server.views.create(viewname) - - view.add_job(job_name) + + viewname = release + " " + jobtype + if viewname in server.views: + view = server.views[viewname] + else: + view = server.views.create(viewname) + + view.add_job(job_name) + + # Generate a management job for every release, stable and unstable + for release in total_rel: + for jobtype in ["unstable", "stable"]: + package_config = self.load_config("release-mgmt") + jobname = "mgmt_build_" + release + "_" + jobtype + if job_name in jobs: + job = server.get_job(job_name) + job.update_config(package_config) + else: + job = server.create_job(job_name, str(package_config)) + + # The mgmt view should be the first view created, we don't + # have to create it if it doesn't exist because that's a + # Huge Problem anyway + view = server.views["mgmt"] + view.addjob(jobname) if __name__ == "__main__": diff --git a/templates/merger.xml b/templates/merger.xml index 4d3010b..f2d833b 100644 --- a/templates/merger.xml +++ b/templates/merger.xml @@ -37,7 +37,7 @@ - jobgenerator + merger SUCCESS 0 diff --git a/templates/package-stable.xml b/templates/package-stable.xml index b87f05d..31c4569 100644 --- a/templates/package-stable.xml +++ b/templates/package-stable.xml @@ -31,7 +31,7 @@ - merger_{{ NAME }} + merger_{{ NAME }}, mgmt_build_{{ RELEASE }}_stable SUCCESS 0 diff --git a/templates/package-unstable.xml b/templates/package-unstable.xml index 7ae32cc..17e1426 100644 --- a/templates/package-unstable.xml +++ b/templates/package-unstable.xml @@ -31,7 +31,7 @@ - merger_{{ NAME }} + merger_{{ NAME }}, mgmt_build_{{ RELEASE }}_unstable SUCCESS 0 diff --git a/templates/release-mgmt.xml b/templates/release-mgmt.xml new file mode 100644 index 0000000..d3c2490 --- /dev/null +++ b/templates/release-mgmt.xml @@ -0,0 +1,26 @@ + + + + false + + + true + false + false + false + + + + jobgenerator + + SUCCESS + 0 + BLUE + true + + + + false + + +