diff --git a/tasks/libs/common/gomodules.py b/tasks/libs/common/gomodules.py index bd37387a010a2..e4805588f73f5 100644 --- a/tasks/libs/common/gomodules.py +++ b/tasks/libs/common/gomodules.py @@ -252,8 +252,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..59aa6a3666172 100644 --- a/tasks/pipeline.py +++ b/tasks/pipeline.py @@ -43,11 +43,9 @@ # 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 - - 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 @@ -57,41 +55,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 +255,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(