Set builder hostnames to build UUID

This commit is contained in:
Brad Ison 2016-11-15 12:35:48 -08:00
parent e57eece6c1
commit 2c59bd9ee5
2 changed files with 8 additions and 4 deletions

View file

@ -99,8 +99,9 @@ class BuilderExecutor(object):
none. """
return self.executor_config.get('MINIMUM_RETRY_THRESHOLD', 0)
def generate_cloud_config(self, realm, token, coreos_channel, manager_hostname,
quay_username=None, quay_password=None):
def generate_cloud_config(self, realm, token, build_uuid, coreos_channel,
manager_hostname, quay_username=None,
quay_password=None):
if quay_username is None:
quay_username = self.executor_config['QUAY_USERNAME']
@ -110,6 +111,7 @@ class BuilderExecutor(object):
return TEMPLATE.render(
realm=realm,
token=token,
build_uuid=build_uuid,
quay_username=quay_username,
quay_password=quay_password,
manager_hostname=manager_hostname,
@ -160,7 +162,7 @@ class EC2Executor(BuilderExecutor):
get_ami_callable = partial(self._get_coreos_ami, region, channel)
coreos_ami = yield From(self._loop.run_in_executor(None, get_ami_callable))
user_data = self.generate_cloud_config(realm, token, channel, self.manager_hostname)
user_data = self.generate_cloud_config(realm, token, build_uuid, channel, self.manager_hostname)
logger.debug('Generated cloud config for build %s: %s', build_uuid, user_data)
ec2_conn = self._get_conn()
@ -436,7 +438,7 @@ class KubernetesExecutor(BuilderExecutor):
def start_builder(self, realm, token, build_uuid):
# generate resource
channel = self.executor_config.get('COREOS_CHANNEL', 'stable')
user_data = self.generate_cloud_config(realm, token, channel, self.manager_hostname)
user_data = self.generate_cloud_config(realm, token, build_uuid, channel, self.manager_hostname)
resource = self._job_resource(build_uuid, user_data, channel)
logger.debug('Generated kubernetes resource:\n%s', resource)

View file

@ -1,5 +1,7 @@
#cloud-config
hostname: {{ build_uuid | default('quay-builder', True) }}
users:
groups:
- sudo