Skip to content

Commit be89362

Browse files
authored
Remove obsolete cloning of test-infra-definitions (#46027)
### What does this PR do? Remove the obsolete logic in KMT setup that clones the `test-infra-definitions` GitHub repository. ### Motivation After #43238 and its follow-up PRs, `test-infra-definitions` is now an in-tree module located at `test/e2e-framework/`. The clone logic is therefore longer needed and should be removed. Co-authored-by: regis.desgroppes <regis.desgroppes@datadoghq.com>
1 parent 2e1c9a4 commit be89362

2 files changed

Lines changed: 10 additions & 42 deletions

File tree

.gitlab/build/source_test/kmt_tasks.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@
1212
- .gitlab/build/source_test/kmt_tasks.yml
1313
compare_to: $COMPARE_TO_BRANCH
1414
script:
15-
- token="$(dda inv -- auth.gitlab --repo test-infra-definitions)"
16-
- git config --global url."https://gitlab-ci-token:${token}@gitlab.ddbuild.io/DataDog/".insteadOf "git@github.com:"
1715
# Avoid rate limits when running kmt.init (pulumi queries the Github API to get the releases of plugins)
1816
- export GITHUB_TOKEN=$(dda inv github.get-token-from-app)
19-
- export KMT_TEST_INFRA_DEFINITIONS_PATH="$(go env GOPATH)"/src/github.com/DataDog/datadog-agent/test/e2e-framework
2017
- dda inv -- kmt.init --remote-setup-only --skip-ssh-setup --exclude-requirements $KMT_EXCLUDE_REQUIREMENTS --images ""
2118
- export PATH=$PATH:$HOME/.pulumi/bin # Simulate a shell restart, required for the check
2219
- dda inv -- kmt.selfcheck --remote-setup-only --exclude-requirements $KMT_EXCLUDE_REQUIREMENTS --show-flare-for-failures

tasks/kernel_matrix_testing/setup/common.py

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -80,48 +80,19 @@ def check(self, ctx: Context, fix: bool) -> RequirementState:
8080

8181
class TestInfraDefinitionsRepo(Requirement):
8282
@staticmethod
83-
def get_candidate_paths() -> list[Path]:
84-
# Allow callers to force a specific path
85-
env_path = os.environ.get("KMT_TEST_INFRA_DEFINITIONS_PATH")
86-
if env_path is not None:
87-
return [Path(env_path)]
88-
89-
# Default to common paths if a specific setting has not been forced
90-
return [
91-
get_repo_root() / "test/e2e-framework",
92-
Path("~/go/src/github.com/DataDog/datadog-agent/test/e2e-framework").expanduser(),
93-
]
94-
95-
@staticmethod
96-
def get_repo_path() -> Path | None:
97-
for path in TestInfraDefinitionsRepo.get_candidate_paths():
98-
if path.is_dir():
99-
return path
100-
101-
return None
83+
def get_repo_path() -> Path:
84+
return get_repo_root() / "test/e2e-framework"
10285

10386
def check(self, ctx: Context, fix: bool) -> RequirementState:
10487
repo_path = self.get_repo_path()
105-
if repo_path is not None:
106-
return RequirementState(Status.OK, "test-infra-definitions repository found.")
107-
108-
candidate_paths = TestInfraDefinitionsRepo.get_candidate_paths()
109-
if not fix:
110-
return RequirementState(
111-
Status.FAIL,
112-
f"test-infra-definitions repository not found in any of the expected locations {', '.join(map(os.fspath, candidate_paths))}.",
113-
fixable=True,
114-
)
115-
116-
clone_opts = "--depth 1 --single-branch --branch=main" if os.environ.get("CI") else ""
117-
repo_access = "https://github.com/" if os.environ.get("CI") else "git@github.com:"
118-
119-
try:
120-
ctx.run(f"git clone {repo_access}DataDog/test-infra-definitions.git {candidate_paths[0]} {clone_opts}")
121-
except Exception as e:
122-
return RequirementState(Status.FAIL, f"test-infra-definitions could not be cloned: {e}", fixable=True)
123-
124-
return RequirementState(Status.OK, "test-infra-definitions repository cloned.")
88+
if repo_path.is_dir():
89+
return RequirementState(Status.OK, "e2e-framework directory found.")
90+
91+
return RequirementState(
92+
Status.FAIL,
93+
f"e2e-framework directory not found at {repo_path}.",
94+
fixable=False,
95+
)
12596

12697

12798
class PulumiPlugin(Requirement):

0 commit comments

Comments
 (0)