Skip to content

Commit 9956a7d

Browse files
Onboarding: Add Windows scenario (#3942)
Co-authored-by: Baptiste Foy <[email protected]>
1 parent 47454e1 commit 9956a7d

18 files changed

+276
-4
lines changed

tests/auto_inject/test_auto_inject_chaos.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ class TestAutoInjectChaos(BaseAutoInjectChaos):
9292
{"vm_branch": "amazon_linux2", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
9393
{"vm_branch": "centos_7_amd64", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
9494
{"vm_branch": "redhat", "vm_cpu": "arm64", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
95+
# Windows is not supported. Change to missing_feature after merge
96+
{"vm_branch": "windows", "reason": "APMON-9999"},
9597
{"vm_name": "Ubuntu_24_10_amd64", "weblog_variant": "test-app-python", "reason": "INPLAT-478"},
9698
{"vm_name": "Ubuntu_24_10_arm64", "weblog_variant": "test-app-python", "reason": "INPLAT-478"},
9799
]
@@ -108,6 +110,8 @@ def test_install_after_ld_preload(self, virtual_machine):
108110
{"vm_branch": "amazon_linux2", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
109111
{"vm_branch": "centos_7_amd64", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
110112
{"vm_branch": "redhat", "vm_cpu": "arm64", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
113+
# Windows is not supported. Change to missing_feature after merge
114+
{"vm_branch": "windows", "reason": "APMON-9999"},
111115
{"vm_name": "Ubuntu_24_10_amd64", "weblog_variant": "test-app-python", "reason": "INPLAT-478"},
112116
{"vm_name": "Ubuntu_24_10_arm64", "weblog_variant": "test-app-python", "reason": "INPLAT-478"},
113117
]

tests/auto_inject/test_auto_inject_install.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class TestHostAutoInjectInstallScript(base.AutoInjectBaseTest):
1313
{"vm_branch": "amazon_linux2", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
1414
{"vm_branch": "centos_7_amd64", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
1515
{"vm_branch": "redhat", "vm_cpu": "arm64", "weblog_variant": "test-app-ruby", "reason": "INPLAT-103"},
16+
# Windows is not supported. Change to missing_feature after merge
17+
{"vm_branch": "windows", "reason": "APMON-9999"},
1618
{"vm_name": "Ubuntu_24_10_amd64", "weblog_variant": "test-app-python", "reason": "INPLAT-478"},
1719
{"vm_name": "Ubuntu_24_10_arm64", "weblog_variant": "test-app-python", "reason": "INPLAT-478"},
1820
]
@@ -56,6 +58,8 @@ class TestHostAutoInjectInstallScriptProfiling(base.AutoInjectBaseTest):
5658
{"vm_cpu": "arm64", "weblog_variant": "test-app-dotnet", "reason": "PROF-10783"},
5759
{"vm_name": "Ubuntu_24_amd64", "weblog-variant": "test-app-nodejs", "reason": "PROF-11264"},
5860
{"vm_name": "Ubuntu_24_arm64", "weblog-variant": "test-app-nodejs", "reason": "PROF-11264"},
61+
# Windows is not supported. Change to missing_feature after merge
62+
{"vm_branch": "windows", "reason": "APMON-9999"},
5963
{"vm_name": "Ubuntu_24_10_amd64", "weblog_variant": "test-app-python", "reason": "INPLAT-478"},
6064
{"vm_name": "Ubuntu_24_10_arm64", "weblog_variant": "test-app-python", "reason": "INPLAT-478"},
6165
]

utils/_context/_scenarios/auto_injection.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
Fedora36arm64,
5050
Fedora37amd64,
5151
Fedora37arm64,
52+
Windows2022amd64,
5253
)
5354

5455
from .core import Scenario
@@ -106,6 +107,7 @@ def __init__(
106107
include_fedora_36_arm64=False,
107108
include_fedora_37_amd64=False,
108109
include_fedora_37_arm64=False,
110+
include_windows_2022_amd64=False,
109111
agent_env=None,
110112
app_env=None,
111113
scenario_groups=None,
@@ -205,6 +207,8 @@ def __init__(
205207
self.required_vms.append(Fedora37amd64())
206208
if include_fedora_37_arm64:
207209
self.required_vms.append(Fedora37arm64())
210+
if include_windows_2022_amd64:
211+
self.required_vms.append(Windows2022amd64())
208212

209213
def print_installed_components(self):
210214
logger.terminal.write_sep("=", "Installed components", bold=True)
@@ -434,6 +438,7 @@ def __init__(
434438
include_fedora_36_arm64=False,
435439
include_fedora_37_amd64=False,
436440
include_fedora_37_arm64=False,
441+
include_windows_2022_amd64=False, # Disabled until the artifacts for windows are available
437442
) -> None:
438443
# Force full tracing without limits
439444
app_env_defaults = {
@@ -493,4 +498,5 @@ def __init__(
493498
include_fedora_36_arm64=include_fedora_36_arm64,
494499
include_fedora_37_amd64=include_fedora_37_amd64,
495500
include_fedora_37_arm64=include_fedora_37_arm64,
501+
include_windows_2022_amd64=include_windows_2022_amd64,
496502
)

utils/_context/virtual_machines.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,3 +970,21 @@ def __init__(self, **kwargs) -> None:
970970
default_vm=False,
971971
**kwargs,
972972
)
973+
974+
975+
class Windows2022amd64(_VirtualMachine):
976+
def __init__(self, **kwargs) -> None:
977+
super().__init__(
978+
"windows_server_2022_amd64",
979+
aws_config=_AWSConfig(
980+
ami_id="AMI_FROM_SSM", ami_instance_type="t3.medium", user="Administrator", volume_size=30
981+
),
982+
vagrant_config=None,
983+
krunvm_config=None,
984+
os_type="windows",
985+
os_distro="2022",
986+
os_branch="windows",
987+
os_cpu="amd64",
988+
default_vm=True,
989+
**kwargs,
990+
)

utils/build/virtual_machine/provisions/auto-inject-ld-preload/ld-preload.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@
2828
echo "Compiling main.c to main.so"
2929
gcc -Wall -fPIC -shared -o main.so main.c -ldl
3030
sudo mv main.so /usr/local/lib/
31-
sudo bash -c "echo /usr/local/lib/main.so >> /etc/ld.so.preload"
31+
sudo bash -c "echo /usr/local/lib/main.so >> /etc/ld.so.preload"
32+
33+
- os_type: windows
34+
remote-command: |
35+
echo "TODO. Windows is not supported for chaos testing."

utils/build/virtual_machine/provisions/auto-inject/auto-inject-tested_components.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,20 @@
113113
fi
114114
115115
echo "{'host':'$(hostname -I)','agent':'$(echo $agent_version)','datadog-apm-inject':'$(echo $inject_version)','datadog-apm-library-$DD_LANG': '$(echo $tracer_version)','docker':'$(docker -v || true)','datadog-installer':'$(echo $installer_version)','glibc_type':'$(echo $GLIBC_TYPE)','glibc':'$(echo $GLIBC_VERSION)','runtime_version':'$(echo $runtime_version)'}"
116+
117+
- os_type: windows
118+
remote-command: |
119+
# Works only for .NET today
120+
$data = @{
121+
host = (hostname).Trim()
122+
agent = (ls 'C:\ProgramData\Datadog Installer\packages\datadog-agent' | Where-Object { $_ -notmatch "(experiment|stable)" } | Select-String '(\d+\.\d+\.\d+.*)' | ForEach-Object { $_.Matches.Groups[1].Value }).Trim()
123+
"datadog-apm-inject" = "N/A (Windows IIS)"
124+
"datadog-apm-library-dotnet" = (ls 'C:\ProgramData\Datadog Installer\packages\datadog-apm-library-dotnet' | Where-Object { $_ -notmatch "(experiment|stable)" } | Select-String '(\d+\.\d+\.\d+.*)' | ForEach-Object { $_.Matches.Groups[1].Value }).Trim()
125+
docker = "N/A (Windows)"
126+
"datadog-installer" = (& 'C:\Program Files\Datadog\Datadog Installer\datadog-installer.exe' version).Trim()
127+
glibc_type = "N/A (Windows)"
128+
glibc = "N/A (Windows)"
129+
runtime_version = (& 'C:\Program Files\dotnet\dotnet.exe' --info | Select-String '(.*)\[C:\\Program Files\\dotnet\\sdk\]' | ForEach-Object { $_.Matches.Groups[1].Value }).Trim()
130+
}
131+
132+
$data | ConvertTo-Json -Depth 3

utils/build/virtual_machine/provisions/auto-inject/auto-inject-vm_logs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
#If there are docker services running extract info
88
echo "==> /var/log/datadog_weblog/docker_proccess.log <==" && sudo docker-compose ps || true
99
echo "==> /var/log/datadog_weblog/docker_logs.log <==" && sudo docker-compose logs || true
10-
echo "==> /var/log/journalctl_docker.log <==" && sudo journalctl -xeu docker || true
10+
echo "==> /var/log/journalctl_docker.log <==" && sudo journalctl -xeu docker || true
11+
- os_type: windows
12+
remote_command: echo "Unsupported OS"

utils/build/virtual_machine/provisions/auto-inject/auto-inject_init_vm_config.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,23 @@
160160
#Install git and clone system tests repository
161161
sudo yum -y install git wget
162162
git clone https://github.com/DataDog/system-tests.git
163+
164+
- os_type: windows
165+
copy_files:
166+
- name: copy-tracer-debug-config
167+
local_path: utils/build/virtual_machine/provisions/auto-inject/tracer_debug/debug_config.yaml
168+
remote-command: |
169+
$filePath = "C:\ProgramData\ssh\sshd_config"
170+
$acceptEnvEntry = "AcceptEnv LANG LC_* DD_*"
171+
172+
# Check if AcceptEnv exists in the file
173+
if (Select-String -Path $filePath -Pattern "^AcceptEnv" -Quiet) {
174+
# If AcceptEnv exists, replace it
175+
(Get-Content $filePath) -replace "^AcceptEnv.*", $acceptEnvEntry | Set-Content $filePath
176+
} else {
177+
# If AcceptEnv does not exist, append it to the end of the file
178+
Add-Content -Path $filePath -Value "`n$acceptEnvEntry"
179+
}
180+
181+
# Restart SSH service to apply changes
182+
Restart-Service sshd

utils/build/virtual_machine/provisions/auto-inject/auto-inject_installer_manual.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,42 @@
5555
sudo mkdir -p /etc/datadog-agent/inject
5656
sudo cp docker_config.yaml /etc/datadog-agent/inject/docker_config.yaml
5757
sudo cp debug_config.yaml /etc/datadog-agent/inject/debug_config.yaml
58+
59+
- os_type: windows
60+
remote-command: |
61+
Set-ExecutionPolicy Bypass -Scope Process -Force;
62+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
63+
$env:DD_REMOTE_UPDATES = 'true'; # Needed?
64+
$env:DD_SITE = "datadoghq.com";
65+
66+
if ($env:DD_env -eq "dev") {
67+
$env:DD_INSTALLER_REGISTRY_URL = "install.datad0g.com";
68+
}
69+
70+
# Environment variables for the installer
71+
# $env:DD_APM_INSTRUMENTATION_ENABLED = "all";
72+
$env:DD_APM_INSTRUMENTATION_LIBRARIES = $env:DD_LANG;
73+
$env:DD_INSTALLER_DEFAULT_PKG_INSTALL_DATADOG_AGENT = $true;
74+
75+
if ($env:DD_INSTALLER_LIBRARY_VERSION) {
76+
$DD_LANG = $env:DD_LANG.ToUpper()
77+
Set-Item -Path "Env:DD_INSTALLER_REGISTRY_URL_APM_LIBRARY_${DD_LANG}_PACKAGE" -Value "installtesting.datad0g.com"
78+
Set-Item -Path "Env:DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_LIBRARY_${DD_LANG}" -Value $env:DD_INSTALLER_LIBRARY_VERSION
79+
}
80+
81+
# if ($env:DD_INSTALLER_INJECTOR_VERSION) {
82+
# $env:DD_INSTALLER_REGISTRY_URL_APM_INJECT_PACKAGE = "installtesting.datad0g.com";
83+
# $env:DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_APM_INJECT = $env:DD_INSTALLER_INJECTOR_VERSION;
84+
# }
85+
86+
if ($env:DD_INSTALLER_AGENT_VERSION) {
87+
$env:DD_INSTALLER_REGISTRY_URL_AGENT_PACKAGE = "installtesting.datad0g.com";
88+
$env:DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_AGENT = $env:DD_INSTALLER_AGENT_VERSION;
89+
}
90+
91+
if ($env:DD_INSTALLER_INSTALLER_VERSION) {
92+
$env:DD_INSTALLER_REGISTRY_URL_INSTALLER_PACKAGE = "installtesting.datad0g.com";
93+
$env:DD_INSTALLER_DEFAULT_PKG_VERSION_DATADOG_INSTALLER = $env:DD_INSTALLER_INSTALLER_VERSION;
94+
}
95+
96+
iex ((New-Object System.Net.WebClient).DownloadString('https://s3.amazonaws.com/dd-agent-mstesting/Install-Datadog.ps1'));
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Installs the installer package (only, no agent no ssi)
22
#Our goal is to cache the installer and its dependencies, in the next steps (no cached steps) we will get a fresh copy of the installer
33
- os_type: linux
4-
remote-command: DD_INSTALL_ONLY=true DD_INSTALLER=true bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"
4+
remote-command: DD_INSTALL_ONLY=true DD_INSTALLER=true bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"
5+
- os_type: windows
6+
remote_command: echo "Unsupported step"

0 commit comments

Comments
 (0)