-
Notifications
You must be signed in to change notification settings - Fork 167
[chore][ansible] Run Windows tests against current build #6309
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
Changes from all commits
d6690c1
1f10185
2e69c8d
87f1ab7
b393c9a
d7532bd
f20e6f7
6e3b1d5
01ce57a
593fd26
56f47c4
9596b88
a234c59
a62631e
3d70310
5108c8c
d42e0cd
066903e
48d89b9
2b3a4d4
fe7f5ec
48bc406
cfc41e8
6cc19fd
4ad7081
f80aea6
9af78f6
b2d5633
590e3b1
174e4ce
97fb369
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ env: | |
jobs: | ||
setup-environment: | ||
runs-on: ubuntu-24.04 | ||
needs: lint | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
|
@@ -53,7 +54,7 @@ jobs: | |
needs: [ setup-environment ] | ||
strategy: | ||
matrix: | ||
SYS_BINARIES: [ "binaries-linux_amd64", "binaries-linux_arm64", "binaries-linux_ppc64le" ] | ||
SYS_BINARIES: [ "binaries-linux_amd64", "binaries-linux_arm64", "binaries-linux_ppc64le", "binaries-windows_amd64" ] | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
|
@@ -77,6 +78,7 @@ jobs: | |
|
||
agent-bundle-linux: | ||
runs-on: ${{ fromJSON('["ubuntu-24.04", "otel-arm64"]')[matrix.ARCH == 'arm64'] }} | ||
needs: lint | ||
strategy: | ||
matrix: | ||
ARCH: [ "amd64", "arm64" ] | ||
|
@@ -141,6 +143,112 @@ jobs: | |
name: ${{ matrix.SYS_PACKAGE }}-${{ matrix.ARCH }}-package | ||
path: ./dist/splunk-otel-collector* | ||
|
||
agent-bundle-windows: | ||
needs: lint | ||
runs-on: ${{ matrix.OS }} | ||
strategy: | ||
matrix: | ||
OS: [ "windows-2025" ] | ||
env: | ||
PIP_CACHE_DIR: ${{ github.workspace }}/.cache/pip | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.PIP_CACHE_DIR }} | ||
key: agent-bundle-windows-pip-${{ hashFiles('packaging/bundle/collectd-plugins.yaml', 'packaging/bundle/scripts/requirements.txt') }} | ||
|
||
- run: ./packaging/bundle/scripts/windows/make.ps1 bundle | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: agent-bundle-windows-${{ matrix.OS }} | ||
path: ./dist/agent-bundle_windows_amd64.zip | ||
|
||
msi-custom-actions: | ||
runs-on: windows-2025 | ||
needs: lint | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Uninstall default WiX | ||
run: choco uninstall wixtoolset | ||
|
||
- name: Install WiX 3.14.0 | ||
run: choco install wixtoolset --version 3.14.0 --allow-downgrade --force | ||
|
||
- name: Build Custom Actions | ||
working-directory: packaging/msi/SplunkCustomActions | ||
run: | | ||
dotnet test ./test/SplunkCustomActionsTests.csproj -c Release | ||
dotnet publish ./src/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}\packaging\msi\SplunkCustomActions" | ||
$customActionBinDir = "${customActionDir}\bin\Release" | ||
MakeSfxCA.exe "${PWD}\dist\SplunkCustomActions.CA.dll" ` | ||
"${sfxcaDll}" ` | ||
"${customActionBinDir}\SplunkCustomActions.dll" ` | ||
"${customActionBinDir}\Microsoft.Deployment.WindowsInstaller.dll" ` | ||
"${customActionDir}\src\CustomAction.config" | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: msi-custom-actions | ||
path: ./dist/SplunkCustomActions.CA.dll | ||
|
||
msi-build: | ||
runs-on: ubuntu-24.04 | ||
env: | ||
WINDOWS_VER: "windows-2025" | ||
needs: [cross-compile, agent-bundle-windows, msi-custom-actions] | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Downloading binaries-windows_amd64 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: binaries-windows_amd64 | ||
path: ./bin | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
cache-dependency-path: '**/go.sum' | ||
|
||
- name: Downloading agent-bundle-windows | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: agent-bundle-windows-${{ env.WINDOWS_VER }} | ||
path: ./dist | ||
|
||
- name: Downloading msi-custom-actions | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: msi-custom-actions | ||
path: ./packaging/msi/SplunkCustomActions/bin/Release | ||
|
||
- name: Build MSI | ||
run: | | ||
mkdir -p dist | ||
make msi SKIP_COMPILE=true VERSION="" | ||
|
||
- name: Uploading msi build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: msi-build | ||
path: ./dist/*.msi | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-24.04 | ||
|
@@ -228,7 +336,7 @@ jobs: | |
|
||
windows-test: | ||
name: Windows Test | ||
needs: lint | ||
needs: [lint, msi-build] | ||
runs-on: ubuntu-24.04 | ||
defaults: | ||
run: | ||
|
@@ -257,6 +365,14 @@ jobs: | |
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Make tmp directory for msi build artifact | ||
run: mkdir -p /tmp/msi-build | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: msi-build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For simplicity in Ansible logic, use a single MSI with a preset name, rather than having to pass around variables and parse versions. |
||
path: /tmp/msi-build | ||
|
||
- name: Install vagrant and virtualbox | ||
run: | | ||
sudo apt update && sudo apt install -y virtualbox | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,23 +45,6 @@ | |
assert: | ||
that: not service_status.changed | ||
|
||
- name: Download splunk-otel-collector 0.126.0 MSI | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed version check for the same reason as the linux change. We can revisit if anyone has a strong preference here. |
||
ansible.windows.win_get_url: | ||
url: https://dl.signalfx.com/splunk-otel-collector/msi/release/splunk-otel-collector-0.126.0-amd64.msi | ||
dest: "{{ansible_env.TEMP}}" | ||
register: otel_msi_package | ||
|
||
- name: Install splunk-otel-collector 0.126.0 MSI | ||
ansible.windows.win_package: | ||
path: "{{otel_msi_package.dest}}" | ||
state: present | ||
check_mode: yes | ||
register: msi_installed | ||
|
||
- name: Assert splunk-otel-collector 0.126.0 MSI is already installed | ||
assert: | ||
that: not msi_installed.changed | ||
|
||
- name: Check custom_config.yml | ||
ansible.windows.win_stat: | ||
path: '{{ansible_env.ProgramData}}\Splunk\OpenTelemetry Collector\custom_config.yml' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,18 @@ | ||
--- | ||
|
||
- name: Get splunk-otel-collector latest version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deleted lines from this file are simply being moved to the |
||
ansible.windows.win_get_url: | ||
url: "{{win_base_url}}/splunk-otel-collector/msi/{{package_stage}}/latest.txt" | ||
dest: "%TEMP%" | ||
proxy_password: "{{ win_proxy_password | default(omit) }}" | ||
proxy_url: "{{ win_proxy_url | default(omit) }}" | ||
proxy_username: "{{ win_proxy_username | default(omit) }}" | ||
use_proxy: "{{ win_use_proxy }}" | ||
register: latest | ||
when: splunk_otel_collector_version == "latest" | ||
- name: Get local MSI installer | ||
ansible.builtin.import_tasks: win_local_msi.yml | ||
when: local_artifact_testing_enabled | ||
|
||
- name: get content of remote file | ||
slurp: | ||
src: "{{latest.dest}}" | ||
register: version | ||
when: splunk_otel_collector_version == "latest" | ||
|
||
- name: decode remote file content for latest version | ||
set_fact: | ||
splunk_otel_collector_version: "{{version.content | b64decode }}" | ||
when: splunk_otel_collector_version == "latest" | ||
- name: Get remote MSI installer | ||
ansible.builtin.import_tasks: win_download_remote_msi.yml | ||
when: not local_artifact_testing_enabled | ||
|
||
- name: Use MSI capabilities to install the collector if possible | ||
set_fact: | ||
splunk_collector_msi_is_configurable: true | ||
when: splunk_otel_collector_version is version('0.98.0', '>=') | ||
|
||
- name: Get splunk-otel-collector for windows | ||
ansible.windows.win_get_url: | ||
url: "{{win_base_url}}/splunk-otel-collector/msi/{{package_stage}}/splunk-otel-collector-\ | ||
{{splunk_otel_collector_version}}-amd64.msi" | ||
dest: "%TEMP%" | ||
proxy_password: "{{ win_proxy_password | default(omit) }}" | ||
proxy_url: "{{ win_proxy_url | default(omit) }}" | ||
proxy_username: "{{ win_proxy_username | default(omit) }}" | ||
use_proxy: "{{ win_use_proxy }}" | ||
register: otel_msi_package | ||
when: | ||
- local_artifact_testing_enabled or splunk_otel_collector_version is version('0.98.0', '>=') | ||
|
||
- name: Build the arguments for the MSI installer | ||
when: splunk_collector_msi_is_configurable is defined | ||
|
@@ -95,14 +71,14 @@ | |
- name: Install splunk-otel-collector-msi | ||
when: splunk_collector_msi_is_configurable is defined | ||
ansible.windows.win_package: | ||
path: "{{ otel_msi_package.dest }}" | ||
path: "{{ msi_path }}" | ||
state: present | ||
arguments: "{{ msi_arguments }}" | ||
|
||
- name: Install splunk-otel-collector-msi-legacy | ||
when: splunk_collector_msi_is_configurable is undefined | ||
ansible.windows.win_package: | ||
path: "{{otel_msi_package.dest}}" | ||
path: "{{ msi_path }}" | ||
state: present | ||
|
||
- name: Merge custom config into the default config | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
|
||
- name: Get splunk-otel-collector latest version | ||
ansible.windows.win_get_url: | ||
url: "{{win_base_url}}/splunk-otel-collector/msi/{{package_stage}}/latest.txt" | ||
dest: "%TEMP%" | ||
proxy_password: "{{ win_proxy_password | default(omit) }}" | ||
proxy_url: "{{ win_proxy_url | default(omit) }}" | ||
proxy_username: "{{ win_proxy_username | default(omit) }}" | ||
use_proxy: "{{ win_use_proxy }}" | ||
register: latest | ||
when: splunk_otel_collector_version == "latest" | ||
|
||
- name: get content of remote file | ||
slurp: | ||
src: "{{latest.dest}}" | ||
register: version | ||
when: splunk_otel_collector_version == "latest" | ||
|
||
- name: decode remote file content for latest version | ||
set_fact: | ||
splunk_otel_collector_version: "{{version.content | b64decode }}" | ||
when: splunk_otel_collector_version == "latest" | ||
|
||
- name: Get splunk-otel-collector for windows | ||
ansible.windows.win_get_url: | ||
url: "{{win_base_url}}/splunk-otel-collector/msi/{{package_stage}}/splunk-otel-collector-\ | ||
{{splunk_otel_collector_version}}-amd64.msi" | ||
dest: "%TEMP%" | ||
proxy_password: "{{ win_proxy_password | default(omit) }}" | ||
proxy_url: "{{ win_proxy_url | default(omit) }}" | ||
proxy_username: "{{ win_proxy_username | default(omit) }}" | ||
use_proxy: "{{ win_use_proxy }}" | ||
register: otel_msi_package | ||
|
||
- name: Set MSI source path (remote install) | ||
when: not local_artifact_testing_enabled | ||
set_fact: | ||
msi_path: "{{ otel_msi_package.dest }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
|
||
- set_fact: | ||
win_temp_msi_dir: "%TEMP%\\msi-build" | ||
|
||
- name: Create temporary MSI build directory | ||
ansible.windows.win_file: | ||
path: win_temp_msi_dir | ||
state: directory | ||
|
||
- name: Move local MSI installer to target machine | ||
ansible.windows.win_copy: | ||
src: /tmp/msi-build/ | ||
dest: win_temp_msi_dir | ||
register: otel_msi_package | ||
|
||
- name: Get target machine path to MSI | ||
ansible.windows.win_find: | ||
paths: win_temp_msi_dir | ||
register: msi_dir_contents | ||
failed_when: msi_dir_contents.files is not defined or msi_dir_contents.files | length != 1 | ||
|
||
- name: Set MSI source path (local install) | ||
when: local_artifact_testing_enabled | ||
set_fact: | ||
msi_path: "{{ msi_dir_contents.files[0].path }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agent-bundle-windows
,msi-custom-actions
, andmsi-build
are all directly copied from https://github.com/signalfx/splunk-otel-collector/blob/main/.github/workflows/win-package-test.yml