mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Download ccache from release PRs for backports
This commit is contained in:
parent
c8dcd34abe
commit
c2b02c2ae9
@ -291,7 +291,9 @@ def main():
|
|||||||
|
|
||||||
logging.info("Will try to fetch cache for our build")
|
logging.info("Will try to fetch cache for our build")
|
||||||
try:
|
try:
|
||||||
get_ccache_if_not_exists(ccache_path, s3_helper, pr_info.number, TEMP_PATH)
|
get_ccache_if_not_exists(
|
||||||
|
ccache_path, s3_helper, pr_info.number, TEMP_PATH, pr_info.release_pr
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# In case there are issues with ccache, remove the path and do not fail a build
|
# In case there are issues with ccache, remove the path and do not fail a build
|
||||||
logging.info("Failed to get ccache, building without it. Error: %s", e)
|
logging.info("Failed to get ccache, building without it. Error: %s", e)
|
||||||
|
@ -11,6 +11,7 @@ import requests # type: ignore
|
|||||||
|
|
||||||
from compress_files import decompress_fast, compress_fast
|
from compress_files import decompress_fast, compress_fast
|
||||||
from env_helper import S3_DOWNLOAD, S3_BUILDS_BUCKET
|
from env_helper import S3_DOWNLOAD, S3_BUILDS_BUCKET
|
||||||
|
from s3_helper import S3Helper
|
||||||
|
|
||||||
DOWNLOAD_RETRIES_COUNT = 5
|
DOWNLOAD_RETRIES_COUNT = 5
|
||||||
|
|
||||||
@ -57,12 +58,19 @@ def dowload_file_with_progress(url, path):
|
|||||||
|
|
||||||
|
|
||||||
def get_ccache_if_not_exists(
|
def get_ccache_if_not_exists(
|
||||||
path_to_ccache_dir, s3_helper, current_pr_number, temp_path
|
path_to_ccache_dir: str,
|
||||||
|
s3_helper: S3Helper,
|
||||||
|
current_pr_number: int,
|
||||||
|
temp_path: str,
|
||||||
|
release_pr: int,
|
||||||
) -> int:
|
) -> int:
|
||||||
"""returns: number of PR for downloaded PR. -1 if ccache not found"""
|
"""returns: number of PR for downloaded PR. -1 if ccache not found"""
|
||||||
ccache_name = os.path.basename(path_to_ccache_dir)
|
ccache_name = os.path.basename(path_to_ccache_dir)
|
||||||
cache_found = False
|
cache_found = False
|
||||||
prs_to_check = [current_pr_number]
|
prs_to_check = [current_pr_number]
|
||||||
|
# Release PR is either 0 or defined
|
||||||
|
if release_pr:
|
||||||
|
prs_to_check.append(release_pr)
|
||||||
ccache_pr = -1
|
ccache_pr = -1
|
||||||
if current_pr_number != 0:
|
if current_pr_number != 0:
|
||||||
prs_to_check.append(0)
|
prs_to_check.append(0)
|
||||||
|
@ -125,7 +125,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
logging.info("Will try to fetch cache for our build")
|
logging.info("Will try to fetch cache for our build")
|
||||||
ccache_for_pr = get_ccache_if_not_exists(
|
ccache_for_pr = get_ccache_if_not_exists(
|
||||||
cache_path, s3_helper, pr_info.number, temp_path
|
cache_path, s3_helper, pr_info.number, temp_path, pr_info.release_pr
|
||||||
)
|
)
|
||||||
upload_master_ccache = ccache_for_pr in (-1, 0)
|
upload_master_ccache = ccache_for_pr in (-1, 0)
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class PRInfo:
|
|||||||
self.changed_files = set() # type: Set[str]
|
self.changed_files = set() # type: Set[str]
|
||||||
self.body = ""
|
self.body = ""
|
||||||
self.diff_urls = []
|
self.diff_urls = []
|
||||||
self.release_pr = ""
|
self.release_pr = 0
|
||||||
ref = github_event.get("ref", "refs/head/master")
|
ref = github_event.get("ref", "refs/head/master")
|
||||||
if ref and ref.startswith("refs/heads/"):
|
if ref and ref.startswith("refs/heads/"):
|
||||||
ref = ref[11:]
|
ref = ref[11:]
|
||||||
|
Loading…
Reference in New Issue
Block a user