Skip to content

Commit 756cae3

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 79581e9 commit 756cae3

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

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,)

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'

0 commit comments

Comments
 (0)