From 635794d1fb6f6eff4df861c82f0a1e1039fa816f Mon Sep 17 00:00:00 2001 From: Nicolas Schweitzer Date: Thu, 12 Dec 2024 15:47:54 +0100 Subject: [PATCH 1/2] fix(build_rc): Enable compatibility with agent6 --- tasks/libs/common/gomodules.py | 7 +++++- tasks/pipeline.py | 39 ++-------------------------------- 2 files changed, 8 insertions(+), 38 deletions(-) diff --git a/tasks/libs/common/gomodules.py b/tasks/libs/common/gomodules.py index 8f33fa55ebb52..f401b795cbc1e 100644 --- a/tasks/libs/common/gomodules.py +++ b/tasks/libs/common/gomodules.py @@ -261,8 +261,13 @@ def tag(self, agent_version): >>> [mod.tag("7.27.0") for mod in mods] [["7.27.0"], ["pkg/util/log/v0.27.0"]] """ + from invoke import Context + + from tasks.libs.common.git import is_agent6 + + major = "6" if is_agent6(Context()) else "7" if self.path == ".": - return ["7" + agent_version[1:]] + return [major + agent_version[1:]] return [f"{self.path}/{self.__version(agent_version)}"] diff --git a/tasks/pipeline.py b/tasks/pipeline.py index bff7b05b8b1ab..1a0718bcd6d80 100644 --- a/tasks/pipeline.py +++ b/tasks/pipeline.py @@ -43,7 +43,7 @@ # Tasks to trigger pipelines -def check_deploy_pipeline(repo: Project, git_ref: str, release_version_6, release_version_7, repo_branch): +def check_deploy_pipeline(repo_branch): """ Run checks to verify a deploy pipeline is valid: - it targets a valid repo branch @@ -57,41 +57,6 @@ def check_deploy_pipeline(repo: Project, git_ref: str, release_version_6, releas ) raise Exit(code=1) - # - # If git_ref matches v7 pattern and release_version_6 is not empty, make sure Gitlab has v6 tag. - # If git_ref matches v6 pattern and release_version_7 is not empty, make sure Gitlab has v7 tag. - # v7 version pattern should be able to match 7.12.24-rc2 and 7.12.34 - # - v7_pattern = r'^7\.(\d+\.\d+)(-.+|)$' - v6_pattern = r'^6\.(\d+\.\d+)(-.+|)$' - - match = re.match(v7_pattern, git_ref) - - # TODO(@spencergilbert): remove cross reference check when all references to a6 are removed - if release_version_6 and match: - # release_version_6 is not empty and git_ref matches v7 pattern, construct v6 tag and check. - tag_name = "6." + "".join(match.groups()) - try: - repo.tags.get(tag_name) - except GitlabError: - print(f"Cannot find GitLab v6 tag {tag_name} while trying to build git ref {git_ref}") - print("v6 tags are no longer created, this check will be removed in a later commit") - - print(f"Successfully cross checked v6 tag {tag_name} and git ref {git_ref}") - else: - match = re.match(v6_pattern, git_ref) - - if release_version_7 and match: - # release_version_7 is not empty and git_ref matches v6 pattern, construct v7 tag and check. - tag_name = "7." + "".join(match.groups()) - try: - repo.tags.get(tag_name) - except GitlabError as e: - print(f"Cannot find GitLab v7 tag {tag_name} while trying to build git ref {git_ref}") - raise Exit(code=1) from e - - print(f"Successfully cross checked v7 tag {tag_name} and git ref {git_ref}") - @task def clean_running_pipelines(ctx, git_ref=None, here=False, use_latest_sha=False, sha=None): @@ -292,7 +257,7 @@ def run( if deploy or deploy_installer: # Check the validity of the deploy pipeline - check_deploy_pipeline(repo, git_ref, release_version_6, release_version_7, repo_branch) + check_deploy_pipeline(repo_branch) # Force all builds and e2e tests to be run if not all_builds: print( From 51987738a52ce583558c1cdc7b479b68f66a35c7 Mon Sep 17 00:00:00 2001 From: Nicolas Schweitzer Date: Fri, 13 Dec 2024 14:03:37 +0100 Subject: [PATCH 2/2] codereview --- tasks/pipeline.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tasks/pipeline.py b/tasks/pipeline.py index 1a0718bcd6d80..59aa6a3666172 100644 --- a/tasks/pipeline.py +++ b/tasks/pipeline.py @@ -45,9 +45,7 @@ def check_deploy_pipeline(repo_branch): """ - Run checks to verify a deploy pipeline is valid: - - it targets a valid repo branch - - it has matching Agent 6 and Agent 7 tags (depending on release_version_* values) + Run checks to verify a deploy pipeline is valid (it targets a valid repo branch) """ # Check that the target repo branch is valid