From d8bfb3a78ea6585ddb0f1fdcc7adf0939dfe0c23 Mon Sep 17 00:00:00 2001 From: Nathan Gillett Date: Wed, 6 Nov 2024 23:55:22 -0600 Subject: [PATCH] Add directory_layouts to definitions [RHELDST-6065] --- src/cdn_definitions/data.json | 45 +++++++++++++ src/cdn_definitions/data.yaml | 114 ++++++++++++++++++++++++++++++++ src/cdn_definitions/schema.json | 95 ++++++++++++++++++++++++++ src/cdn_definitions/schema.yaml | 67 +++++++++++++++++++ 4 files changed, 321 insertions(+) diff --git a/src/cdn_definitions/data.json b/src/cdn_definitions/data.json index 9fc86f3..1b48ac1 100644 --- a/src/cdn_definitions/data.json +++ b/src/cdn_definitions/data.json @@ -2,6 +2,51 @@ "cfme_version_mappings": { "0.0": "0.0" }, + "directory_layouts": [ + { + "name": "DirectoryLayoutC", + "pattern": "(?x)^\n/\n(?:content|shadow)/\n(?Paus|dist|beta|(?:retired-)?els|eus|htb|rhb|tus|e4s)/\n(?Prhes|rhs|cf-me)/\n(?Prhui/)?\n(?P[^/]+)/\n(?P[0-9])\\.(?P[0-9]+)/\n(?P[^/]+)/\n(?P.+)$" + }, + { + "name": "DirectoryLayoutD", + "pattern": "(?x)^\n(?P\n /\n (?:content|shadow)/\n (?Paus|dist|beta|(?:retired-)?els|eus|fastrack|htb|rhb|tus|e4s)/\n (?Pcf-me|rhel|rhevh|rhes|rhs)/\n (?Prhui/)?(?P[^/]+)/\n (?P[0-7][^/]*)\n)\n/\n(?P(?:\\$releasever|\\$[0-9]+|[34][AEW]S|[34]Desktop))/\n(?P[^/]+)/\n(?P.+)$" + }, + { + "name": "DirectoryLayoutE", + "pattern": "(?x)^\n/\n(?:content|shadow)/\n(?Paus|dist|beta|(?:retired-)?els|eus|fastrack|htb|rhb|rc|preview|tus|e4s)/\n(?Parm|cf-me|rhel|rhevh|rhes|rhs)/\n(?Prhui/)?\n(?P[^/]+)/\n(?P[0-9][^./]*)/\n(?P(?:arm|aarch64|ppc64|s390x|x86_64|multiarch|\\$basearch))/\n(?P.+)$" + }, + { + "name": "DirectoryLayoutF", + "pattern": "(?x)^\n/\n(?:content|shadow)/\n(?Paus|dist|beta|(?:retired-)?els|eus|fastrack|htb|rhb|preview|tus|e4s)/\n(?Pcf-me|rhel|rhevh|rhes|rhs)/\n(?Prhui/)?\n(?P[^/]+)/\n(?P[0-9][^/]*)/\n(?:[567](?:Client|ComputeNode|Server|Workstation|Everything))/\n(?P(?:ppc64|s390x|x86_64|multiarch|\\$basearch))/\n(?!channel-dumps/)\n(?P.+)$" + }, + { + "name": "RhelAltLayout", + "pattern": "(?x)^\n/\n(?:content|shadow)/\n(?Paus|dist|beta|(?:retired-)?els|eus|htb|rhb|tus|e4s)/\n(?Prhel-alt)/\n(?Prhui/)?\n(?P[^/]+)/\n(?P[0-9])/\n(\n (\\$releasever)|7(Server|Client|ComputeNode|Workstation)|[0-9]\\.\n (?P[0-9]+)\n)\n/\n(?P[^/]+)/\n(?P[^/]+)/\n(?P.+)$", + "platform": "rhel", + "rhelalt": true + }, + { + "arch": "x86_64", + "major_version": "6", + "name": "ContentISOsLayout", + "pattern": "(?x)^\n/\ncontent/\ncontentisos(\n /\n (?P.+)\n)?$", + "platform": "rhel", + "rest": "", + "type": "dist" + }, + { + "arch": "x86_64", + "name": "SLESLayout", + "pattern": "(?x)^\n/\ncontent/\n(?Pdist|beta)/\nsuse/server/\n(?P11|12|15)/\n(?Psp[\\d])/?\n(?P.*)$", + "platform": "suse" + }, + { + "name": "PublicRepoFileLayout", + "pattern": "(?x)^\n/\ncontent/\npublic/\nrepofiles$", + "repo": "files", + "type": "dist" + } + ], "env_to_releasever_mappings": { "prod": { "current_rhel0_beta": "0.0", diff --git a/src/cdn_definitions/data.yaml b/src/cdn_definitions/data.yaml index eb78f24..a239461 100644 --- a/src/cdn_definitions/data.yaml +++ b/src/cdn_definitions/data.yaml @@ -251,3 +251,117 @@ repo_overrides: if_created_after: "2023-06-01T14:00:00Z" key: example value: true + +# directory_layouts is used to define DirectoryLayout objects and consist of, +# at least, a name and a pattern to match against content URL. Attributes for +# the DirectoryLayout object can be overridden here, otherwise an attempt will +# be made to fill them from the pattern. +# +# Allowed value types; string, boolean, null +directory_layouts: + - name: DirectoryLayoutC + # "/content/////.//" + pattern: |- + (?x)^ + / + (?:content|shadow)/ + (?Paus|dist|beta|(?:retired-)?els|eus|htb|rhb|tus|e4s)/ + (?Prhes|rhs|cf-me)/ + (?Prhui/)? + (?P[^/]+)/ + (?P[0-9])\.(?P[0-9]+)/ + (?P[^/]+)/ + - name: DirectoryLayoutD + # "/content////////" + pattern: |- + (?x)^ + (?P + / + (?:content|shadow)/ + (?Paus|dist|beta|(?:retired-)?els|eus|fastrack|htb|rhb|tus|e4s)/ + (?Pcf-me|rhel|rhevh|rhes|rhs)/ + (?Prhui/)?(?P[^/]+)/ + (?P[0-7][^/]*) + ) + / + (?P(?:\$releasever|\$[0-9]+|[34][AEW]S|[34]Desktop))/ + (?P[^/]+)/ + - name: DirectoryLayoutE + # "/content///////" + pattern: |- + (?x)^ + / + (?:content|shadow)/ + (?Paus|dist|beta|(?:retired-)?els|eus|fastrack|htb|rhb|rc|preview|tus|e4s)/ + (?Parm|cf-me|rhel|rhevh|rhes|rhs)/ + (?Prhui/)? + (?P[^/]+)/ + (?P[0-9][^./]*)/ + (?P(?:arm|aarch64|ppc64|s390x|x86_64|multiarch|\$basearch))/ + - name: DirectoryLayoutF + # "/content///////" + pattern: |- + (?x)^ + / + (?:content|shadow)/ + (?Paus|dist|beta|(?:retired-)?els|eus|fastrack|htb|rhb|preview|tus|e4s)/ + (?Pcf-me|rhel|rhevh|rhes|rhs)/ + (?Prhui/)? + (?P[^/]+)/ + (?P[0-9][^/]*)/ + (?:[567](?:Client|ComputeNode|Server|Workstation|Everything))/ + (?P(?:ppc64|s390x|x86_64|multiarch|\$basearch))/ + (?!channel-dumps/) + - name: RhelAltLayout + # "/content//////$releasever|.|7$Variant///" + pattern: |- + (?x)^ + / + (?:content|shadow)/ + (?Paus|dist|beta|(?:retired-)?els|eus|htb|rhb|tus|e4s)/ + (?Prhel-alt)/ + (?Prhui/)? + (?P[^/]+)/ + (?P[0-9])/ + ( + (\$releasever)|7(Server|Client|ComputeNode|Workstation)|[0-9]\. + (?P[0-9]+) + ) + / + (?P[^/]+)/ + (?P[^/]+)/ + platform: rhel + rhelalt: true + - name: ContentISOsLayout + # "/content/contentisos/ + pattern: |- + (?x)^ + / + content/ + contentisos(/)? + type: dist + platform: rhel + major_version: "6" + arch: x86_64 + rest: "" + - name: SLESLayout + # "/content/dist/suse/server/[11/12/15]" + pattern: |- + (?x)^ + / + content/ + (?Pdist|beta)/ + suse/server/ + (?P11|12|15)/ + (?Psp[\d])/? + arch: "x86_64" + platform: "suse" + - name: PublicRepoFileLayout + pattern: |- + (?x)^ + / + content/ + public/ + repofiles$ + type: dist + repo: files diff --git a/src/cdn_definitions/schema.json b/src/cdn_definitions/schema.json index c8de554..0ef90b1 100644 --- a/src/cdn_definitions/schema.json +++ b/src/cdn_definitions/schema.json @@ -80,6 +80,98 @@ }, "type": "object" }, + "directory_layout": { + "additionalProperties": false, + "properties": { + "arch": { + "type": [ + "string", + "boolean" + ] + }, + "layered_product": { + "type": [ + "string", + "boolean" + ] + }, + "layered_product_version": { + "type": [ + "string", + "boolean" + ] + }, + "major_version": { + "type": [ + "string", + "boolean" + ] + }, + "minor_version": { + "type": [ + "string", + "boolean" + ] + }, + "name": { + "type": "string" + }, + "pattern": { + "type": "string" + }, + "platform": { + "type": [ + "string", + "boolean" + ] + }, + "product": { + "type": [ + "string", + "boolean" + ] + }, + "repo": { + "type": "string" + }, + "rest": { + "type": [ + "string", + "boolean" + ] + }, + "rhelalt": { + "type": "boolean" + }, + "rhui": { + "type": "boolean" + }, + "type": { + "type": [ + "string", + "boolean" + ] + }, + "variant": { + "type": [ + "string", + "boolean" + ] + } + }, + "required": [ + "name", + "pattern" + ], + "type": "object" + }, + "directory_layouts": { + "items": { + "$ref": "#/definitions/directory_layout" + }, + "type": "array", + "uniqueItems": true + }, "env_to_releasever_mapping": { "additionalProperties": false, "patternProperties": { @@ -350,6 +442,9 @@ "cfme_version_mappings": { "$ref": "#/definitions/cfme_version_mappings_list" }, + "directory_layouts": { + "$ref": "#/definitions/directory_layouts" + }, "env_to_releasever_mappings": { "$ref": "#/definitions/env_to_releasever_mapping" }, diff --git a/src/cdn_definitions/schema.yaml b/src/cdn_definitions/schema.yaml index fb24504..d131159 100644 --- a/src/cdn_definitions/schema.yaml +++ b/src/cdn_definitions/schema.yaml @@ -270,6 +270,70 @@ definitions: $ref: "#/definitions/repo_override" additionalProperties: false + directory_layout: + type: object + properties: + name: + type: string + pattern: + type: string + type: + type: + - string + - boolean + variant: + type: + - string + - boolean + arch: + type: + - string + - boolean + platform: + type: + - string + - boolean + major_version: + type: + - string + - boolean + minor_version: + type: + - string + - boolean + rhui: + type: boolean + rhelalt: + type: boolean + product: + type: + - string + - boolean + layered_product: + type: + - string + - boolean + layered_product_version: + type: + - string + - boolean + repo: + type: string + rest: + type: + - string + - boolean + required: + - name + - pattern + additionalProperties: false + + directory_layouts: + type: array + items: + $ref: "#/definitions/directory_layout" + uniqueItems: true + type: object properties: @@ -331,4 +395,7 @@ properties: repo_overrides: $ref: "#/definitions/repo_overrides" + directory_layouts: + $ref: "#/definitions/directory_layouts" + additionalProperties: false