Add --tag-from-label to prepare command

This will cause tag discovery to be performed on every image entry
during a prepare run.

Change-Id: Ibf6a63f9e145989b5caa8365833980b29a193251
Closes-Bug: #1738669
This commit is contained in:
Steve Baker 2017-12-21 13:45:45 +13:00
parent 4449ee7d45
commit 47b3184340
3 changed files with 24 additions and 5 deletions

View File

@ -0,0 +1,6 @@
---
features:
Specifying --tag-from-label will trigger tag discovery to be performed on
every image entry during a prepare run. This allow image registries to host
images with a mixture of versioned tags, removing the need to always rebuild
all images.

View File

@ -155,7 +155,8 @@ class TestContainerImagePrepare(TestPluginV1):
output_images_file='container_images.yaml',
pull_source=None,
push_destination=None,
service_filter=None
service_filter=None,
tag_from_label=None
)
@mock.patch('tripleo_common.image.kolla_builder.'
@ -253,7 +254,8 @@ class TestContainerImagePrepare(TestPluginV1):
push_destination=None,
service_filter=set([
'OS::TripleO::Services::AodhEvaluator',
])
]),
tag_from_label=None
)
ci_data = {
'container_images': [{
@ -352,7 +354,8 @@ class TestContainerImagePrepare(TestPluginV1):
output_images_file=images_file,
pull_source=None,
push_destination=None,
service_filter=service_filter
service_filter=service_filter,
tag_from_label=None
)
with open(images_file) as f:

View File

@ -201,9 +201,18 @@ class PrepareImageFiles(command.Command):
dest="tag",
default=defaults['tag'],
metavar='<tag>',
help=_("Override the default tag substitution.\n"
help=_("Override the default tag substitution. "
"If --tag-from-label is specified, "
"start discovery with this tag.\n"
"Default: %s") % defaults['tag'],
)
parser.add_argument(
"--tag-from-label",
dest="tag_from_label",
metavar='<image label>',
help=_("Use the value of the specified label to discover the "
"versioned tag."),
)
parser.add_argument(
"--namespace",
dest="namespace",
@ -419,7 +428,8 @@ class PrepareImageFiles(command.Command):
push_destination=parsed_args.push_destination,
mapping_args=subs,
output_env_file=parsed_args.output_env_file,
output_images_file=output_images_file
output_images_file=output_images_file,
tag_from_label=parsed_args.tag_from_label
)
if parsed_args.output_env_file:
params = prepare_data[parsed_args.output_env_file]