Skip to content

Commit

Permalink
Add check index & check tag
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 19, 2024
1 parent 550a43f commit 4ad9122
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ jobs:
./ve1/bin/pre-check \
--api_url "${{ github.event.pull_request._links.self.href }}" \
--output "$SUBMISSION_PATH" \
--repository ${{ github.repository }}
--chart_submission
- name: Upload PR information
Expand Down
27 changes: 22 additions & 5 deletions scripts/src/precheck/precheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def read_submission_from_file(articact_path: str):
return s


def craft_pr_content_error_msg(s: submission.Submission):
def craft_pr_content_error_msg(s: submission.Submission, repository: str):
# Checks that this PR is a valid "Chart certification" PR
is_valid, msg = s.is_valid_certification_submission(ignore_owners=True)
if not is_valid:
Expand All @@ -37,6 +37,17 @@ def craft_pr_content_error_msg(s: submission.Submission):
if not is_valid:
return msg

index = submission.download_index_data(repository)
try:
s.chart.check_index(index)
except submission.HelmIndexError as e:
return str(e)

try:
s.chart.check_release_tag()
except submission.ReleaseTagError as e:
return str(e)

return ""


Expand All @@ -57,6 +68,14 @@ def main():
required=True,
help="API URL for the pull request",
)
parser.add_argument(
"-r",
"--repository",
dest="repository",
type=str,
required=True,
help="Git Repository",
)
parser.add_argument(
"-o",
"--output",
Expand All @@ -82,8 +101,6 @@ def main():
gitutils.add_output("pr-content-error-message", str(e))
sys.exit(10)

### TODO: add check index

owners_error_msg = ""
if s.modified_owners:
# If the PR contains an OWNER file, craft a error message to be added as a comment in the PR
Expand All @@ -92,8 +109,8 @@ def main():
gitutils.add_output("owners-error-message", owners_error_msg)

pr_content_error_msg = ""
if args.check_chart_submission:
pr_content_error_msg = craft_pr_content_error_msg(s)
if args.check_chart_submission: #TODO: why ?
pr_content_error_msg = craft_pr_content_error_msg(s, args.repository)
if pr_content_error_msg:
print(pr_content_error_msg)
gitutils.add_output("pr-content-error-message", pr_content_error_msg)
Expand Down

0 comments on commit 4ad9122

Please sign in to comment.