mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Make GITHUB_RUN_URL variable and use it
This commit is contained in:
parent
c2520d7f8f
commit
3516eb0524
@ -9,11 +9,10 @@ from github import Github
|
|||||||
|
|
||||||
from env_helper import (
|
from env_helper import (
|
||||||
GITHUB_REPOSITORY,
|
GITHUB_REPOSITORY,
|
||||||
TEMP_PATH,
|
GITHUB_RUN_URL,
|
||||||
REPO_COPY,
|
|
||||||
REPORTS_PATH,
|
REPORTS_PATH,
|
||||||
GITHUB_SERVER_URL,
|
REPO_COPY,
|
||||||
GITHUB_RUN_ID,
|
TEMP_PATH,
|
||||||
)
|
)
|
||||||
from s3_helper import S3Helper
|
from s3_helper import S3Helper
|
||||||
from get_robot_token import get_best_robot_token
|
from get_robot_token import get_best_robot_token
|
||||||
@ -126,7 +125,7 @@ if __name__ == "__main__":
|
|||||||
logging.info("Exception uploading file %s text %s", f, ex)
|
logging.info("Exception uploading file %s text %s", f, ex)
|
||||||
paths[f] = ""
|
paths[f] = ""
|
||||||
|
|
||||||
report_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/actions/runs/{GITHUB_RUN_ID}"
|
report_url = GITHUB_RUN_URL
|
||||||
if paths["runlog.log"]:
|
if paths["runlog.log"]:
|
||||||
report_url = paths["runlog.log"]
|
report_url = paths["runlog.log"]
|
||||||
if paths["main.log"]:
|
if paths["main.log"]:
|
||||||
|
@ -11,7 +11,7 @@ from env_helper import (
|
|||||||
TEMP_PATH,
|
TEMP_PATH,
|
||||||
GITHUB_REPOSITORY,
|
GITHUB_REPOSITORY,
|
||||||
GITHUB_SERVER_URL,
|
GITHUB_SERVER_URL,
|
||||||
GITHUB_RUN_ID,
|
GITHUB_RUN_URL,
|
||||||
)
|
)
|
||||||
from report import create_build_html_report
|
from report import create_build_html_report
|
||||||
from s3_helper import S3Helper
|
from s3_helper import S3Helper
|
||||||
@ -180,9 +180,7 @@ if __name__ == "__main__":
|
|||||||
branch_name = "PR #{}".format(pr_info.number)
|
branch_name = "PR #{}".format(pr_info.number)
|
||||||
branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/pull/{pr_info.number}"
|
branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/pull/{pr_info.number}"
|
||||||
commit_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commit/{pr_info.sha}"
|
commit_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commit/{pr_info.sha}"
|
||||||
task_url = (
|
task_url = GITHUB_RUN_URL
|
||||||
f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/actions/runs/{GITHUB_RUN_ID or '0'}"
|
|
||||||
)
|
|
||||||
report = create_build_html_report(
|
report = create_build_html_report(
|
||||||
build_check_name,
|
build_check_name,
|
||||||
build_results,
|
build_results,
|
||||||
|
@ -7,9 +7,10 @@ CACHES_PATH = os.getenv("CACHES_PATH", TEMP_PATH)
|
|||||||
CLOUDFLARE_TOKEN = os.getenv("CLOUDFLARE_TOKEN")
|
CLOUDFLARE_TOKEN = os.getenv("CLOUDFLARE_TOKEN")
|
||||||
GITHUB_EVENT_PATH = os.getenv("GITHUB_EVENT_PATH")
|
GITHUB_EVENT_PATH = os.getenv("GITHUB_EVENT_PATH")
|
||||||
GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY", "ClickHouse/ClickHouse")
|
GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY", "ClickHouse/ClickHouse")
|
||||||
GITHUB_RUN_ID = os.getenv("GITHUB_RUN_ID")
|
GITHUB_RUN_ID = os.getenv("GITHUB_RUN_ID", "0")
|
||||||
GITHUB_SERVER_URL = os.getenv("GITHUB_SERVER_URL", "https://github.com")
|
GITHUB_SERVER_URL = os.getenv("GITHUB_SERVER_URL", "https://github.com")
|
||||||
GITHUB_WORKSPACE = os.getenv("GITHUB_WORKSPACE", os.path.abspath("../../"))
|
GITHUB_WORKSPACE = os.getenv("GITHUB_WORKSPACE", os.path.abspath("../../"))
|
||||||
|
GITHUB_RUN_URL = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/actions/runs/{GITHUB_RUN_ID}"
|
||||||
IMAGES_PATH = os.getenv("IMAGES_PATH")
|
IMAGES_PATH = os.getenv("IMAGES_PATH")
|
||||||
REPORTS_PATH = os.getenv("REPORTS_PATH", "./reports")
|
REPORTS_PATH = os.getenv("REPORTS_PATH", "./reports")
|
||||||
REPO_COPY = os.getenv("REPO_COPY", os.path.abspath("../../"))
|
REPO_COPY = os.getenv("REPO_COPY", os.path.abspath("../../"))
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from github import Github
|
from github import Github
|
||||||
|
|
||||||
from env_helper import GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID
|
from env_helper import GITHUB_RUN_URL
|
||||||
from pr_info import PRInfo
|
from pr_info import PRInfo
|
||||||
from get_robot_token import get_best_robot_token
|
from get_robot_token import get_best_robot_token
|
||||||
from commit_status_helper import get_commit
|
from commit_status_helper import get_commit
|
||||||
@ -33,7 +33,7 @@ if __name__ == "__main__":
|
|||||||
gh = Github(get_best_robot_token())
|
gh = Github(get_best_robot_token())
|
||||||
commit = get_commit(gh, pr_info.sha)
|
commit = get_commit(gh, pr_info.sha)
|
||||||
|
|
||||||
url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/actions/runs/{GITHUB_RUN_ID}"
|
url = GITHUB_RUN_URL
|
||||||
statuses = filter_statuses(list(commit.get_statuses()))
|
statuses = filter_statuses(list(commit.get_statuses()))
|
||||||
if NAME in statuses and statuses[NAME].state == "pending":
|
if NAME in statuses and statuses[NAME].state == "pending":
|
||||||
commit.create_status(
|
commit.create_status(
|
||||||
|
@ -11,6 +11,7 @@ import re
|
|||||||
|
|
||||||
from github import Github
|
from github import Github
|
||||||
|
|
||||||
|
from env_helper import GITHUB_RUN_URL
|
||||||
from pr_info import PRInfo
|
from pr_info import PRInfo
|
||||||
from s3_helper import S3Helper
|
from s3_helper import S3Helper
|
||||||
from get_robot_token import get_best_robot_token
|
from get_robot_token import get_best_robot_token
|
||||||
@ -88,9 +89,9 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
pr_link = f"https://github.com/ClickHouse/ClickHouse/pull/{pr_info.number}"
|
pr_link = f"https://github.com/ClickHouse/ClickHouse/pull/{pr_info.number}"
|
||||||
|
|
||||||
task_url = f"https://github.com/ClickHouse/ClickHouse/actions/runs/{os.getenv('GITHUB_RUN_ID')}"
|
docker_env += (
|
||||||
docker_env += ' -e CHPC_ADD_REPORT_LINKS="<a href={}>Job (actions)</a> <a href={}>Tested commit</a>"'.format(
|
f' -e CHPC_ADD_REPORT_LINKS="<a href={GITHUB_RUN_URL}>'
|
||||||
task_url, pr_link
|
f'Job (actions)</a> <a href={pr_link}>Tested commit</a>"'
|
||||||
)
|
)
|
||||||
|
|
||||||
if "RUN_BY_HASH_TOTAL" in os.environ:
|
if "RUN_BY_HASH_TOTAL" in os.environ:
|
||||||
@ -199,7 +200,7 @@ if __name__ == "__main__":
|
|||||||
status = "failure"
|
status = "failure"
|
||||||
message = "No message in report."
|
message = "No message in report."
|
||||||
|
|
||||||
report_url = task_url
|
report_url = GITHUB_RUN_URL
|
||||||
|
|
||||||
if paths["runlog.log"]:
|
if paths["runlog.log"]:
|
||||||
report_url = paths["runlog.log"]
|
report_url = paths["runlog.log"]
|
||||||
|
@ -8,7 +8,7 @@ from build_download_helper import get_with_retries
|
|||||||
from env_helper import (
|
from env_helper import (
|
||||||
GITHUB_REPOSITORY,
|
GITHUB_REPOSITORY,
|
||||||
GITHUB_SERVER_URL,
|
GITHUB_SERVER_URL,
|
||||||
GITHUB_RUN_ID,
|
GITHUB_RUN_URL,
|
||||||
GITHUB_EVENT_PATH,
|
GITHUB_EVENT_PATH,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class PRInfo:
|
|||||||
self.sha = github_event["pull_request"]["head"]["sha"]
|
self.sha = github_event["pull_request"]["head"]["sha"]
|
||||||
|
|
||||||
repo_prefix = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}"
|
repo_prefix = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}"
|
||||||
self.task_url = f"{repo_prefix}/actions/runs/{GITHUB_RUN_ID or '0'}"
|
self.task_url = GITHUB_RUN_URL
|
||||||
|
|
||||||
self.repo_full_name = GITHUB_REPOSITORY
|
self.repo_full_name = GITHUB_REPOSITORY
|
||||||
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}"
|
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}"
|
||||||
@ -142,7 +142,7 @@ class PRInfo:
|
|||||||
self.sha = github_event["after"]
|
self.sha = github_event["after"]
|
||||||
pull_request = get_pr_for_commit(self.sha, github_event["ref"])
|
pull_request = get_pr_for_commit(self.sha, github_event["ref"])
|
||||||
repo_prefix = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}"
|
repo_prefix = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}"
|
||||||
self.task_url = f"{repo_prefix}/actions/runs/{GITHUB_RUN_ID or '0'}"
|
self.task_url = GITHUB_RUN_URL
|
||||||
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}"
|
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}"
|
||||||
self.repo_full_name = GITHUB_REPOSITORY
|
self.repo_full_name = GITHUB_REPOSITORY
|
||||||
if pull_request is None or pull_request["state"] == "closed":
|
if pull_request is None or pull_request["state"] == "closed":
|
||||||
@ -180,7 +180,7 @@ class PRInfo:
|
|||||||
self.number = 0
|
self.number = 0
|
||||||
self.labels = {}
|
self.labels = {}
|
||||||
repo_prefix = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}"
|
repo_prefix = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}"
|
||||||
self.task_url = f"{repo_prefix}/actions/runs/{GITHUB_RUN_ID or '0'}"
|
self.task_url = GITHUB_RUN_URL
|
||||||
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}"
|
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}"
|
||||||
self.repo_full_name = GITHUB_REPOSITORY
|
self.repo_full_name = GITHUB_REPOSITORY
|
||||||
self.pr_html_url = f"{repo_prefix}/commits/{ref}"
|
self.pr_html_url = f"{repo_prefix}/commits/{ref}"
|
||||||
|
@ -5,7 +5,7 @@ import re
|
|||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
from github import Github
|
from github import Github
|
||||||
from env_helper import GITHUB_RUN_ID, GITHUB_REPOSITORY, GITHUB_SERVER_URL
|
from env_helper import GITHUB_RUN_URL, GITHUB_REPOSITORY, GITHUB_SERVER_URL
|
||||||
from pr_info import PRInfo
|
from pr_info import PRInfo
|
||||||
from get_robot_token import get_best_robot_token
|
from get_robot_token import get_best_robot_token
|
||||||
from commit_status_helper import get_commit
|
from commit_status_helper import get_commit
|
||||||
@ -231,7 +231,7 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/actions/runs/{GITHUB_RUN_ID}"
|
url = GITHUB_RUN_URL
|
||||||
if not can_run:
|
if not can_run:
|
||||||
print("::notice ::Cannot run")
|
print("::notice ::Cannot run")
|
||||||
commit.create_status(
|
commit.create_status(
|
||||||
|
@ -2,7 +2,7 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
import ast
|
import ast
|
||||||
|
|
||||||
from env_helper import GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID
|
from env_helper import GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_URL
|
||||||
from report import ReportColorTheme, create_test_html_report
|
from report import ReportColorTheme, create_test_html_report
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ def upload_results(
|
|||||||
branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/pull/{pr_number}"
|
branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/pull/{pr_number}"
|
||||||
commit_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commit/{commit_sha}"
|
commit_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commit/{commit_sha}"
|
||||||
|
|
||||||
task_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/actions/runs/{GITHUB_RUN_ID}"
|
task_url = GITHUB_RUN_URL
|
||||||
|
|
||||||
if additional_urls:
|
if additional_urls:
|
||||||
raw_log_url = additional_urls[0]
|
raw_log_url = additional_urls[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user