|
32 | 32 | min_supported_major = 13 |
33 | 33 |
|
34 | 34 | default_registry = "ghcr.io/cloudnative-pg/postgresql" |
| 35 | +default_family = "postgresql" |
35 | 36 | default_regex = r"(\d+)(?:\.\d+|beta\d+|rc\d+|alpha\d+)-(\d{12})" |
36 | 37 | _token_cache = {"value": None, "expires_at": 0} |
37 | 38 |
|
@@ -161,9 +162,9 @@ def write_catalog(tags, version_re, img_type, os_name, output_dir="."): |
161 | 162 | "apiVersion": "postgresql.cnpg.io/v1", |
162 | 163 | "kind": "ClusterImageCatalog", |
163 | 164 | "metadata": { |
164 | | - "name": f"postgresql{image_suffix}", |
| 165 | + "name": f"{args.family}{image_suffix}", |
165 | 166 | "labels": { |
166 | | - "images.cnpg.io/family": "postgresql", |
| 167 | + "images.cnpg.io/family": args.family, |
167 | 168 | "images.cnpg.io/type": img_type, |
168 | 169 | "images.cnpg.io/os": os_name, |
169 | 170 | "images.cnpg.io/date": time.strftime("%Y%m%d"), |
@@ -213,15 +214,24 @@ def write_catalog(tags, version_re, img_type, os_name, output_dir="."): |
213 | 214 | default=supported_os_names, |
214 | 215 | help=f"Distributions to retrieve (default: {supported_os_names})", |
215 | 216 | ) |
| 217 | + parser.add_argument( |
| 218 | + "--family", |
| 219 | + default=default_family, |
| 220 | + help=f"The family name to assign to the catalogs (default: {default_family})", |
| 221 | + ) |
216 | 222 | args = parser.parse_args() |
217 | 223 |
|
218 | 224 | repo_json = get_json(args.registry) |
219 | 225 | tags = repo_json["Tags"] |
220 | 226 |
|
| 227 | + filename_prefix = "catalog" |
| 228 | + if args.family != default_family: |
| 229 | + filename_prefix = f"{args.family}" |
| 230 | + |
221 | 231 | catalogs = [] |
222 | 232 | for img_type in args.image_types: |
223 | 233 | for os_name in args.distributions: |
224 | | - filename = f"catalog-{img_type}-{os_name}.yaml" |
| 234 | + filename = f"{filename_prefix}-{img_type}-{os_name}.yaml" |
225 | 235 | print(f"Generating {filename}") |
226 | 236 | write_catalog(tags, args.regex, img_type, os_name, args.output_dir) |
227 | 237 | catalogs.append(filename) |
|
0 commit comments