Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build_rc): Enable compatibility with agent6 #32100

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tasks/libs/common/gomodules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}"]

Expand Down
39 changes: 2 additions & 37 deletions tasks/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ question
Should you update this description as git_ref is gone?

Expand All @@ -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):
Expand Down Expand Up @@ -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(
Expand Down
Loading