Skip to content

Commit aa2b51c

Browse files
authored
Merge branch 'main' into jszwedko/run-ci-adp-enabled
2 parents 6ea249a + 2d00390 commit aa2b51c

849 files changed

Lines changed: 95073 additions & 4514 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.adms/bazel/adms.mirror.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ rewrite (ftp.osuosl.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
113113
rewrite (gnupg.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
114114
rewrite (kerberos.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
115115
rewrite (packages.microsoft.com)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
116+
rewrite (download.visualstudio.microsoft.com)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
116117
rewrite (www.freetds.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
117118
rewrite (www.lua.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
118119
rewrite (www.sqlite.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2

.agents/skills/write-e2e/SKILL.md

Lines changed: 248 additions & 39 deletions
Large diffs are not rendered by default.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Stale APIs and where they are written
2+
3+
Load when working from an internal Confluence E2E page, an older branch, or any snippet whose form you cannot find in use under `test/new-e2e/tests/` — several otherwise-trustworthy sources teach forms that do not compile.
4+
5+
The third column is the point of this file. Knowing that a form is wrong helps only if you can recognise what taught it to you, and these sources are otherwise reliable, so a snippet from them reads as trustworthy.
6+
7+
## Will not compile
8+
9+
| Wrong | Right | Why it is reached for |
10+
|---|---|---|
11+
| `awshost.WithAgentOptions(agentparams...)` | `awshost.WithRunOptions(ec2.WithAgentOptions(agentparams...))` | It is the correct form on Azure and GCP, so it transfers wrongly to AWS |
12+
| `ec2docker.WithExtraComposeManifest(...)` | it is a `dockeragentparams` option: `scenariodocker.WithAgentOptions(dockeragentparams.WithExtraComposeManifest(...))` | The option configures compose, so the scenario package looks like its home |
13+
| `winazurehost` as the default Windows provisioner | `winawshost`; Azure's Windows provisioner has no test or CI precedent | Confluence recommends Azure for faster Windows boot |
14+
15+
## Compiles, behaves wrong
16+
17+
| Wrong | Right | Why it is easy to get wrong |
18+
|---|---|---|
19+
| `dockeragentparams.WithEnvironmentVariables` to configure the agent | `dockeragentparams.WithAgentServiceEnvVariable(key, value)` | The name reads like the general case, but it only reaches the docker-compose command and its interpolation, not the agent process |
20+
| `os.Getenv("E2E_FAKEINTAKE_IMAGE_OVERRIDE")` and other `E2E_*` reads | the runner parameter store, e.g. `runner.GetProfile().ParamStore().GetBoolWithDefault(parameters.SkipWindows, false)` | Direct reads bypass the profile and resolve differently in CI than locally |
21+
22+
## Confirming a form before you use it
23+
24+
AWS provisioners nest their options inside `WithRunOptions` while Azure, GCP, and local ones are flat, so a snippet moved between clouds needs its shape adjusted. Both shapes are current and neither is deprecated; `references/environments.md` § "Two option shapes" has the rule and the per-provisioner naming that goes with it.
25+
26+
```bash
27+
grep -n '^func With' test/e2e-framework/testing/provisioners/<path>/*.go
28+
grep -rn '<OptionName>' test/new-e2e/tests/ test/new-e2e/examples/ | head
29+
```
30+
31+
A name with no usage anywhere in `tests/` or `examples/` is worth double-checking; the widely used forms are widely used because they work.
32+
33+
## Confluence pages
34+
35+
The internal E2E pages carry useful material — the cloud-selection rule, the credentials runbook, per-suite runtime measurements — alongside instructions that have since moved:
36+
37+
| Page says | Current |
38+
|---|---|
39+
| `inv …` | `dda inv …` |
40+
| `.gitlab/e2e/e2e.yml` | `.gitlab/test/e2e/e2e.yml` |
41+
| `test/new-e2e/pkg/utils/e2e` | `test/e2e-framework/testing/e2e` |
42+
| framework lives in the `test-infra-definitions` repository | it lives in this repository under `test/e2e-framework/` |
43+
| `compare_to: main` in a rule | `compare_to: $COMPARE_TO_BRANCH` |
44+
| `deploy_deb_testing-a7_x64` as an artifact job | `agent_deb-x64-a7` |
45+
46+
## Fixing what you find
47+
48+
When a repository document turns out to be wrong, correct it in the same change. The root `AGENTS.md` asks for this, and it is the only thing that keeps this list from growing: a trap fixed at the source stops reaching the next agent, while a trap recorded here only helps whoever loads this file.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# CI wiring
2+
3+
Load when adding a new test package or changing which build artifacts a test consumes. A test in a package no job references never runs.
4+
5+
Where the wiring lives:
6+
7+
| File | Holds |
8+
|---|---|
9+
| `.gitlab-ci.yml` | The rule template that decides when the job runs |
10+
| `.gitlab/test/e2e/e2e.yml` | The job itself (Linux and cross-platform) |
11+
| `.gitlab/windows/test/e2e/windows.yml` and `.gitlab/windows/test/e2e_install_packages/windows.yml` | Windows jobs |
12+
| `.gitlab/JOBOWNERS` | Who is notified when the job fails |
13+
14+
## The rule template
15+
16+
Rule template names are abbreviated and do not track directory names — `tests/agent-runtimes` is gated by `.on_arun_or_e2e_changes`. Find the existing one rather than guessing:
17+
18+
```bash
19+
grep -n '_or_e2e_changes:' .gitlab-ci.yml
20+
```
21+
22+
A new one references the shared branch rule and adds the paths that should trigger it:
23+
24+
```yaml
25+
.on_myarea_or_e2e_changes:
26+
- !reference [.on_e2e_main_release_or_rc]
27+
- changes:
28+
paths:
29+
- comp/myarea/**/*
30+
- pkg/myarea/**/*
31+
- test/new-e2e/tests/myarea/**/*
32+
compare_to: $COMPARE_TO_BRANCH
33+
```
34+
35+
`.on_e2e_main_release_or_rc` is what makes the job run on `main`, release branches, and release candidates regardless of the diff. The `changes` block is what additionally runs it on a pull request that touches those paths. List the implementation paths, not only the test path — otherwise a change to the feature will not exercise its own test.
36+
37+
## The job
38+
39+
Extend a template that already declares the right artifact dependencies rather than hand-writing `needs`:
40+
41+
| Template | Brings in | Use for |
42+
|---|---|---|
43+
| `.new_e2e_template` | test binaries, tooling, fakeintake | Tests needing no agent package |
44+
| `.new_e2e_template_needs_deb_x64` | `agent_deb-x64-a7`, `agent_deb-x64-a7-fips` | Host tests on Ubuntu or Debian |
45+
| `.new_e2e_template_needs_container_deploy_linux` | `qa_agent_linux`, `qa_agent_linux_jmx`, `qa_dca`, `qa_dogstatsd` | Docker and Kubernetes on Linux |
46+
| `.new_e2e_template_needs_container_deploy` | the above plus the Windows agent images | Container tests covering Windows |
47+
| `.new_e2e_template_needs_windows_x64` | `windows_msi_and_bosh_zip_x64-a7` and its FIPS variant | Windows host tests (defined in `.gitlab/windows/test/e2e/windows.yml`) |
48+
49+
```yaml
50+
new-e2e-myarea:
51+
extends: .new_e2e_template_needs_deb_x64
52+
rules:
53+
- !reference [.on_myarea_or_e2e_changes]
54+
- !reference [.manual]
55+
variables:
56+
TARGETS: ./tests/myarea
57+
TEAM: myteam
58+
EXTRA_PARAMS: --skip "Windows"
59+
ON_NIGHTLY_FIPS: "true"
60+
```
61+
62+
`TARGETS` is relative to `test/new-e2e/`. `TEAM` routes test results. `EXTRA_PARAMS` passes `--run` and `--skip` regexes, which is how a suite split across `_nix_test.go` and `_win_test.go` gets divided between jobs. `ON_NIGHTLY_FIPS` also runs the job in the nightly FIPS pipeline.
63+
64+
When none of the templates fits, compose from the shared reference so you inherit the base dependencies:
65+
66+
```yaml
67+
needs:
68+
- !reference [.needs_new_e2e_template]
69+
- agent_rpm-x64-a7
70+
```
71+
72+
Other artifact jobs: `agent_rpm-x64-a7` (RPM distributions), `deploy_windows_testing-a7` and `deploy_windows_testing-a7-fips` (Windows MSI), `deploy_installer_oci` (Fleet Automation packages).
73+
74+
Ask for only the artifacts the test consumes. Without `needs`, GitLab waits for every earlier stage; with too many, the job blocks on builds it never uses and lengthens the pipeline for everyone. A test that hangs waiting for an image usually has a missing `needs`, not a broken test.
75+
76+
## Windows jobs
77+
78+
Each Windows installer test function provisions its own VM, so those jobs fan out with `parallel: matrix`, one entry per test function, and select with an anchored regex:
79+
80+
```yaml
81+
parallel:
82+
matrix:
83+
- E2E_MSI_TEST: TestInstall
84+
- E2E_MSI_TEST: TestUpgrade
85+
variables:
86+
TARGETS: ./tests/windows/install-test
87+
EXTRA_PARAMS: --run "$E2E_MSI_TEST$"
88+
```
89+
90+
Adding a test function to one of those packages means adding a matrix entry, otherwise it never runs.
91+
92+
## Pre-initialising expensive infrastructure
93+
94+
A cluster that takes five to ten minutes to create can be built once by a separate job:
95+
96+
```yaml
97+
new-e2e-myarea-init:
98+
extends: .new_e2e_template
99+
stage: e2e_init
100+
variables:
101+
TARGETS: ./tests/myarea
102+
E2E_INIT_ONLY: "true"
103+
104+
new-e2e-myarea:
105+
extends: .new_e2e_template
106+
needs:
107+
# extends replaces needs rather than merging, and the inherited before_script
108+
# unpacks these artifacts — dropping them fails the job on a missing tarball.
109+
- !reference [.needs_new_e2e_template]
110+
- new-e2e-myarea-init
111+
variables:
112+
TARGETS: ./tests/myarea
113+
E2E_PRE_INITIALIZED: "true"
114+
```
115+
116+
`new-e2e-containers-eks` in `.gitlab/test/e2e/e2e.yml` is the in-tree version; it re-references `.new_e2e_template_needs_container_deploy` alongside its init job for the same reason.
117+
118+
Worth it for EKS and similar; unnecessary for a single VM.
119+
120+
## Ownership
121+
122+
Add the job to `.gitlab/JOBOWNERS`, which is what dispatches a failure notification:
123+
124+
```
125+
new-e2e-myarea* @DataDog/myteam
126+
```
127+
128+
`new-e2e*` defaults to `@DataDog/agent-devx`, so a job without its own entry pages the framework team instead of the team that owns the behavior. Add the test directory to `.github/CODEOWNERS` as well — that governs review, not notifications, and the two are separate on purpose.
129+
130+
## Budgets and branch coverage
131+
132+
`test/new-e2e/codereview_guideline.md` § "Keeping tests fast" sets the wall-time budgets. A job gated on every pull request regardless of paths is rare by design and needs justifying.
133+
134+
Most E2E jobs run only on `main`, release branches, and release candidates. A change whose only coverage is such a job gets no pull-request signal — say so in the report, since a reviewer cannot tell from a green pipeline. That is a disclosure, not a label: a test-only pull request still takes `qa/no-code-change`, and `qa/rc-required` is reserved for changes that genuinely can only be validated on a release candidate.
135+
136+
## Dynamic test skipping
137+
138+
Some e2e jobs prune themselves from the inside. A job whose `rules` reference `.dynamic_tests` (`.gitlab-ci.yml`) is created on any change under `pkg/`, `cmd/`, or `comp/` — deliberately broad — and then the `--impacted` flag on `new-e2e-tests.run` consults a coverage index and skips the tests in that job the diff does not touch. It selects tests within a job, never between jobs, so it neither replaces nor relaxes the `changes` rule above.
139+
140+
Three consequences for a test author:
141+
142+
- A test the index does not know about is never skipped. The skip list is `indexed tests − impacted tests` (`tasks/libs/dynamic_test/index.py`), so a newly added test always runs.
143+
- Pruning happens on dev branches only. `main`, release branches, tagged commits, and triggered pipelines run everything, as does setting `RUN_E2E_TESTS=on` or the breakglass secret.
144+
- A failure to load the index is logged and the run falls back to the full suite, so a missing index costs time rather than coverage.
145+
146+
Ask in `#agent-devx-help` when a job needs an artifact or a cloud capability that does not exist yet.

0 commit comments

Comments
 (0)