Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "MSI: Add support to all required configurations" #4547

Merged
merged 7 commits into from Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 7 additions & 11 deletions .github/workflows/scripts/win-test-services.ps1
Expand Up @@ -4,9 +4,7 @@ param (
[string]$realm = "test",
[string]$memory = "512",
[string]$with_fluentd = "true",
[string]$with_msi_uninstall_comments = "",
[string]$api_url = "https://api.${realm}.signalfx.com",
[string]$ingest_url = "https://ingest.${realm}.signalfx.com"
[string]$with_msi_uninstall_comments = ""
)

$ErrorActionPreference = 'Stop'
Expand Down Expand Up @@ -38,24 +36,22 @@ function service_running([string]$name) {
return ((Get-CimInstance -ClassName win32_service -Filter "Name = '$name'" | Select Name, State).State -Eq "Running")
}

$expected_svc_env_vars = @{
$api_url = "https://api.${realm}.signalfx.com"
$ingest_url = "https://ingest.${realm}.signalfx.com"

check_collector_svc_environment @{
"SPLUNK_CONFIG" = "${env:PROGRAMDATA}\Splunk\OpenTelemetry Collector\${mode}_config.yaml";
"SPLUNK_ACCESS_TOKEN" = "$access_token";
"SPLUNK_REALM" = "$realm";
"SPLUNK_API_URL" = "$api_url";
"SPLUNK_API_URL" = "$api_url";
"SPLUNK_INGEST_URL" = "$ingest_url";
"SPLUNK_TRACE_URL" = "${ingest_url}/v2/trace";
"SPLUNK_HEC_URL" = "${ingest_url}/v1/log";
"SPLUNK_HEC_TOKEN" = "$access_token";
"SPLUNK_BUNDLE_DIR" = "${env:PROGRAMFILES}\Splunk\OpenTelemetry Collector\agent-bundle";
"SPLUNK_MEMORY_TOTAL_MIB" = "$memory";
}

if (![string]::IsNullOrWhitespace($memory)) {
$expected_svc_env_vars["SPLUNK_MEMORY_TOTAL_MIB"] = "$memory"
}

check_collector_svc_environment $expected_svc_env_vars

if ((service_running -name "splunk-otel-collector")) {
write-host "splunk-otel-collector service is running."
} else {
Expand Down
75 changes: 14 additions & 61 deletions .github/workflows/win-package-test.yml
Expand Up @@ -91,39 +91,10 @@ jobs:
name: agent-bundle-windows
path: ./dist/agent-bundle_windows_amd64.zip

msi-custom-actions:
runs-on: windows-2022
steps:
- name: Check out the codebase.
uses: actions/checkout@v4

- name: Build Custom Actions
working-directory: internal/buildscripts/packaging/msi/SplunkCustomActions
run: |
dotnet publish ./SplunkCustomActions.csproj -c Release -o ./bin/Release

- name: Package Custom Actions
run: |
$WixPath = "${Env:ProgramFiles(x86)}\WiX Toolset v3.14"
$sfxcaDll = "${WixPath}\SDK\x64\sfxca.dll"
$Env:PATH = "${WixPath}\SDK;" + $Env:PATH
$customActionDir = "${PWD}\internal\buildscripts\packaging\msi\SplunkCustomActions"
$customActionBinDir = "${customActionDir}\bin\Release"
MakeSfxCA.exe "${PWD}\dist\SplunkCustomActions.CA.dll" `
"${sfxcaDll}" `
"${customActionBinDir}\SplunkCustomActions.dll" `
"${customActionBinDir}\Microsoft.Deployment.WindowsInstaller.dll" `
"${customActionDir}\CustomAction.config"

- uses: actions/upload-artifact@v4
with:
name: msi-custom-actions
path: ./dist/SplunkCustomActions.CA.dll

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, msi-custom-actions]
needs: [cross-compile, agent-bundle-windows]
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
Expand All @@ -142,18 +113,11 @@ jobs:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'

- name: Downloading agent-bundle-windows
uses: actions/download-artifact@v4
- uses: actions/download-artifact@v4
with:
name: agent-bundle-windows
path: ./dist

- name: Downloading msi-custom-actions
uses: actions/download-artifact@v4
with:
name: msi-custom-actions
path: ./internal/buildscripts/packaging/msi/SplunkCustomActions/bin/Release

- name: Build MSI
run: |
mkdir -p dist
Expand Down Expand Up @@ -222,24 +186,7 @@ jobs:
strategy:
matrix:
OS: [ "windows-2022" ]
install-properties:

- install: "SPLUNK_ACCESS_TOKEN=fakeToken"
expected: "-mode agent -access_token fakeToken -realm us0 -memory $null -with_fluentd false"

- install: "SPLUNK_SETUP_COLLECTOR_MODE=gateway SPLUNK_ACCESS_TOKEN=testing123"
expected: "-mode gateway -access_token testing123 -realm us0 -memory $null -with_fluentd false"

- install: "SPLUNK_REALM=myrealm SPLUNK_ACCESS_TOKEN=testing"
expected: "-mode agent -access_token testing -realm myrealm -memory $null -with_fluentd false"

- install: "SPLUNK_INGEST_URL=https://fake.ingest.url SPLUNK_ACCESS_TOKEN=testing"
expected: "-mode agent -realm us0 -access_token testing -ingest_url \"https://fake.ingest.url\" -memory $null -with_fluentd false"

steps:
- name: Check out the codebase.
uses: actions/checkout@v4

- name: Downloading msi build
uses: actions/download-artifact@v4
with:
Expand All @@ -252,7 +199,7 @@ jobs:
$msi_path = Resolve-Path .\dist\splunk-otel-collector*.msi
Test-Path $msi_path
Write-Host "Installing $msi_path ..."
$process = Start-Process -Wait -PassThru msiexec "/i `"$msi_path`" /qn /l*v msi-install.log ${{ matrix.install-properties.install }}"
$process = Start-Process -Wait -PassThru msiexec "/i `"$msi_path`" /qn /l*v msi-install.log"
if ($process.ExitCode -ne 0) {
throw "MSI installation failed with exit code $($process.ExitCode)"
}
Expand All @@ -261,15 +208,21 @@ jobs:
if: ${{ failure() }}
run: Get-Content msi-install.log

- name: Set environment variables required to start the collector service
run: |
$ErrorActionPreference = 'Stop'
[Environment]::SetEnvironmentVariable("SPLUNK_ACCESS_TOKEN", "123456e", "Machine")
[Environment]::SetEnvironmentVariable("SPLUNK_API_URL", "https://non.existent.for.tests", "Machine")
[Environment]::SetEnvironmentVariable("SPLUNK_HEC_TOKEN", "098765e", "Machine")
[Environment]::SetEnvironmentVariable("SPLUNK_HEC_URL", "https://non.existent.for.tests/v1/log", "Machine")
[Environment]::SetEnvironmentVariable("SPLUNK_INGEST_URL", "https://non.existent.for.tests", "Machine")
[Environment]::SetEnvironmentVariable("SPLUNK_TRACE_URL", "https://non.existent.for.tests/v2/trace", "Machine")
[Environment]::SetEnvironmentVariable("SPLUNK_BUNDLE_DIR", "%ProgramFiles%\Splunk\OpenTelemetry", "Machine")

- name: Start the collector service
run:
Start-Service splunk-otel-collector

- name: Check registry expectations
run: |
$ErrorActionPreference = 'Stop'
& ${{ github.workspace }}\.github\workflows\scripts\win-test-services.ps1 ${{ matrix.install-properties.expected }}

- name: Stop the collector service
run:
Stop-Service splunk-otel-collector
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Expand Up @@ -24,10 +24,6 @@ coverage_all.txt
coverage_old.txt
coverage.html

# Exclude folders used to build MSI locally
/build/
/work/

# Wix
*.wixobj
*.wixpdb
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion internal/buildscripts/packaging/msi/make.ps1
Expand Up @@ -35,7 +35,7 @@ function Install-Tools {
$ProgressPreference = $OriginalPref

choco install wixtoolset -y
setx /m PATH "%PATH%;C:\Program Files (x86)\WiX Toolset v3.14\bin"
setx /m PATH "%PATH%;C:\Program Files (x86)\WiX Toolset v3.11\bin"
refreshenv
}

Expand Down