Add the docker version to the build logs
This commit is contained in:
parent
fa8818e911
commit
9c88ca16b5
1 changed files with 19 additions and 5 deletions
|
@ -38,6 +38,8 @@ TIMEOUT_PERIOD_MINUTES = 20
|
|||
CACHE_EXPIRATION_PERIOD_HOURS = 24
|
||||
NO_TAGS = ['<none>:<none>']
|
||||
RESERVATION_TIME = (TIMEOUT_PERIOD_MINUTES + 5) * 60
|
||||
DOCKER_BASE_URL = None # Set this if you want to use a different docker URL/socket.
|
||||
|
||||
|
||||
def matches_system_error(status_str):
|
||||
""" Returns true if the given status string matches a known system error in the
|
||||
|
@ -128,8 +130,8 @@ class DockerfileBuildContext(object):
|
|||
# Note: We have two different clients here because we (potentially) login
|
||||
# with both, but with different credentials that we do not want shared between
|
||||
# the build and push operations.
|
||||
self._push_cl = StreamingDockerClient(timeout=1200)
|
||||
self._build_cl = StreamingDockerClient(timeout=1200)
|
||||
self._push_cl = StreamingDockerClient(timeout=1200, base_url = DOCKER_BASE_URL)
|
||||
self._build_cl = StreamingDockerClient(timeout=1200, base_url = DOCKER_BASE_URL)
|
||||
|
||||
dockerfile_path = os.path.join(self._build_dir, dockerfile_subdir,
|
||||
'Dockerfile')
|
||||
|
@ -478,9 +480,8 @@ class DockerfileBuildWorker(Worker):
|
|||
|
||||
def watchdog(self):
|
||||
logger.debug('Running build watchdog code.')
|
||||
|
||||
try:
|
||||
docker_cl = Client()
|
||||
docker_cl = Client(base_url = DOCKER_BASE_URL)
|
||||
|
||||
# Iterate the running containers and kill ones that have been running more than 20 minutes
|
||||
for container in docker_cl.containers():
|
||||
|
@ -519,7 +520,20 @@ class DockerfileBuildWorker(Worker):
|
|||
log_appender = partial(build_logs.append_log_message,
|
||||
repository_build.uuid)
|
||||
|
||||
log_appender('initializing', build_logs.PHASE)
|
||||
# Lookup and save the version of docker being used.
|
||||
docker_cl = Client(base_url = DOCKER_BASE_URL)
|
||||
docker_version = docker_cl.version().get('Version', '')
|
||||
dash = docker_version.find('-')
|
||||
|
||||
# Strip any -tutum or whatever off of the version.
|
||||
if dash > 0:
|
||||
docker_version = docker_version[:dash]
|
||||
|
||||
log_appender('initializing', build_logs.PHASE, log_data = {
|
||||
'docker_version': docker_version
|
||||
})
|
||||
|
||||
log_appender('Docker version: %s' % docker_version)
|
||||
|
||||
start_msg = ('Starting job with resource url: %s repo: %s' % (resource_url,
|
||||
repo))
|
||||
|
|
Reference in a new issue