Bring the management job creation outside the scope of the main loop.

master
Simon Quigley 6 years ago
parent 84cb5542c5
commit 55f157a0f2

@ -181,6 +181,8 @@ class Generator:
for job_name, job_instance in server.get_jobs(): for job_name, job_instance in server.get_jobs():
jobs.append(job_name) jobs.append(job_name)
total_rel = set()
for package in metadata: for package in metadata:
# Create the merger jobs first # Create the merger jobs first
job_name = "merger_" + package["name"] job_name = "merger_" + package["name"]
@ -197,8 +199,6 @@ class Generator:
view = server.views.create("merger") view = server.views.create("merger")
view.add_job(job_name) view.add_job(job_name)
total_rel = set()
for release in package["releases"]: for release in package["releases"]:
# Add the release to the total release set, which is used to # Add the release to the total release set, which is used to
# generate the management jobs # generate the management jobs
@ -224,22 +224,22 @@ class Generator:
view.add_job(job_name) view.add_job(job_name)
# Generate a management job for every release, stable and unstable # Generate a management job for every release, stable and unstable
for release in total_rel: for release in total_rel:
for jobtype in ["unstable", "stable"]: for jobtype in ["unstable", "stable"]:
package_config = self.load_config("release-mgmt") package_config = self.load_config("release-mgmt")
jobname = "mgmt_build_" + release + "_" + jobtype jobname = "mgmt_build_" + release + "_" + jobtype
if job_name in jobs: if job_name in jobs:
job = server.get_job(job_name) job = server.get_job(job_name)
job.update_config(package_config) job.update_config(package_config)
else: else:
job = server.create_job(job_name, str(package_config)) job = server.create_job(job_name, str(package_config))
# The mgmt view should be the first view created, we don't # 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 # have to create it if it doesn't exist because that's a
# Huge Problem anyway # Huge Problem anyway
view = server.views["mgmt"] view = server.views["mgmt"]
view.add_job(jobname) view.add_job(jobname)
if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save