Skip to content

Commit

Permalink
Fix error messages for CI to be happy
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 18, 2024
1 parent 048f126 commit dfa2a53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions scripts/src/precheck/precheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def craft_pr_content_error_msg(s: submission.Submission):
return str(e)

if s.is_web_catalog_only:
if not s.is_valid_web_catalog_only(repo_path="pr-branch"):
msg = "nope"
is_valid, msg = s.is_valid_web_catalog_only(repo_path="pr-branch")
if not is_valid:
return msg

return ""
Expand Down
17 changes: 11 additions & 6 deletions scripts/src/precheck/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,10 @@ def parse_web_catalog_only(self, repo_path=""):
)

if not owners_web_catalog_only == report_web_catalog_only:
raise WebCatalogOnlyError(
f"Value of web_catalog_only in OWNERS ({owners_web_catalog_only}) doesn't match the value in report ({report_web_catalog_only})"
)
if owners_web_catalog_only:
raise WebCatalogOnlyError("[ERROR] The web catalog distribution method is set for the chart but is not set in the report.")
if report_web_catalog_only:
raise WebCatalogOnlyError("[ERROR] Report indicates web catalog only but the distribution method set for the chart is not web catalog only.")

self.is_web_catalog_only = owners_web_catalog_only

Expand All @@ -514,17 +515,21 @@ def is_valid_web_catalog_only(self, repo_path=""):
"""
if not self.report.found:
return False
return False, "nope"

if len(self.modified_files) > 1:
return False
msg = "[ERROR] The web catalog distribution method requires the pull request to be report only."
return False, msg

report_path = os.path.join(repo_path, self.report.path)
found, report_data = verifier_report.get_report_data(report_path)
if not found:
raise WebCatalogOnlyError(f"Failed to get report data at {report_path}")

return verifier_report.get_package_digest(report_data) is not None
if verifier_report.get_package_digest(report_data) is None:
return False, "[ERROR] The web catalog distribution method requires a package digest in the report."

return True


def get_file_type(file_path):
Expand Down

0 comments on commit dfa2a53

Please sign in to comment.