Tag the EC2 instances with the build uuid.
This commit is contained in:
parent
dd7664328c
commit
fc757fecad
2 changed files with 7 additions and 5 deletions
|
@ -182,7 +182,8 @@ class EphemeralBuilderManager(BaseManager):
|
||||||
|
|
||||||
@coroutine
|
@coroutine
|
||||||
def schedule(self, build_job):
|
def schedule(self, build_job):
|
||||||
logger.debug('Calling schedule with job: %s', build_job.job_details['build_uuid'])
|
build_uuid = build_job.job_details['build_uuid']
|
||||||
|
logger.debug('Calling schedule with job: %s', build_uuid)
|
||||||
|
|
||||||
# Check if there are worker slots avialable by checking the number of jobs in etcd
|
# Check if there are worker slots avialable by checking the number of jobs in etcd
|
||||||
allowed_worker_count = self._manager_config.get('ALLOWED_WORKER_COUNT', 1)
|
allowed_worker_count = self._manager_config.get('ALLOWED_WORKER_COUNT', 1)
|
||||||
|
@ -223,7 +224,7 @@ class EphemeralBuilderManager(BaseManager):
|
||||||
raise Return(False)
|
raise Return(False)
|
||||||
|
|
||||||
logger.debug('Starting builder with executor: %s', self._executor)
|
logger.debug('Starting builder with executor: %s', self._executor)
|
||||||
builder_id = yield From(self._executor.start_builder(realm, token))
|
builder_id = yield From(self._executor.start_builder(realm, token, build_uuid))
|
||||||
|
|
||||||
# Store the builder in etcd associated with the job id
|
# Store the builder in etcd associated with the job id
|
||||||
payload['builder_id'] = builder_id
|
payload['builder_id'] = builder_id
|
||||||
|
|
|
@ -37,7 +37,7 @@ class BuilderExecutor(object):
|
||||||
starting and stopping builders.
|
starting and stopping builders.
|
||||||
"""
|
"""
|
||||||
@coroutine
|
@coroutine
|
||||||
def start_builder(self, realm, token):
|
def start_builder(self, realm, token, build_uuid):
|
||||||
""" Create a builder with the specified config. Returns a unique id which can be used to manage
|
""" Create a builder with the specified config. Returns a unique id which can be used to manage
|
||||||
the builder.
|
the builder.
|
||||||
"""
|
"""
|
||||||
|
@ -103,7 +103,7 @@ class EC2Executor(BuilderExecutor):
|
||||||
return stack_amis[ec2_region]
|
return stack_amis[ec2_region]
|
||||||
|
|
||||||
@coroutine
|
@coroutine
|
||||||
def start_builder(self, realm, token):
|
def start_builder(self, realm, token, build_uuid):
|
||||||
region = self.executor_config['EC2_REGION']
|
region = self.executor_config['EC2_REGION']
|
||||||
channel = self.executor_config.get('COREOS_CHANNEL', 'stable')
|
channel = self.executor_config.get('COREOS_CHANNEL', 'stable')
|
||||||
get_ami_callable = partial(self._get_coreos_ami, region, channel)
|
get_ami_callable = partial(self._get_coreos_ami, region, channel)
|
||||||
|
@ -141,6 +141,7 @@ class EC2Executor(BuilderExecutor):
|
||||||
'Name': 'Quay Ephemeral Builder',
|
'Name': 'Quay Ephemeral Builder',
|
||||||
'Realm': realm,
|
'Realm': realm,
|
||||||
'Token': token,
|
'Token': token,
|
||||||
|
'BuildUUID': build_uuid,
|
||||||
}))
|
}))
|
||||||
raise Return(launched.id)
|
raise Return(launched.id)
|
||||||
|
|
||||||
|
@ -163,7 +164,7 @@ class PopenExecutor(BuilderExecutor):
|
||||||
""" Executor which uses Popen to fork a quay-builder process.
|
""" Executor which uses Popen to fork a quay-builder process.
|
||||||
"""
|
"""
|
||||||
@coroutine
|
@coroutine
|
||||||
def start_builder(self, realm, token):
|
def start_builder(self, realm, token, build_uuid):
|
||||||
# Now start a machine for this job, adding the machine id to the etcd information
|
# Now start a machine for this job, adding the machine id to the etcd information
|
||||||
logger.debug('Forking process for build')
|
logger.debug('Forking process for build')
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
Reference in a new issue