@@ -137,21 +137,23 @@ def build(ctx, images_to_build, container_context, cache):
137
137
@click .option ('--namespace' , help = 'Namespace to push into' )
138
138
@click .option ('--force' , help = "Push image even if it's already in the registry" , is_flag = True , default = False )
139
139
@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 )
140
141
@click .argument ('image' )
141
142
@click .pass_context
142
- def push (ctx , namespace , force , pbr , image ):
143
+ def push (ctx , namespace , force , pbr , tag , image ):
143
144
"""
144
145
Push a container
145
146
"""
146
147
utils .logger .debug ("Executing push command" )
147
148
_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 :
151
152
# Format = pbr_version.short_hash
152
153
# pylint: disable=protected-access
153
154
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
155
157
156
158
ret = _push (ctx , force , image , image_name , namespace , tag_to_push )
157
159
if ret != 0 :
0 commit comments