Skip to content

Commit

Permalink
Revert "MSI: Add support to all required configurations" (#4547)
Browse files Browse the repository at this point in the history
* Revert "Improve tests"

This reverts commit 0e1eb31.

* Revert "Add all required configurations to the MSI installer"

This reverts commit c89ee8d.

* Revert "Make MSI more capable during setup"

This reverts commit ab04b54.

* Revert "Git ignore the source generated by Wix heat tool"

This reverts commit 48eafef.

* Revert "Validated one property and custom actions"

This reverts commit 18d548f.

* Revert "MSI build.sh script changes to build MSI locally"

This reverts commit 469216e.

* Revert "Exclude folders to build MSI locally"

This reverts commit 5416185.
  • Loading branch information
pjanotti committed Mar 28, 2024
1 parent 4236bbf commit 5119087
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 314 deletions.
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

0 comments on commit 5119087

Please sign in to comment.