Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 additions & 0 deletions tasks/libs/ciproviders/gitlab_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from difflib import Differ
from functools import lru_cache
from itertools import product
from pathlib import Path
from typing import Any, Literal

import gitlab
Expand Down Expand Up @@ -1300,6 +1301,18 @@ def update_test_infra_def(file_path, image_tag, is_dev_image=False, prefix_comme
yaml.dump(test_infra_def, test_infra_version_file, explicit_start=True)


def get_test_infra_def_version():
"""
Get TEST_INFRA_DEFINITIONS_BUILDIMAGES from `.gitlab/common/test_infra_version.yml` file
"""
try:
version_file = Path.cwd() / ".gitlab" / "common" / "test_infra_version.yml"
test_infra_def = yaml.safe_loads(version_file.read_text(encoding="utf-8"))
return test_infra_def["variables"]["TEST_INFRA_DEFINITIONS_BUILDIMAGES"]
except Exception:
return "main"


def update_gitlab_config(file_path, tag, images="", test=True, update=True, windows=False):
"""
Override variables in .gitlab-ci.yml file.
Expand Down
4 changes: 3 additions & 1 deletion tasks/libs/releasing/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from invoke.exceptions import Exit

from tasks.libs.ciproviders.gitlab_api import get_test_infra_def_version
from tasks.libs.common.constants import TAG_FOUND_TEMPLATE
from tasks.libs.common.git import get_default_branch, is_agent6
from tasks.libs.releasing.documentation import _stringify_config
Expand Down Expand Up @@ -35,11 +36,12 @@
INTERNAL_DEPS_REPOS = ["omnibus-ruby"]
DEPENDENT_REPOS = INTERNAL_DEPS_REPOS + ["integrations-core"]
ALL_REPOS = DEPENDENT_REPOS + [UNFREEZE_REPO_AGENT]
UNFREEZE_REPOS = INTERNAL_DEPS_REPOS + [UNFREEZE_REPO_AGENT] + ["datadog-agent-buildimages"]
UNFREEZE_REPOS = INTERNAL_DEPS_REPOS + [UNFREEZE_REPO_AGENT] + ["datadog-agent-buildimages", "test-infra-definitions"]
DEFAULT_BRANCHES = {
"omnibus-ruby": "datadog-5.5.0",
"datadog-agent": "main",
"datadog-agent-buildimages": "main",
"test-infra-definitions": get_test_infra_def_version(),
}
DEFAULT_BRANCHES_AGENT6 = {
"omnibus-ruby": "6.53.x",
Expand Down
5 changes: 2 additions & 3 deletions tasks/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def _main():
or ctx.run(f"git remote show {upstream} | grep \"HEAD branch\" | sed 's/.*: //'").stdout.strip()
)
ctx.run(f"git checkout {main_branch}")
ctx.run("git pull")
ctx.run("git pull", warn=True)

_main()

Expand Down Expand Up @@ -816,9 +816,8 @@ def create_release_branches(

# Step 1 - Create release branches in all required repositories

base_branch = get_default_branch() if major_version == 6 else None

for repo in UNFREEZE_REPOS:
base_branch = get_default_branch() if major_version == 6 else DEFAULT_BRANCHES[repo]
create_and_update_release_branch(
ctx, repo, release_branch, base_branch=base_branch, base_directory=base_directory, upstream=upstream
)
Expand Down