Skip to content

Commit 9e010ce

Browse files
committed
Fix #183 add --tag to push command
1 parent 33dcc87 commit 9e010ce

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

skipper/cli.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,21 +137,23 @@ def build(ctx, images_to_build, container_context, cache):
137137
@click.option('--namespace', help='Namespace to push into')
138138
@click.option('--force', help="Push image even if it's already in the registry", is_flag=True, default=False)
139139
@click.option('--pbr', help="Use PBR to tag the image", is_flag=True, default=False)
140+
@click.option('--tag', help="Tag to push", default=None)
140141
@click.argument('image')
141142
@click.pass_context
142-
def push(ctx, namespace, force, pbr, image):
143+
def push(ctx, namespace, force, pbr, tag, image):
143144
"""
144145
Push a container
145146
"""
146147
utils.logger.debug("Executing push command")
147148
_validate_global_params(ctx, 'registry')
148-
tag = git.get_hash()
149-
tag_to_push = tag
150-
if pbr:
149+
image_tag = git.get_hash()
150+
tag_to_push = tag or image_tag
151+
if not tag and pbr:
151152
# Format = pbr_version.short_hash
152153
# pylint: disable=protected-access
153154
tag_to_push = f"{packaging._get_version_from_git().replace('dev', '')}.{tag[:8]}"
154-
image_name = image + ':' + tag
155+
156+
image_name = image + ':' + image_tag
155157

156158
ret = _push(ctx, force, image, image_name, namespace, tag_to_push)
157159
if ret != 0:

0 commit comments

Comments
 (0)