From e48e5060a245a81ab1a6ba79e853d943e74d8b4d Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Mon, 25 Nov 2024 18:33:25 -0800 Subject: [PATCH 01/15] Add github workflow for MSI tests --- .github/workflows/base-ci-goreleaser.yaml | 9 ++++++ .github/workflows/ci-goreleaser-contrib.yaml | 8 ++++++ .github/workflows/ci-goreleaser-core.yaml | 9 +++++- .github/workflows/msi-tests.yaml | 30 ++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/msi-tests.yaml diff --git a/.github/workflows/base-ci-goreleaser.yaml b/.github/workflows/base-ci-goreleaser.yaml index d5952c67..bd63fe6a 100644 --- a/.github/workflows/base-ci-goreleaser.yaml +++ b/.github/workflows/base-ci-goreleaser.yaml @@ -87,3 +87,12 @@ jobs: name: linux-packages path: distributions/${{ inputs.distribution }}/dist/linux_amd64_v1/* if-no-files-found: error + + - name: Upload MSI packages + if: ${{ matrix.GOOS == 'windows' && matrix.GOARCH == 'amd64' }} + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: msi-packages + path: distributions/${{ inputs.distribution }}/dist/windows_amd64_v1/*.msi + if-no-files-found: error + \ No newline at end of file diff --git a/.github/workflows/ci-goreleaser-contrib.yaml b/.github/workflows/ci-goreleaser-contrib.yaml index ad7db0a6..aea72081 100644 --- a/.github/workflows/ci-goreleaser-contrib.yaml +++ b/.github/workflows/ci-goreleaser-contrib.yaml @@ -39,3 +39,11 @@ jobs: with: distribution: otelcol-contrib type: '[ "deb", "rpm" ]' + + msi-tests: + name: MSI tests + needs: check-goreleaser + uses: ./.github/workflows/msi-tests.yaml + with: + distribution: otelcol-contrib + type: '[ "msi" ]' diff --git a/.github/workflows/ci-goreleaser-core.yaml b/.github/workflows/ci-goreleaser-core.yaml index 50410eb7..fe5b29a0 100644 --- a/.github/workflows/ci-goreleaser-core.yaml +++ b/.github/workflows/ci-goreleaser-core.yaml @@ -22,7 +22,6 @@ on: - "go.mod" - "go.sum" - jobs: check-goreleaser: name: Continuous Integration - Core - GoReleaser @@ -40,3 +39,11 @@ jobs: with: distribution: otelcol type: '[ "deb", "rpm" ]' + + msi-tests: + name: MSI tests + needs: check-goreleaser + uses: ./.github/workflows/msi-tests.yaml + with: + distribution: otelcol + type: '[ "msi" ]' diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml new file mode 100644 index 00000000..03e3d40d --- /dev/null +++ b/.github/workflows/msi-tests.yaml @@ -0,0 +1,30 @@ +name: MSI Tests + +on: + workflow_call: + inputs: + type: + required: true + type: string + distribution: + required: true + type: string + +jobs: + msi-tests: + name: MSI Tests + runs-on: windows-2022 # otel-windows-latest-8-cores + strategy: + matrix: + type: ${{ fromJSON(inputs.type) }} + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Download built artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: msi-packages + + - name: Test ${{ matrix.type }} packages + run: dir -r .\*.msi From 10607bd4c3432fe208c0b0822e32331c5d02c80b Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Mon, 25 Nov 2024 18:47:52 -0800 Subject: [PATCH 02/15] Find MSI location (temporary) --- .github/workflows/base-ci-goreleaser.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/base-ci-goreleaser.yaml b/.github/workflows/base-ci-goreleaser.yaml index bd63fe6a..0e9eb738 100644 --- a/.github/workflows/base-ci-goreleaser.yaml +++ b/.github/workflows/base-ci-goreleaser.yaml @@ -88,6 +88,11 @@ jobs: path: distributions/${{ inputs.distribution }}/dist/linux_amd64_v1/* if-no-files-found: error + - name: Find MSI location (temporary) + if: ${{ matrix.GOOS == 'windows' && matrix.GOARCH == 'amd64' }} + run: | + find ./ -name "*.msi" + - name: Upload MSI packages if: ${{ matrix.GOOS == 'windows' && matrix.GOARCH == 'amd64' }} uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 @@ -95,4 +100,3 @@ jobs: name: msi-packages path: distributions/${{ inputs.distribution }}/dist/windows_amd64_v1/*.msi if-no-files-found: error - \ No newline at end of file From 51d43d18736c7b9a5d9e79289a2a2019a5c3cae4 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Tue, 26 Nov 2024 10:05:35 -0800 Subject: [PATCH 03/15] Fix path for upload-artifact for MSI --- .github/workflows/base-ci-goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/base-ci-goreleaser.yaml b/.github/workflows/base-ci-goreleaser.yaml index 0e9eb738..1c892cd0 100644 --- a/.github/workflows/base-ci-goreleaser.yaml +++ b/.github/workflows/base-ci-goreleaser.yaml @@ -98,5 +98,5 @@ jobs: uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: msi-packages - path: distributions/${{ inputs.distribution }}/dist/windows_amd64_v1/*.msi + path: distributions/${{ inputs.distribution }}/dist/windows_amd64_v1/**/*.msi if-no-files-found: error From 2134da7b3666d1db3a8279b00404533e6f1ea577 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Mon, 2 Dec 2024 12:10:44 -0800 Subject: [PATCH 04/15] Add golang tests --- .github/workflows/msi-tests.yaml | 19 ++- tests/msi/go.mod | 14 +++ tests/msi/go.sum | 12 ++ tests/msi/msi_test.go | 197 +++++++++++++++++++++++++++++++ 4 files changed, 239 insertions(+), 3 deletions(-) create mode 100644 tests/msi/go.mod create mode 100644 tests/msi/go.sum create mode 100644 tests/msi/msi_test.go diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index 03e3d40d..e135f7f7 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -13,7 +13,7 @@ on: jobs: msi-tests: name: MSI Tests - runs-on: windows-2022 # otel-windows-latest-8-cores + runs-on: otel-windows-latest-8-cores strategy: matrix: type: ${{ fromJSON(inputs.type) }} @@ -26,5 +26,18 @@ jobs: with: name: msi-packages - - name: Test ${{ matrix.type }} packages - run: dir -r .\*.msi + - name: Set MSI tests required environment variables + run: | + $ErrorActionPreference = 'Stop' + $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml + Test-Path $alt_config_path + "MSI_TEST_ALTERNATE_CONFIG_FILE=$alt_config_path" | Out-File -FilePath $env:GITHUB_ENV -Append + $msi_path = Resolve-Path .\msi\*\*\*.msi + Test-Path $msi_path + "MSI_TEST_COLLECTOR_PATH=$msi_path" | Out-File -FilePath $env:GITHUB_ENV -Append + "MSI_TEST_COLLECTOR_SERVICE_NAME=${{ inputs.distribution }}" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Run the MSI tests + working-directory: tests/msi + run: | + go test -timeout 15m -v ./... diff --git a/tests/msi/go.mod b/tests/msi/go.mod new file mode 100644 index 00000000..b5477649 --- /dev/null +++ b/tests/msi/go.mod @@ -0,0 +1,14 @@ +module msi + +go 1.23 + +require ( + github.com/stretchr/testify v1.10.0 + golang.org/x/sys v0.27.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/tests/msi/go.sum b/tests/msi/go.sum new file mode 100644 index 00000000..ba4b652e --- /dev/null +++ b/tests/msi/go.sum @@ -0,0 +1,12 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tests/msi/msi_test.go b/tests/msi/msi_test.go new file mode 100644 index 00000000..15166c63 --- /dev/null +++ b/tests/msi/msi_test.go @@ -0,0 +1,197 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows + +package msi + +import ( + "os" + "os/exec" + "path/filepath" + "strings" + "syscall" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "golang.org/x/sys/windows/svc" + "golang.org/x/sys/windows/svc/mgr" +) + +// Test structure for MSI installation tests +type msiTest struct { + name string + collectorServiceArgs string + skipSvcStop bool +} + +func TestMSI(t *testing.T) { + msiInstallerPath := getInstallerPath(t) + + tests := []msiTest{ + { + name: "default", + }, + { + name: "custom", + collectorServiceArgs: "--config " + quotedIfRequired(getAlternateConfigFile(t)), + skipSvcStop: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + runMsiTest(t, tt, msiInstallerPath) + }) + } +} + +func runMsiTest(t *testing.T, test msiTest, msiInstallerPath string) { + // Build the MSI installation arguments and include the MSI properties map. + installLogFile := filepath.Join(os.TempDir(), "install.log") + args := []string{"/i", msiInstallerPath, "/qn", "/l*v", installLogFile} + + serviceArgs := quotedIfRequired(test.collectorServiceArgs) + if test.collectorServiceArgs != "" { + args = append(args, "COLLECTOR_SVC_ARGS="+serviceArgs) + } + + // Run the MSI installer + installCmd := exec.Command("msiexec") + + // msiexec is one of the noticeable exceptions about how to format the parameters, + // see https://pkg.go.dev/os/exec#Command, so we need to join the args manually. + cmdLine := strings.Join(args, " ") + installCmd.SysProcAttr = &syscall.SysProcAttr{CmdLine: "msiexec " + cmdLine} + err := installCmd.Run() + if err != nil { + logText, _ := os.ReadFile(installLogFile) + t.Log(string(logText)) + } + t.Logf("Install command: %s", installCmd.SysProcAttr.CmdLine) + require.NoError(t, err, "Failed to install the MSI: %v\nArgs: %v", err, args) + + defer func() { + // Uninstall the MSI + uninstallCmd := exec.Command("msiexec") + uninstallCmd.SysProcAttr = &syscall.SysProcAttr{CmdLine: "msiexec /x " + msiInstallerPath + " /qn"} + err := uninstallCmd.Run() + t.Logf("Uninstall command: %s", uninstallCmd.SysProcAttr.CmdLine) + require.NoError(t, err, "Failed to uninstall the MSI: %v", err) + }() + + // Verify the service + scm, err := mgr.Connect() + require.NoError(t, err) + defer scm.Disconnect() + + collectorSvcName := getServiceName(t) + service, err := scm.OpenService(collectorSvcName) + require.NoError(t, err) + defer service.Close() + + // Wait for the service to reach the running state + require.Eventually(t, func() bool { + status, err := service.Query() + require.NoError(t, err) + return status.State == svc.Running + }, 10*time.Second, 500*time.Millisecond, "Failed to start the service") + + if !test.skipSvcStop { + defer func() { + _, err = service.Control(svc.Stop) + require.NoError(t, err) + + require.Eventually(t, func() bool { + status, err := service.Query() + require.NoError(t, err) + return status.State == svc.Stopped + }, 10*time.Second, 500*time.Millisecond, "Failed to stop the service") + }() + } + + assertServiceCommand(t, collectorSvcName, serviceArgs) +} + +func assertServiceCommand(t *testing.T, serviceName, collectorServiceArgs string) { + // Verify the service command + actualCommand := getServiceCommand(t, serviceName) + expectedCommand := expectedServiceCommand(t, serviceName, collectorServiceArgs) + assert.Equal(t, expectedCommand, actualCommand) +} + +func getServiceCommand(t *testing.T, serviceName string) string { + scm, err := mgr.Connect() + require.NoError(t, err) + defer scm.Disconnect() + + service, err := scm.OpenService(serviceName) + require.NoError(t, err) + defer service.Close() + + config, err := service.Config() + require.NoError(t, err) + + return config.BinaryPathName +} + +func expectedServiceCommand(t *testing.T, serviceName, collectorServiceArgs string) string { + programFilesDir := os.Getenv("PROGRAMFILES") + require.NotEmpty(t, programFilesDir, "PROGRAMFILES environment variable is not set") + + collectorDir := filepath.Join(programFilesDir, "OpenTelemetry Collector") + collectorExe := filepath.Join(collectorDir, serviceName) + ".exe" + + if collectorServiceArgs == "" { + collectorServiceArgs = "--config " + quotedIfRequired(filepath.Join(collectorDir, "config.yaml")) + } else { + // Remove any quotation added for the msiexec command line + collectorServiceArgs = strings.Trim(collectorServiceArgs, "\"") + collectorServiceArgs = strings.ReplaceAll(collectorServiceArgs, "\"\"", "\"") + } + + return quotedIfRequired(collectorExe) + " " + collectorServiceArgs +} + +func getServiceName(t *testing.T) string { + serviceName := os.Getenv("MSI_TEST_COLLECTOR_SERVICE_NAME") + require.NotEmpty(t, serviceName, "MSI_TEST_COLLECTOR_SERVICE_NAME environment variable is not set") + return serviceName +} + +func getInstallerPath(t *testing.T) string { + msiInstallerPath := os.Getenv("MSI_TEST_COLLECTOR_PATH") + require.NotEmpty(t, msiInstallerPath, "MSI_TEST_COLLECTOR_PATH environment variable is not set") + _, err := os.Stat(msiInstallerPath) + require.NoError(t, err) + return msiInstallerPath +} + +func getAlternateConfigFile(t *testing.T) string { + alternateConfigFile := os.Getenv("MSI_TEST_ALTERNATE_CONFIG_FILE") + require.NotEmpty(t, alternateConfigFile, "MSI_TEST_ALTERNATE_CONFIG_FILE environment variable is not set") + _, err := os.Stat(alternateConfigFile) + require.NoError(t, err) + return alternateConfigFile +} + +func quotedIfRequired(s string) string { + if strings.Contains(s, "\"") || strings.Contains(s, " ") { + s = strings.ReplaceAll(s, "\"", "\"\"") + return "\"" + s + "\"" + } + return s +} From a115df714101f20d9e75b3c27056722b97c3261b Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Mon, 2 Dec 2024 17:36:36 -0800 Subject: [PATCH 05/15] Fix path to MSI --- .github/workflows/msi-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index e135f7f7..0dd84d07 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -32,7 +32,7 @@ jobs: $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml Test-Path $alt_config_path "MSI_TEST_ALTERNATE_CONFIG_FILE=$alt_config_path" | Out-File -FilePath $env:GITHUB_ENV -Append - $msi_path = Resolve-Path .\msi\*\*\*.msi + $msi_path = Resolve-Path .\msi\*.msi Test-Path $msi_path "MSI_TEST_COLLECTOR_PATH=$msi_path" | Out-File -FilePath $env:GITHUB_ENV -Append "MSI_TEST_COLLECTOR_SERVICE_NAME=${{ inputs.distribution }}" | Out-File -FilePath $env:GITHUB_ENV -Append From 438d18106eea2d74e6c1a9b52216e4bc0ebc07f1 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Tue, 3 Dec 2024 11:04:37 -0800 Subject: [PATCH 06/15] Temporary step to check MSI location --- .github/workflows/msi-tests.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index 0dd84d07..cdeacd18 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -26,12 +26,18 @@ jobs: with: name: msi-packages + - name: Temporary check for msi location + run: | + Get-Location + Get-ChildItem -Path .\*.msi -Recurse + - name: Set MSI tests required environment variables run: | $ErrorActionPreference = 'Stop' $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml Test-Path $alt_config_path "MSI_TEST_ALTERNATE_CONFIG_FILE=$alt_config_path" | Out-File -FilePath $env:GITHUB_ENV -Append + Get-Location $msi_path = Resolve-Path .\msi\*.msi Test-Path $msi_path "MSI_TEST_COLLECTOR_PATH=$msi_path" | Out-File -FilePath $env:GITHUB_ENV -Append From 7df27a891751768d162f5b2db64128d95f058101 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Tue, 3 Dec 2024 11:35:39 -0800 Subject: [PATCH 07/15] Fix MSI location --- .github/workflows/msi-tests.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index cdeacd18..3da42dd9 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -26,19 +26,13 @@ jobs: with: name: msi-packages - - name: Temporary check for msi location - run: | - Get-Location - Get-ChildItem -Path .\*.msi -Recurse - - name: Set MSI tests required environment variables run: | $ErrorActionPreference = 'Stop' $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml Test-Path $alt_config_path "MSI_TEST_ALTERNATE_CONFIG_FILE=$alt_config_path" | Out-File -FilePath $env:GITHUB_ENV -Append - Get-Location - $msi_path = Resolve-Path .\msi\*.msi + $msi_path = Resolve-Path .\*.msi Test-Path $msi_path "MSI_TEST_COLLECTOR_PATH=$msi_path" | Out-File -FilePath $env:GITHUB_ENV -Append "MSI_TEST_COLLECTOR_SERVICE_NAME=${{ inputs.distribution }}" | Out-File -FilePath $env:GITHUB_ENV -Append From 711b38aa65b8d7fe3bd2f2aa4f6567ad69f6d94e Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Tue, 3 Dec 2024 12:45:20 -0800 Subject: [PATCH 08/15] Debug powershell cmds --- .github/workflows/msi-tests.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index 3da42dd9..afd6d2c2 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -29,11 +29,12 @@ jobs: - name: Set MSI tests required environment variables run: | $ErrorActionPreference = 'Stop' + Set-PSDebug -Trace 1 + $msi_path = Resolve-Path .\*.msi + Test-Path $msi_path $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml Test-Path $alt_config_path "MSI_TEST_ALTERNATE_CONFIG_FILE=$alt_config_path" | Out-File -FilePath $env:GITHUB_ENV -Append - $msi_path = Resolve-Path .\*.msi - Test-Path $msi_path "MSI_TEST_COLLECTOR_PATH=$msi_path" | Out-File -FilePath $env:GITHUB_ENV -Append "MSI_TEST_COLLECTOR_SERVICE_NAME=${{ inputs.distribution }}" | Out-File -FilePath $env:GITHUB_ENV -Append From a194949fda81df03c5acd81c1c7c5d2543b68d3f Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Tue, 3 Dec 2024 13:26:28 -0800 Subject: [PATCH 09/15] Testing powershell cmds --- .github/workflows/msi-tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index afd6d2c2..cee1abdc 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -30,7 +30,8 @@ jobs: run: | $ErrorActionPreference = 'Stop' Set-PSDebug -Trace 1 - $msi_path = Resolve-Path .\*.msi + Resolve-Path ./*.msi + $msi_path = Resolve-Path ./*.msi Test-Path $msi_path $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml Test-Path $alt_config_path From 9b507fcab78287eb5ecd3efabafd01d5bca86ec5 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Tue, 3 Dec 2024 13:33:37 -0800 Subject: [PATCH 10/15] More pwsh debugging --- .github/workflows/msi-tests.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index cee1abdc..17e08b91 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -29,9 +29,11 @@ jobs: - name: Set MSI tests required environment variables run: | $ErrorActionPreference = 'Stop' - Set-PSDebug -Trace 1 - Resolve-Path ./*.msi - $msi_path = Resolve-Path ./*.msi + Set-PSDebug -Trace 2 + Get-ChildItem -Path .\*.msi -Recurse + Resolve-Path .\*.msi + $msi_path = Resolve-Path .\*.msi + $msi_path Test-Path $msi_path $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml Test-Path $alt_config_path From 8ed952c6e203f40f2342f4aad5d3fae650b6ed69 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Tue, 3 Dec 2024 13:52:17 -0800 Subject: [PATCH 11/15] Fix path (still with debugging) --- .github/workflows/msi-tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index 17e08b91..75843b3f 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -31,8 +31,8 @@ jobs: $ErrorActionPreference = 'Stop' Set-PSDebug -Trace 2 Get-ChildItem -Path .\*.msi -Recurse - Resolve-Path .\*.msi - $msi_path = Resolve-Path .\*.msi + Resolve-Path .\msi\*\*.msi + $msi_path = Resolve-Path .\msi\*\*.msi $msi_path Test-Path $msi_path $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml From 5b15d649c00f92558150f1ce646567de57be9d11 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Tue, 3 Dec 2024 14:42:50 -0800 Subject: [PATCH 12/15] Cleanup CI debug code --- .github/workflows/msi-tests.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index 75843b3f..a6e24424 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -29,14 +29,10 @@ jobs: - name: Set MSI tests required environment variables run: | $ErrorActionPreference = 'Stop' - Set-PSDebug -Trace 2 - Get-ChildItem -Path .\*.msi -Recurse - Resolve-Path .\msi\*\*.msi - $msi_path = Resolve-Path .\msi\*\*.msi - $msi_path - Test-Path $msi_path $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml Test-Path $alt_config_path + $msi_path = Resolve-Path .\msi\*\*.msi + Test-Path $msi_path "MSI_TEST_ALTERNATE_CONFIG_FILE=$alt_config_path" | Out-File -FilePath $env:GITHUB_ENV -Append "MSI_TEST_COLLECTOR_PATH=$msi_path" | Out-File -FilePath $env:GITHUB_ENV -Append "MSI_TEST_COLLECTOR_SERVICE_NAME=${{ inputs.distribution }}" | Out-File -FilePath $env:GITHUB_ENV -Append From b2c452eed71a8056b5502d80fc96f89eaa23f7b0 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Thu, 5 Dec 2024 13:20:38 -0800 Subject: [PATCH 13/15] Remove debug step --- .github/workflows/base-ci-goreleaser.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/base-ci-goreleaser.yaml b/.github/workflows/base-ci-goreleaser.yaml index ec7b5a83..e066409e 100644 --- a/.github/workflows/base-ci-goreleaser.yaml +++ b/.github/workflows/base-ci-goreleaser.yaml @@ -159,11 +159,6 @@ jobs: path: distributions/${{ inputs.distribution }}/dist/linux_amd64_v1/* if-no-files-found: error - - name: Find MSI location (temporary) - if: ${{ matrix.GOOS == 'windows' && matrix.GOARCH == 'amd64' }} - run: | - find ./ -name "*.msi" - - name: Upload MSI packages if: ${{ matrix.GOOS == 'windows' && matrix.GOARCH == 'amd64' }} uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 From f0293b0072361f6b90a36f5855cb93fa2e177329 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Thu, 5 Dec 2024 13:21:41 -0800 Subject: [PATCH 14/15] Better name for action --- .github/workflows/msi-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/msi-tests.yaml b/.github/workflows/msi-tests.yaml index a6e24424..a0507e76 100644 --- a/.github/workflows/msi-tests.yaml +++ b/.github/workflows/msi-tests.yaml @@ -26,7 +26,7 @@ jobs: with: name: msi-packages - - name: Set MSI tests required environment variables + - name: Set required environment variables for MSI tests run: | $ErrorActionPreference = 'Stop' $alt_config_path = Resolve-Path .\distributions\${{ inputs.distribution }}\config.yaml From 31c8ba6c82f4ddbaca1d19c097be5f58f8aeb908 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Wed, 18 Dec 2024 08:29:17 -0800 Subject: [PATCH 15/15] remove "${{ }}" since it was not needed Co-authored-by: Moritz Wiesinger --- .github/workflows/base-ci-goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/base-ci-goreleaser.yaml b/.github/workflows/base-ci-goreleaser.yaml index 40625579..b6ca2ea0 100644 --- a/.github/workflows/base-ci-goreleaser.yaml +++ b/.github/workflows/base-ci-goreleaser.yaml @@ -89,7 +89,7 @@ jobs: if-no-files-found: error - name: Upload MSI packages - if: ${{ matrix.GOOS == 'windows' && matrix.GOARCH == 'amd64' }} + if: matrix.GOOS == 'windows' && matrix.GOARCH == 'amd64' uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: msi-packages