Move to use 127.0.0.1 for network listeners by default in some cases #657
Workflow file for this run
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
name: win-package-test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths: | |
- '.github/workflows/scripts/*.ps1' | |
- '.github/workflows/win-package-test.yml' | |
- 'cmd/otelcol/**' | |
- 'internal/buildscripts/packaging/choco/**' | |
- 'internal/buildscripts/packaging/installer/install.ps1' | |
- 'internal/buildscripts/packaging/msi/**' | |
- 'internal/signalfx-agent/bundle/**' | |
- 'Makefile' | |
- 'Makefile.common' | |
- 'tests/zeroconfig/windows/**' | |
- '!**.md' | |
concurrency: | |
group: win-package-test-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
GO_VERSION: 1.20.8 | |
jobs: | |
setup-environment: | |
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache-dependency-path: '**/go.sum' | |
- name: Installing dependency | |
run: | | |
make install-tools | |
cross-compile: | |
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved | |
runs-on: ubuntu-20.04 | |
needs: [setup-environment] | |
strategy: | |
matrix: | |
SYS_BINARIES: [ "binaries-windows_amd64" ] | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache-dependency-path: '**/go.sum' | |
- name: Build Collector | |
run: | | |
make ${{ matrix.SYS_BINARIES }} | |
- name: Uploading binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.SYS_BINARIES }} | |
path: | | |
./bin/* | |
agent-bundle-windows: | |
runs-on: windows-2019 | |
env: | |
PIP_CACHE_DIR: ${{ github.workspace }}/.cache/pip | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ env.PIP_CACHE_DIR }} | |
key: agent-bundle-windows-pip-${{ hashFiles('internal/signalfx-agent/bundle/collectd-plugins.yaml', 'internal/signalfx-agent/bundle/scripts/requirements.txt') }} | |
- run: ./internal/signalfx-agent/bundle/scripts/windows/make.ps1 bundle | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: agent-bundle-windows | |
path: ./dist/agent-bundle_windows_amd64.zip | |
msi-build: | |
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved | |
runs-on: ubuntu-20.04 | |
needs: [cross-compile, agent-bundle-windows] | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Downloading binaries-windows_amd64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: binaries-windows_amd64 | |
path: ./bin | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache-dependency-path: '**/go.sum' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: agent-bundle-windows | |
path: ./dist | |
- name: Build MSI | |
run: | | |
mkdir -p dist | |
make msi SKIP_COMPILE=true VERSION="" | |
- name: Uploading msi build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: msi-build | |
path: ./dist/*.msi | |
dotnet-zeroconfig-e2e-test: | |
runs-on: windows-2022 | |
needs: [msi-build] | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache-dependency-path: '**/go.sum' | |
- name: Setup NuGet | |
uses: nuget/[email protected] | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
- uses: actions/[email protected] | |
with: | |
dotnet-version: | | |
6.0.407 | |
- name: Download Splunk OTel Collector msi | |
uses: actions/download-artifact@v3 | |
with: | |
name: msi-build | |
path: ./tests/zeroconfig/windows/testdata/docker-setup/ | |
- name: Get latest signalfx-dotnet-tracing release | |
id: dotnet-tracing | |
uses: pozetroninc/[email protected] | |
with: | |
owner: signalfx | |
repo: signalfx-dotnet-tracing | |
excludes: prerelease, draft | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set SIGNALFX_DOTNET_TRACING_VERSION | |
run: | | |
version="${{ steps.dotnet-tracing.outputs.release }}" | |
sed -i "s|SIGNALFX_DOTNET_TRACING_VERSION|${version#v}|" tests/zeroconfig/windows/testdata/resource_traces/aspnetcore.yaml | |
sed -i "s|SIGNALFX_DOTNET_TRACING_VERSION|${version#v}|" tests/zeroconfig/windows/testdata/resource_traces/aspnetfx.yaml | |
shell: bash | |
- name: Run the test script | |
working-directory: tests/zeroconfig/windows/ | |
run: | | |
.\run-tests.ps1 | |
msi-test: | |
runs-on: ${{ matrix.OS }} | |
needs: [msi-build] | |
strategy: | |
matrix: | |
OS: [ "windows-2019", "windows-2022" ] | |
MODE: [ "agent", "gateway" ] | |
WITH_FLUENTD: [ "true", "false" ] | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Downloading msi build | |
uses: actions/download-artifact@v3 | |
with: | |
name: msi-build | |
path: ./dist | |
- name: Installation test | |
env: | |
token: fake-token | |
realm: fake-realm | |
memory: "256" | |
run: | | |
$ErrorActionPreference = 'Stop' | |
Set-PSDebug -Trace 1 | |
$msi_path = Resolve-Path .\dist\splunk-otel-collector*.msi | |
$env:VERIFY_ACCESS_TOKEN = "false" | |
.\internal\buildscripts\packaging\installer\install.ps1 -access_token "${{ env.token }}" -realm "${{ env.realm }}" -msi_path "$msi_path" -mode "${{ matrix.MODE }}" -memory "${{ env.memory }}" -with_fluentd $${{ matrix.WITH_FLUENTD }} | |
Start-Sleep -s 30 | |
& ${{ github.workspace }}\.github\workflows\scripts\win-test-services.ps1 -mode "${{ matrix.MODE }}" -access_token "${{ env.token }}" -realm "${{ env.realm }}" -memory "${{ env.memory }}" -with_fluentd "${{ matrix.WITH_FLUENTD }}" | |
& ${{ github.workspace }}\.github\workflows\scripts\win-test-support-bundle.ps1 -mode "${{ matrix.MODE }}" -with_fluentd "${{ matrix.WITH_FLUENTD }}" | |
Resolve-Path -Path "$env:ProgramFiles\Splunk\OpenTelemetry Collector\agent-bundle\python\python.exe" | |
Resolve-Path -Path "$env:ProgramFiles\Splunk\OpenTelemetry Collector\agent-bundle\collectd-python" | |
Resolve-Path -Path "$env:SYSTEMDRIVE\opt\opentelemetry-java-contrib-jmx-metrics.jar" | |
- name: splunk-otel-collector logs | |
if: ${{ always() }} | |
run: Get-WinEvent -ProviderName splunk-otel-collector | Sort-Object -Property TimeCreated | Select-Object -Property Message | Format-List | |
- name: fluentd logs | |
if: ${{ always() && matrix.WITH_FLUENTD == 'true' }} | |
run: Get-Content -Path "${env:SYSTEMDRIVE}\opt\td-agent\td-agent.log" | |
choco-build: | |
runs-on: windows-2019 | |
needs: [msi-build] | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Downloading msi build | |
uses: actions/download-artifact@v3 | |
with: | |
name: msi-build | |
path: ./dist | |
- name: Build Chocolatey | |
run: | | |
$ErrorActionPreference = 'Stop' | |
Set-PSDebug -Trace 1 | |
$msi_file_path = Resolve-Path .\dist\splunk-otel-collector*.msi | |
$msi_file_name = Resolve-Path .\dist\splunk-otel-collector*.msi | Split-Path -leaf | |
$msi_file_name -match '(\d+\.)(\d+\.)+(\d*)' | |
$version = $matches[0] | |
write-host "Building choco package..." | |
.\internal\buildscripts\packaging\choco\make.ps1 build_choco -MSIFile $msi_file_path -Version $version | Tee-Object -file .\dist\build_logs.log | |
Test-Path -Path ".\dist\splunk-otel-collector.$version.nupkg" | |
- name: Test install without parameters | |
run: | | |
$ErrorActionPreference = 'Stop' | |
Set-PSDebug -Trace 1 | |
choco install splunk-otel-collector -s=".\dist" -y | |
if ($LASTEXITCODE -ne 0) { | |
throw "choco install failed!" | |
} | |
# the collector service should not be running if installed without the SPLUNK_ACCESS_TOKEN parameter | |
if ((Get-CimInstance -ClassName win32_service -Filter "Name = 'splunk-otel-collector'" | Select Name, State).State -Eq "Running") { | |
throw "splunk-otel-collector is running" | |
} | |
- name: Uploading choco build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: choco-build | |
path: ./dist/*.nupkg | |
choco-test: | |
runs-on: ${{ matrix.OS }} | |
needs: [choco-build] | |
strategy: | |
matrix: | |
OS: [ "windows-2019", "windows-2022" ] | |
MODE: [ "agent", "gateway" ] | |
WITH_FLUENTD: [ "true", "false" ] | |
SCENARIO: [ "install", "upgrade" ] | |
fail-fast: false | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Downloading choco build | |
uses: actions/download-artifact@v3 | |
with: | |
name: choco-build | |
path: ./dist | |
- name: Chocolatey ${{ matrix.SCENARIO }} test | |
env: | |
token: fake-token | |
realm: fake-realm | |
memory: "256" | |
run: | | |
$ErrorActionPreference = 'Stop' | |
Set-PSDebug -Trace 1 | |
$choco_file_name = Resolve-Path .\dist\splunk-otel-collector*.nupkg | |
$params = "/SPLUNK_ACCESS_TOKEN=${{ env.token }} /SPLUNK_REALM=${{ env.realm }} /SPLUNK_MEMORY_TOTAL_MIB=${{ env.memory }} /MODE:${{ matrix.MODE }} /WITH_FLUENTD:${{ matrix.WITH_FLUENTD }}" | |
if ("${{ matrix.SCENARIO }}" -eq "install") { | |
write-host "Installing $choco_file_name ..." | |
choco install splunk-otel-collector -s=".\dist" --params="'$params'" -y | |
if ($LASTEXITCODE -ne 0) { | |
throw "choco install failed!" | |
} | |
} else { | |
write-host "Installing splunk-otel-collector 0.74.0 ..." | |
choco feature enable -n=useRememberedArgumentsForUpgrades | |
choco install splunk-otel-collector --no-progress --version=0.74.0 --params="'$params'" -y | |
if ($LASTEXITCODE -ne 0) { | |
throw "choco install failed!" | |
} | |
Start-Sleep 30 | |
write-host "Upgrading $choco_file_name ..." | |
choco upgrade splunk-otel-collector -s=".\dist" -y | |
if ($LASTEXITCODE -ne 0) { | |
throw "choco upgrade failed!" | |
} | |
} | |
Start-Sleep -s 30 | |
& ${{ github.workspace }}\.github\workflows\scripts\win-test-services.ps1 -mode "${{ matrix.MODE }}" -access_token "${{ env.token }}" -realm "${{ env.realm }}" -memory "${{ env.memory }}" -with_fluentd "${{ matrix.WITH_FLUENTD }}" | |
& ${{ github.workspace }}\.github\workflows\scripts\win-test-support-bundle.ps1 -mode "${{ matrix.MODE }}" -with_fluentd "${{ matrix.WITH_FLUENTD }}" | |
- name: splunk-otel-collector logs | |
if: ${{ always() }} | |
run: Get-WinEvent -ProviderName splunk-otel-collector | Sort-Object -Property TimeCreated | Select-Object -Property Message | Format-List | |
- name: fluentd logs | |
if: ${{ always() && matrix.WITH_FLUENTD == 'true' }} | |
run: Get-Content -Path "${env:SYSTEMDRIVE}\opt\td-agent\td-agent.log" | |
- name: Uninstall test | |
run: | | |
choco uninstall splunk-otel-collector -y | |
if ($LASTEXITCODE -ne 0) { | |
throw "choco uninstall failed!" | |
} | |
Start-Sleep -s 30 | |
if ((Get-CimInstance -ClassName win32_service -Filter "Name = 'splunk-otel-collector'" | Select Name, State).State -Eq "Running") { | |
throw "splunk-otel-collector service is still running" | |
} | |
docker-otelcol: | |
runs-on: ${{ matrix.OS }} | |
needs: [cross-compile, agent-bundle-windows] | |
strategy: | |
matrix: | |
OS: [ "windows-2019", "windows-2022" ] | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Downloading binaries-windows_amd64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: binaries-windows_amd64 | |
path: ./bin | |
- uses: actions/download-artifact@v3 | |
with: | |
name: agent-bundle-windows | |
path: ./dist | |
- name: Build docker image | |
run: | | |
$ErrorActionPreference = 'Stop' | |
Copy-Item .\bin\otelcol_windows_amd64.exe .\cmd\otelcol\otelcol.exe | |
Copy-Item .\bin\translatesfx_windows_amd64.exe .\cmd\otelcol\translatesfx.exe | |
Copy-Item .\dist\agent-bundle_windows_amd64.zip .\cmd\otelcol\agent-bundle_windows_amd64.zip | |
if ("${{ matrix.OS }}" -eq "windows-2019") { | |
docker build -t otelcol-windows --build-arg BASE_IMAGE=mcr.microsoft.com/windows/servercore:1809 --build-arg JMX_METRIC_GATHERER_RELEASE=$(Get-Content internal\buildscripts\packaging\jmx-metric-gatherer-release.txt) -f .\cmd\otelcol\Dockerfile.windows .\cmd\otelcol\ | |
} else { | |
docker build -t otelcol-windows --build-arg BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022 --build-arg JMX_METRIC_GATHERER_RELEASE=$(Get-Content internal\buildscripts\packaging\jmx-metric-gatherer-release.txt) -f .\cmd\otelcol\Dockerfile.windows .\cmd\otelcol\ | |
} | |
Remove-Item .\cmd\otelcol\otelcol.exe | |
Remove-Item .\cmd\otelcol\translatesfx.exe | |
Remove-Item .\cmd\otelcol\agent-bundle_windows_amd64.zip | |
- name: Run docker image | |
run: | | |
$ErrorActionPreference = 'Stop' | |
docker run -d -e SPLUNK_ACCESS_TOKEN=12345 -e SPLUNK_REALM=fake-realm --name otelcol otelcol-windows:latest | |
Start-Sleep 10 | |
$DockerOutput=$(docker ps --filter=status=running --filter=name=otelcol -q) | |
if ( $DockerOutput -eq $null ) { | |
docker logs otelcol | |
echo "Failing job execution: fail to start otelcol docker container in 10 seconds." | |
exit 1 | |
} | |
$JavaCmdOutput=$(docker exec -it otelcol java -version) | |
if ( ${JavaCmdOutput:0::15} -ne 'openjdk version' ) { | |
docker logs otelcol | |
echo "Failing job execution: Failed to run java, command output: ${JavaCmdOutput}" | |
} |