Fix the dockerfile build login to work on http and https registries.
This commit is contained in:
parent
72559fb948
commit
aa58b840a5
1 changed files with 10 additions and 4 deletions
|
@ -122,11 +122,17 @@ class DockerfileBuildWorker(Worker):
|
||||||
if not host:
|
if not host:
|
||||||
raise Exception('Invalid tag name: %s' % tag_name)
|
raise Exception('Invalid tag name: %s' % tag_name)
|
||||||
|
|
||||||
registry_endpoint = 'http://%s/v1/' % host.group(1)
|
|
||||||
|
|
||||||
docker_cl = Client(timeout=1200)
|
docker_cl = Client(timeout=1200)
|
||||||
|
|
||||||
|
for protocol in ['https', 'http']:
|
||||||
|
registry_endpoint = '%s://%s/v1/' % (protocol, host.group(1))
|
||||||
logger.debug('Attempting login to registry: %s' % registry_endpoint)
|
logger.debug('Attempting login to registry: %s' % registry_endpoint)
|
||||||
|
|
||||||
|
try:
|
||||||
docker_cl.login('$token', token, registry=registry_endpoint)
|
docker_cl.login('$token', token, registry=registry_endpoint)
|
||||||
|
break
|
||||||
|
except APIError:
|
||||||
|
pass # Probably the wrong protocol
|
||||||
|
|
||||||
history = json.loads(docker_cl.history(built_image))
|
history = json.loads(docker_cl.history(built_image))
|
||||||
num_images = len(history)
|
num_images = len(history)
|
||||||
|
|
Reference in a new issue