]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
container/make-manifest-list.py: add version support
authorDan Mick <dmick@ibm.com>
Mon, 16 Mar 2026 20:13:30 +0000 (13:13 -0700)
committerDan Mick <dmick@ibm.com>
Thu, 19 Mar 2026 17:50:33 +0000 (10:50 -0700)
Add mandatory -v/--version to select version to examine (to allow
multiple prerelease tags to exist).  Reorder arguments so that
usage help in the 'missing version' case shows the long option names.

Requires change to ceph-release-containers job as well to pass
the --version argument.

This commit is part of a PR that includes an update to the "promote"
invocation of make-manifest-list.py, which is done manually and must
also contain the --version argument.

Signed-off-by: Dan Mick <dmick@ibm.com>
container/make-manifest-list.py
doc/dev/release-process.rst

index 27b00cc47776d5511e178d5751363f4af1a259a2..085c112168960d4a6949eb74a9a21b219dede041 100755 (executable)
@@ -77,14 +77,17 @@ def run_command_show_failure(args):
 
 
 @functools.lru_cache
-def get_tags(path):
+def get_tags(path, version=None):
     cmdout = get_command_output(f'skopeo list-tags docker://{path}')
-    return json.loads(cmdout)['Tags']
+    alltags = json.loads(cmdout)['Tags']
+    if version is None:
+        return alltags
+    return [t for t in alltags if t.startswith(version)]
 
 
-def get_latest_tag(path):
+def get_latest_tag(path, version):
     try:
-        latest_tag = get_tags(path)[-1]
+        latest_tag = get_tags(path, version)[-1]
     except IndexError:
         return None
     return latest_tag
@@ -121,13 +124,13 @@ def get_all_matching_digest_tags(path, tag):
 
 def parse_args():
     ap = argparse.ArgumentParser()
-    ap.add_argument('-n', '--dry-run', action='store_true', help='do all local manipulations but do not push final containers to MANIFEST_HOST, or in --promote, calculate but do not copy images to release host')
-    ap.add_argument('-P', '--promote', action='store_true', help='promote newest prerelease manifest container to released (move from MANIFEST_HOST to RELEASE_MANIFEST_HOST')
+    ap.add_argument('--dry-run', '-n', action='store_true', help='do all local manipulations but do not push final containers to MANIFEST_HOST, or in --promote, calculate but do not copy images to release host')
+    ap.add_argument('--promote', '-P', action='store_true', help='promote newest prerelease manifest container to released (move from MANIFEST_HOST to RELEASE_MANIFEST_HOST')
+    ap.add_argument('--version', '-v', required=True, help='operate on this version (leading string of container tag, like v20.2.0)')
     args = ap.parse_args()
     return args
 
 def build_prerelease(sysargs):
-    global args
 
     arch_specific_host = os.environ.get('ARCH_SPECIFIC_HOST', 'quay.ceph.io')
     amd64_repo = os.environ.get('AMD64_REPO', 'ceph/prerelease-amd64')
@@ -218,7 +221,7 @@ def promote(sysargs):
 
     manifest_path = f'{manifest_host}/{manifest_repo}'
     release_path = f'{release_manifest_host}/{release_manifest_repo}'
-    latest_tag = get_latest_tag(manifest_path)
+    latest_tag = get_latest_tag(manifest_path, sysargs.version)
     all_tags = get_all_matching_digest_tags(manifest_path, latest_tag)
 
     copypaths = list()
@@ -241,6 +244,8 @@ def promote(sysargs):
 
 def main():
     args = parse_args()
+    if args.version[0] != 'v':
+        args.version = f'v{args.version}'
 
     if args.promote:
         promote(args)
index 1b707b5b1d1f887e6f13001a9d6194c1aa1e9ec2..7a5781b0e9968e8f3b1209620720a8e6af120315 100644 (file)
@@ -265,7 +265,7 @@ This job:
   or "fat" container image and pushes it to ``quay.ceph.io/ceph/prerelease``
 
 Finally, when all appropriate testing and verification is done on the
-container images, run ``make-manifest-list.py --promote`` from the Ceph
+container images, run ``make-manifest-list.py --promote --version <ver>`` from the Ceph
 source tree (at ``container/make-manifest-list.py``) to promote them to
 their final release location on ``quay.io/ceph/ceph`` (you must ensure
 that you're logged into ``quay.io/ceph`` and ``quay.ceph.io/ceph`` with appropriate permissions):
@@ -273,7 +273,7 @@ that you're logged into ``quay.io/ceph`` and ``quay.ceph.io/ceph`` with appropri
     .. prompt:: bash
 
        cd <ceph-checkout>/container
-       ./make-manifest-list.py --promote
+       ./make-manifest-list.py --promote --version <ver>
 
 The ``--promote`` step should be performed only as the final step in releasing
 containers, after the container images have been tested and have been confirmed