Skip to content

Commit

Permalink
Enforce chart naming expectations on submissions from Red Hat
Browse files Browse the repository at this point in the history
Signed-off-by: Jose R. Gonzalez <komish@flutes.dev>
  • Loading branch information
komish committed Nov 10, 2023
1 parent e5748de commit 8608480
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/src/checkprcontent/checkpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def ensure_only_chart_is_modified(api_url, repository, branch):
"category", f"{'partner' if category == 'partners' else category}"
)
gitutils.add_output("organization", organization)
gitutils.add_output("chart-name", chart)

if not semver.VersionInfo.isvalid(version):
msg = (
Expand All @@ -208,6 +209,20 @@ def ensure_only_chart_is_modified(api_url, repository, branch):
gitutils.add_output("pr-content-error-message", msg)
sys.exit(1)

# Red Hat charts must carry the Red Hat prefix.
if organization == "redhat":
if not chart.startswith("redhat-"):
msg = f"[ERROR] Charts provided by Red Hat must have their name begin with the redhat- prefix. I.e. redhat-{chart}"
gitutils.add_output("pr-content-error-message", msg)
sys.exit(1)

# Non Red Hat charts must not carry the Red Hat prefix.
if organization != "redhat" and chart.startswith("redhat-"):
msg = f"[ERROR] The redhat- prefix is reserved for charts provided by Red Hat. Your chart: {chart}"
gitutils.add_output("pr-content-error-message", msg)
sys.exit(1)

# Check the index.yaml for the existence of this chart at this version.
print("Downloading index.yaml", category, organization, chart, version)
r = requests.get(
f"https://raw.githubusercontent.com/{repository}/{branch}/index.yaml"
Expand Down

0 comments on commit 8608480

Please sign in to comment.