diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-06-09 12:37:53 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-06-09 12:38:14 +0200 |
commit | bbd5220ca7879e49858f309cb8fc22443138b4b9 (patch) | |
tree | 824a5b3e74cfb57b6b7f5944d172721ec62a4727 /modules/private/buildbot/projects/caldance | |
parent | b8951433d39ea7a9732886a9a8ed28d7fcccf3e6 (diff) | |
download | Nix-bbd5220ca7879e49858f309cb8fc22443138b4b9.tar.gz Nix-bbd5220ca7879e49858f309cb8fc22443138b4b9.tar.zst Nix-bbd5220ca7879e49858f309cb8fc22443138b4b9.zip |
Add lock for buildbot caldance builds
Diffstat (limited to 'modules/private/buildbot/projects/caldance')
-rw-r--r-- | modules/private/buildbot/projects/caldance/__init__.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/modules/private/buildbot/projects/caldance/__init__.py b/modules/private/buildbot/projects/caldance/__init__.py index 2c0bad5..8d4e804 100644 --- a/modules/private/buildbot/projects/caldance/__init__.py +++ b/modules/private/buildbot/projects/caldance/__init__.py | |||
@@ -77,14 +77,16 @@ def configure(c): | |||
77 | c['workers'].append(worker.LocalWorker("generic-worker")) | 77 | c['workers'].append(worker.LocalWorker("generic-worker")) |
78 | c['workers'].append(worker.LocalWorker("deploy-worker")) | 78 | c['workers'].append(worker.LocalWorker("deploy-worker")) |
79 | 79 | ||
80 | db_lock = util.MasterLock("deploy_after_build") | ||
81 | |||
80 | c['schedulers'].append(hook_scheduler("Caldance", timer=1)) | 82 | c['schedulers'].append(hook_scheduler("Caldance", timer=1)) |
81 | c['schedulers'].append(force_scheduler("force_caldance", ["Caldance_build"])) | 83 | c['schedulers'].append(force_scheduler("force_caldance", ["Caldance_build"])) |
82 | c['schedulers'].append(deploy_scheduler("deploy_caldance", ["Caldance_deploy"])) | 84 | c['schedulers'].append(deploy_scheduler("deploy_caldance", ["Caldance_deploy"])) |
83 | c['schedulers'].append(deploy_hook_scheduler("Caldance", timer=1)) | 85 | c['schedulers'].append(deploy_hook_scheduler("Caldance", timer=1)) |
84 | 86 | ||
85 | c['builders'].append(factory("caldance")) | 87 | c['builders'].append(factory("caldance", locks=[db_lock.access('exclusive')])) |
86 | 88 | ||
87 | c['builders'].append(deploy_factory("caldance")) | 89 | c['builders'].append(deploy_factory("caldance", locks=[db_lock.access('exclusive')])) |
88 | 90 | ||
89 | c['services'].append(SlackStatusPush( | 91 | c['services'].append(SlackStatusPush( |
90 | name="slack_status_caldance", | 92 | name="slack_status_caldance", |
@@ -96,7 +98,7 @@ def configure(c): | |||
96 | recipients=E.XMPP_RECIPIENTS, | 98 | recipients=E.XMPP_RECIPIENTS, |
97 | password=open(E.SECRETS_FILE + "/notify_xmpp_password", "r").read().rstrip())) | 99 | password=open(E.SECRETS_FILE + "/notify_xmpp_password", "r").read().rstrip())) |
98 | 100 | ||
99 | def factory(project, ignore_fails=False): | 101 | def factory(project, locks=[], ignore_fails=False): |
100 | release_file = "{1}/{0}_%(kw:clean_branch)s.tar.gz" | 102 | release_file = "{1}/{0}_%(kw:clean_branch)s.tar.gz" |
101 | 103 | ||
102 | package = util.Interpolate("{0}_%(kw:clean_branch)s.tar.gz".format(project), clean_branch=clean_branch) | 104 | package = util.Interpolate("{0}_%(kw:clean_branch)s.tar.gz".format(project), clean_branch=clean_branch) |
@@ -111,6 +113,7 @@ def factory(project, ignore_fails=False): | |||
111 | 113 | ||
112 | return util.BuilderConfig( | 114 | return util.BuilderConfig( |
113 | name="{}_build".format(project.capitalize()), | 115 | name="{}_build".format(project.capitalize()), |
116 | locks=locks, | ||
114 | workernames=["generic-worker"], factory=factory) | 117 | workernames=["generic-worker"], factory=factory) |
115 | 118 | ||
116 | def compute_build_infos(project): | 119 | def compute_build_infos(project): |
@@ -133,7 +136,7 @@ def puppet_host(props): | |||
133 | environment = props["environment"] if props.hasProperty("environment") else "integration" | 136 | environment = props["environment"] if props.hasProperty("environment") else "integration" |
134 | return E.PUPPET_HOST.get(environment, "host.invalid") | 137 | return E.PUPPET_HOST.get(environment, "host.invalid") |
135 | 138 | ||
136 | def deploy_factory(project): | 139 | def deploy_factory(project, locks=[]): |
137 | package_dest = util.Interpolate("{0}/%(prop:build)s".format(E.RELEASE_PATH)) | 140 | package_dest = util.Interpolate("{0}/%(prop:build)s".format(E.RELEASE_PATH)) |
138 | 141 | ||
139 | factory = util.BuildFactory() | 142 | factory = util.BuildFactory() |
@@ -144,7 +147,10 @@ def deploy_factory(project): | |||
144 | build_hash=util.Property("build_hash"), ldap_password=util.Secret("ldap"))) | 147 | build_hash=util.Property("build_hash"), ldap_password=util.Secret("ldap"))) |
145 | factory.addStep(steps.MasterShellCommand(command=[ | 148 | factory.addStep(steps.MasterShellCommand(command=[ |
146 | "ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no", "-o", "CheckHostIP=no", "-i", E.SSH_KEY_PATH, puppet_host])) | 149 | "ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no", "-o", "CheckHostIP=no", "-i", E.SSH_KEY_PATH, puppet_host])) |
147 | return util.BuilderConfig(name="{}_deploy".format(project.capitalize()), workernames=["deploy-worker"], factory=factory) | 150 | return util.BuilderConfig( |
151 | name="{}_deploy".format(project.capitalize()), | ||
152 | locks=locks, | ||
153 | workernames=["deploy-worker"], factory=factory) | ||
148 | 154 | ||
149 | from twisted.internet import defer | 155 | from twisted.internet import defer |
150 | from buildbot.process.buildstep import FAILURE | 156 | from buildbot.process.buildstep import FAILURE |