Skip to content

Commit

Permalink
Merge pull request #29392 from MaterializeInc/revert-29389-pr-ci-regexp
Browse files Browse the repository at this point in the history
Revert "ci: Also check incidents-and-escalations for ci-regexp"
  • Loading branch information
def- authored Sep 5, 2024
2 parents 21a018b + e10c86e commit 9028233
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
10 changes: 1 addition & 9 deletions misc/python/materialize/cli/ci_annotate_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
)
from materialize.cli.mzcompose import JUNIT_ERROR_DETAILS_SEPARATOR
from materialize.github import (
GROUP_REPO,
KnownGitHubIssue,
for_github_re,
get_known_issues_from_github,
Expand Down Expand Up @@ -455,14 +454,7 @@ def annotate_logged_errors(
step_key: str = os.getenv("BUILDKITE_STEP_KEY", "")
buildkite_label: str = os.getenv("BUILDKITE_LABEL", "")

known_issues = []
issues_with_invalid_regex = []
for repo in GROUP_REPO.values():
(known_issues_repo, issues_with_invalid_regex_repo) = (
get_known_issues_from_github(repo)
)
known_issues.extend(known_issues_repo)
issues_with_invalid_regex.extend(issues_with_invalid_regex_repo)
(known_issues, issues_with_invalid_regex) = get_known_issues_from_github()
unknown_errors: list[ObservedBaseError] = []
unknown_errors.extend(issues_with_invalid_regex)

Expand Down
8 changes: 7 additions & 1 deletion misc/python/materialize/cli/ci_closed_issues_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import requests

from materialize import buildkite, spawn
from materialize.github import GROUP_REPO

ISSUE_RE = re.compile(
r"""
Expand All @@ -33,6 +32,13 @@
re.VERBOSE,
)

GROUP_REPO = {
"timelydataflow": "TimelyDataflow/timely-dataflow",
"materialize": "MaterializeInc/materialize",
"cloud": "MaterializeInc/cloud",
"incidentsandescalations": "MaterializeInc/incidents-and-escalations",
}

REFERENCE_RE = re.compile(
r"""
( reenable
Expand Down
21 changes: 7 additions & 14 deletions misc/python/materialize/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
CI_RE = re.compile("ci-regexp: (.*)")
CI_APPLY_TO = re.compile("ci-apply-to: (.*)")

GROUP_REPO = {
"timelydataflow": "TimelyDataflow/timely-dataflow",
"materialize": "MaterializeInc/materialize",
"cloud": "MaterializeInc/cloud",
"incidentsandescalations": "MaterializeInc/incidents-and-escalations",
}


@dataclass
class KnownGitHubIssue:
Expand All @@ -47,7 +40,7 @@ def to_markdown(self) -> str:
return f'<a href="{self.issue_url}">{self.issue_title} (#{self.issue_number})</a>: Invalid regex in ci-regexp: {self.regex_pattern}, ignoring'


def get_known_issues_from_github_page(repo: str, page: int = 1) -> Any:
def get_known_issues_from_github_page(page: int = 1) -> Any:
headers = {
"Accept": "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
Expand All @@ -56,7 +49,7 @@ def get_known_issues_from_github_page(repo: str, page: int = 1) -> Any:
headers["Authorization"] = f"Bearer {token}"

response = requests.get(
f'https://api.github.com/search/issues?q=repo:{repo}%20type:issue%20in:body%20"ci-regexp%3A"&per_page=100&page={page}',
f'https://api.github.com/search/issues?q=repo:MaterializeInc/materialize%20type:issue%20in:body%20"ci-regexp%3A"&per_page=100&page={page}',
headers=headers,
)

Expand All @@ -68,14 +61,14 @@ def get_known_issues_from_github_page(repo: str, page: int = 1) -> Any:
return issues_json


def get_known_issues_from_github(
repo: str,
) -> tuple[list[KnownGitHubIssue], list[GitHubIssueWithInvalidRegexp]]:
def get_known_issues_from_github() -> (
tuple[list[KnownGitHubIssue], list[GitHubIssueWithInvalidRegexp]]
):
page = 1
issues_json = get_known_issues_from_github_page(repo, page)
issues_json = get_known_issues_from_github_page(page)
while issues_json["total_count"] > len(issues_json["items"]):
page += 1
next_page_json = get_known_issues_from_github_page(repo, page)
next_page_json = get_known_issues_from_github_page(page)
if not next_page_json["items"]:
break
issues_json["items"].extend(next_page_json["items"])
Expand Down

0 comments on commit 9028233

Please sign in to comment.