Skip to content

Commit

Permalink
Merge pull request #88 from kbase/develop-docker-build-output-fix
Browse files Browse the repository at this point in the history
Hotfix for change in docker build logs
  • Loading branch information
kkellerlbl committed Jun 27, 2017
2 parents 000e129 + 31eac63 commit 2dda439
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ develop: [![Build Status](https://travis-ci.org/kbase/catalog.svg?branch=develop
Code coverage: (develop branch)
[![Coverage Status](https://coveralls.io/repos/github/kbase/catalog/badge.svg?branch=develop)](https://coveralls.io/github/kbase/catalog?branch=develop)


#### v2.1.1 - 6/26/17
- Bugfix for change in docker build log

#### v2.1.0 - 4/13/17
- No change from 2.0.7, but upgraded minor version number because many new features
now exist since the initial 2.0.x release.
Expand Down
32 changes: 14 additions & 18 deletions lib/biokbase/catalog/registrar.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,35 +542,31 @@ def cleanup(self):
shutil.rmtree(os.path.join(self.temp_dir,self.registration_id))

def build_docker_image(self, docker_client, image_name, basedir):
self.log('\nBuilding the docker image for ' + image_name);
self.log('\nBuilding the docker image for ' + image_name)

# examine stream to determine success/failure of build
imageId=None
last={}
for lines in docker_client.build(path=basedir,rm=True,tag=image_name, pull=False):
imageId = None
for lines in docker_client.build(path=basedir, rm=True, tag=image_name, pull=False):
for line in lines.strip().splitlines():
line_parse = json.loads(line.strip())
log_line = ''
if 'stream' in line_parse:
self.log(line_parse['stream'],no_end_line=True)
self.log(line_parse['stream'], no_end_line=True)
if 'errorDetail' in line_parse:
self.log(str(line_parse),no_end_line=True)
raise ValueError('Docker build failed: '+str(line_parse['errorDetail']))
last=line_parse

if 'stream' in last and last['stream'][:19]=='Successfully built ':
imageId = docker_client.inspect_image(image_name)['Id']
self.log(str(line_parse), no_end_line=True)
raise ValueError('Docker build failed: ' + str(line_parse['errorDetail']))

imageId = docker_client.inspect_image(image_name)['Id']

self.log('Docker build successful.')
self.log(' Image Id: ' + imageId)
self.log(' Image Name: ' + image_name+'\n\n')
self.log(' Image Id: ' + str(imageId))
self.log(' Image Name: ' + str(image_name) + '\n\n')
return imageId

def push_docker_image(self, docker_client, image_name):
self.log('\nPushing docker image to registry for ' + image_name);
colon_pos = image_name.rfind(':') # This logic supports images with "host:port/" prefix for private registry
image=image_name[:colon_pos]
tag=image_name[colon_pos+1:]
self.log('\nPushing docker image to registry for ' + image_name)
colon_pos = image_name.rfind(':') # This logic supports images with "host:port/" prefix for private registry
image = image_name[:colon_pos]
tag = image_name[colon_pos + 1:]
#response = [ line for line in docker_client.push(image, tag=tag, stream=True) ]
#response_stream = response
#self.log(str(response_stream))
Expand Down

0 comments on commit 2dda439

Please sign in to comment.