-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
152 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,12 @@ | ||
$ErrorActionPreference = "Stop" | ||
$ErrorActionPreference = "Continue" | ||
$Password = ConvertTo-SecureString "dummyPW_:-gch6Rejae9" -AsPlainText -Force | ||
New-LocalUser -Name "ddagentuser" -Description "Test user for the secrets feature on windows." -Password $Password | ||
|
||
$Env:Python2_ROOT_DIR=$Env:TEST_EMBEDDED_PY2 | ||
$Env:Python3_ROOT_DIR=$Env:TEST_EMBEDDED_PY3 | ||
|
||
$test_output_file = if ($Env:TEST_OUTPUT_FILE) { $Env:TEST_OUTPUT_FILE } else { "test_output.json" } | ||
|
||
& ridk enable | ||
& $Env:Python3_ROOT_DIR\python.exe -m pip install -r requirements.txt | ||
|
||
$UT_BUILD_ROOT=(Get-Location).Path | ||
$Env:PATH="$UT_BUILD_ROOT\dev\lib;$Env:GOPATH\bin;$Env:Python3_ROOT_DIR;$Env:Python3_ROOT_DIR\Scripts;$Env:PATH" | ||
|
||
& pip install -r tasks/libs/requirements-github.txt | ||
|
||
mkdir .\bin\agent | ||
|
||
# Generate the datadog.yaml config file to be used in integration tests | ||
& inv -e agent.generate-config --build-type="agent-py2py3" --output-file="./datadog.yaml" | ||
|
||
# NG installer unit tests | ||
if ($Env:DEBUG_CUSTOMACTION) { | ||
& inv -e msi.test --debug | ||
} else { | ||
& inv -e msi.test | ||
} | ||
$err = $LASTEXITCODE | ||
Write-Host Test result is $err | ||
if($err -ne 0){ | ||
Write-Host -ForegroundColor Red "Windows installer unit test failed $err" | ||
[Environment]::Exit($err) | ||
} | ||
|
||
& inv -e deps | ||
& .\tasks\winbuildscripts\pre-go-build.ps1 -PythonRuntimes "$Env:PY_RUNTIMES" | ||
|
||
& inv -e rtloader.test | ||
$err = $LASTEXITCODE | ||
Write-Host rtloader test result is $err | ||
if($err -ne 0){ | ||
Write-Host -ForegroundColor Red "rtloader test failed $err" | ||
[Environment]::Exit($err) | ||
} | ||
$TEST_WASHER_FLAG="" | ||
if($Env:TEST_WASHER){ | ||
$TEST_WASHER_FLAG="--test-washer" | ||
} | ||
& inv -e install-tools | ||
& inv -e agent.build | ||
$err = $LASTEXITCODE | ||
if($err -ne 0){ | ||
Write-Host -ForegroundColor Red "Agent build failed $err" | ||
[Environment]::Exit($err) | ||
} | ||
& inv -e test --junit-tar="$Env:JUNIT_TAR" --race --profile --rerun-fails=2 --coverage --cpus 8 --python-runtimes="$Env:PY_RUNTIMES" --python-home-2=$Env:Python2_ROOT_DIR --python-home-3=$Env:Python3_ROOT_DIR --save-result-json C:\mnt\$test_output_file $Env:EXTRA_OPTS --build-stdlib $TEST_WASHER_FLAG | ||
|
||
$err = $LASTEXITCODE | ||
|
||
# Ignore upload failures | ||
$ErrorActionPreference = "Continue" | ||
$tmpfile = [System.IO.Path]::GetTempFileName() | ||
|
||
# 1. Upload coverage reports to Codecov | ||
& "$UT_BUILD_ROOT\tools\ci\fetch_secret.ps1" -parameterName "$Env:CODECOV_TOKEN" -tempFile "$tmpfile" | ||
If ($LASTEXITCODE -ne "0") { | ||
exit $LASTEXITCODE | ||
} | ||
$Env:CODECOV_TOKEN=$(cat "$tmpfile") | ||
& inv -e coverage.upload-to-codecov $Env:COVERAGE_CACHE_FLAG | ||
|
||
# 2. Upload junit files | ||
# Copy test files to c:\mnt for further gitlab upload | ||
Get-ChildItem -Path "$UT_BUILD_ROOT" -Filter "junit-out-*.xml" -Recurse | ForEach-Object { | ||
Copy-Item -Path $_.FullName -Destination C:\mnt | ||
} | ||
& "$UT_BUILD_ROOT\tools\ci\fetch_secret.ps1" -parameterName "$Env:API_KEY_ORG2" -tempFile "$tmpfile" | ||
If ($LASTEXITCODE -ne "0") { | ||
exit $LASTEXITCODE | ||
} | ||
$Env:DATADOG_API_KEY=$(cat "$tmpfile") | ||
& "$UT_BUILD_ROOT\tools\ci\fetch_secret.ps1" -parameterName "$Env:GITLAB_TOKEN" -tempFile "$tmpfile" | ||
If ($LASTEXITCODE -ne "0") { | ||
exit $LASTEXITCODE | ||
} | ||
$Env:GITLAB_TOKEN=$(cat "$tmpfile") | ||
Remove-Item "$tmpfile" | ||
|
||
& inv -e junit-upload --tgz-path $Env:JUNIT_TAR | ||
if($err -ne 0){ | ||
Write-Host -ForegroundColor Red "test failed $err" | ||
[Environment]::Exit($err) | ||
} | ||
|
||
Write-Host Test passed | ||
py.exe -c 'import shutil; print(shutil.which("vault"))' | ||
py.exe -c 'import shutil; print(shutil.which("vault.exe"))' | ||
ls "c:\devtools" | ||
ls "c:\devtools\vault" | ||
#$result=(vault kv get -field="token" kv/k8s/gitlab-runner/datadog-agent/"api-key-org2") |