71
70
params = {'name': extractor_job.name,
73
72
'buildable': extractor_job.buildable,
74
'in_queue': extractor_job.in_queue,
75
'last_build': extractor_job.last_build,
76
'last_completed_build': extractor_job.last_completed_build,
77
'last_failed_build': extractor_job.last_failed_build,
78
'last_successful_build': extractor_job.last_successful_build}
79
jenkins_job = JenkinsJob.objects.create(**params)
73
'in_queue': extractor_job.in_queue}
74
jenkins_job, created = JenkinsJob.objects.get_or_create(**params)
80
75
except EnvironmentError, e:
81
# No job found: this can happen when a project is defined in a stack but
82
# the jobs have not yet been deployed
76
# No job found on the server: this can happen when a project is
77
# defined in a stack but the jobs have not yet been deployed.
83
78
transaction.rollback()
86
except IntegrityError, e:
87
# uniqueness constraint violated
88
transaction.rollback()
90
jenkins_job = JenkinsJob.objects.get(name=extractor_job.name)
82
# The job already exists in the database: this is normal even during
83
# a fresh import due to the multiple build/job discovery paths.
92
85
logger.debug("Updating job from {}".format(url))
93
86
jenkins_job.update(**params)