Skip to content

Commit 4371e31

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
hack: add a --{no-,}distro-qualified option
Add cli options to enable/disable adding "distro qualified" tags to the images. These are tags like fedora-nightly or centos-latest. These tags exist mainly to be compatible with the previous versions of the Makefile before build-image existed and "FQIN"s were being used. This patch is a first step toward deprecating and then removing them in favor of FQINs. Signed-off-by: John Mulligan <[email protected]>
1 parent 3f86750 commit 4371e31

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

hack/build-image

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def generate_images(cli):
363363
return list(images.values())
364364

365365

366-
def add_special_tags(img):
366+
def add_special_tags(img, distro_qualified=True):
367367
"""Certain images have special tags. Given an image, add general (non-FQIN)
368368
tags to that image.
369369
"""
@@ -376,6 +376,8 @@ def add_special_tags(img):
376376
img.additional_tags.append((LATEST, QUAL_NONE))
377377
if img.arch == host_arch() and img.pkg_source == NIGHTLY:
378378
img.additional_tags.append((NIGHTLY, QUAL_NONE))
379+
if not distro_qualified:
380+
return # skip creating "distro qualified" tags
379381
if img.arch == host_arch() and img.pkg_source == "default":
380382
img.additional_tags.append((f"{img.distro}-{LATEST}", QUAL_DISTRO))
381383
if img.arch == host_arch() and img.pkg_source == "nightly":
@@ -550,6 +552,15 @@ def main():
550552
" without the repo base"
551553
),
552554
)
555+
parser.add_argument(
556+
"--distro-qualified",
557+
action=argparse.BooleanOptionalAction,
558+
default=True,
559+
help=(
560+
"Specify if image tags like fedora-nightly or centos-latest"
561+
" will be created."
562+
),
563+
)
553564
behaviors = parser.add_mutually_exclusive_group()
554565
behaviors.add_argument(
555566
"--push",
@@ -590,7 +601,7 @@ def main():
590601
try:
591602
imgs = generate_images(cli)
592603
for img in imgs:
593-
add_special_tags(img)
604+
add_special_tags(img, cli.distro_qualified)
594605
logger.info("Image %s, extra tags: %s", img, img.additional_tags)
595606
_action(cli, img)
596607
except subprocess.CalledProcessError as err:

0 commit comments

Comments
 (0)