Skip to content

Commit 40b2929

Browse files
author
Matthew Fisher
committed
feat(controller): allow tags for deis pull
if the source Build object specifies a tag to be pulled, it will use that tag as the source rather than `latest`.
1 parent 02d7b41 commit 40b2929

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

controller/api/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,11 @@ def new(self, user, config=None, build=None, summary=None, source_version='lates
482482
tasks.import_repository.delay(build.image, self.app.id).get()
483483
# update the source image to the repository we just imported
484484
source_image = self.app.id
485+
# if the image imported had a tag specified, use that tag as the source
486+
if ':' in build.image:
487+
if '/' not in build.image[build.image.rfind(':') + 1:]:
488+
source_image += build.image[build.image.rfind(':'):]
489+
485490
publish_release(source_image,
486491
config.values,
487492
release_image,)

controller/registry/private.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ def publish_release(source, config, target):
2323
contains the new configuration as ENV entries.
2424
"""
2525
try:
26-
if source.count(':') == 2:
27-
src_image = source.rsplit(':', 1)[0].split('/', 1)[1]
28-
src_tag = source.split(':')[2]
26+
# parse for the tag and the repository
27+
if ':' in source:
28+
if '/' not in source[source.rfind(':') + 1:]:
29+
src_tag = source[source.rfind(':') + 1:]
30+
src_image = source[:source.rfind(':')]
2931
else:
3032
src_image = source
3133
src_tag = 'latest'

registry/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN useradd -s /bin/bash registry
1515
# add the docker registry source from github
1616
RUN git clone https://github.com/deis/docker-registry /docker-registry && \
1717
cd /docker-registry && \
18-
git checkout 3a192af && \
18+
git checkout 3ab454d && \
1919
chown -R registry:registry /docker-registry
2020

2121
# install boto configuration

0 commit comments

Comments
 (0)