-
Notifications
You must be signed in to change notification settings - Fork 167
[chore][chef] Run tests against locally built artifact #6333
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
Open
crobert-1
wants to merge
18
commits into
signalfx:main
Choose a base branch
from
crobert-1:chef_test_current_build
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
efe8eaf
[chore][chef] Run tests against locally built artifact
crobert-1 3806422
untar package
crobert-1 b15e822
set needs properly to build linux package
crobert-1 05c63be
add windows build steps
crobert-1 5de2e8d
can't have runs-on with uses
crobert-1 c853c96
Get windows file names, fix naming of linux
crobert-1 82f1597
remove arm references, fix package paths to stop tar
crobert-1 36fa683
attempt to fix chef-test workflow syntax
crobert-1 dd12a4c
add zypper and yum installation from local artifact, clean up paths
crobert-1 95b4c6b
Package managers need to add remote repo for autoinstrumentation, eve…
crobert-1 65a9e42
Use locally built artifact for windows testing, use /tmp for target path
crobert-1 6d37b12
fix lint - indent 2 spaces instead of 4
crobert-1 bba634f
Fix lint: Prefer single-quoted strings when you don't need string int…
crobert-1 34c20da
Don't re-install when local testing - causes wrong version to potenti…
crobert-1 c91087e
chef lint: Use ! instead of not
crobert-1 02b53fe
chef lint: use unless instead of if !
crobert-1 ab5a4c5
remove debugging, clarify comments
crobert-1 1854120
Update .github/workflows/chef-test.yml
crobert-1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,18 +21,212 @@ concurrency: | |
group: chef-test-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
working-directory: 'deployments/chef' | ||
|
||
env: | ||
CHEF_VERSION: "22.12.1024" | ||
CHEF_LICENSE: accept | ||
GO_VERSION: 1.23.10 | ||
|
||
jobs: | ||
setup-environment: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
cache-dependency-path: '**/go.sum' | ||
|
||
- name: Installing dependency | ||
run: | | ||
make install-tools | ||
|
||
cross-compile: | ||
needs: [ setup-environment, chef-lint-spec-test ] | ||
strategy: | ||
matrix: | ||
SYS_BINARIES: [ "binaries-linux_amd64", "binaries-windows_amd64" ] | ||
uses: ./.github/workflows/compile.yml | ||
with: | ||
sys_binary: ${{ matrix.SYS_BINARIES }} | ||
|
||
agent-bundle-linux: | ||
needs: [chef-lint-spec-test] | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: | ||
ARCH: [ "amd64" ] | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/cache@v4 | ||
id: bundle-cache | ||
with: | ||
path: .cache/buildx/agent-bundle-${{ matrix.ARCH }} | ||
key: agent-bundle-buildx-${{ matrix.ARCH }}-${{ hashFiles('packaging/bundle/**') }} | ||
restore-keys: | | ||
agent-bundle-buildx-${{ matrix.ARCH }}- | ||
- run: make -C packaging/bundle agent-bundle-linux ARCH=${{ matrix.ARCH }} | ||
env: | ||
BUNDLE_CACHE_HIT: "${{ steps.bundle-cache.outputs.cache-hit }}" | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: agent-bundle-linux-${{ matrix.ARCH }} | ||
path: ./dist/agent-bundle_linux_${{ matrix.ARCH }}.tar.gz | ||
|
||
build-package: | ||
runs-on: ubuntu-24.04 | ||
needs: [ cross-compile, agent-bundle-linux ] | ||
strategy: | ||
matrix: | ||
SYS_PACKAGE: [ "deb", "rpm" ] | ||
ARCH: [ "amd64" ] | ||
fail-fast: false | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
cache-dependency-path: '**/go.sum' | ||
|
||
- name: Downloading binaries-linux_${{ matrix.ARCH }} | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: binaries-linux_${{ matrix.ARCH }} | ||
path: ./bin | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: agent-bundle-linux-${{ matrix.ARCH }} | ||
path: ./dist | ||
|
||
- name: Build ${{ matrix.SYS_PACKAGE }} ${{ matrix.ARCH }} package | ||
run: make ${{ matrix.SYS_PACKAGE }}-package SKIP_COMPILE=true SKIP_BUNDLE=true VERSION="" ARCH="${{ matrix.ARCH }}" | ||
|
||
- name: Uploading ${{ matrix.SYS_PACKAGE }} ${{ matrix.ARCH }} package artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.SYS_PACKAGE }}-${{ matrix.ARCH }}-package | ||
path: ./dist/splunk-otel-collector* | ||
|
||
agent-bundle-windows: | ||
needs: [chef-lint-spec-test] | ||
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: | ||
needs: [chef-lint-spec-test] | ||
runs-on: windows-2025 | ||
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 | ||
|
||
chef-lint-spec-test: | ||
name: chef-lint-spec-test | ||
runs-on: ubuntu-24.04 | ||
defaults: | ||
run: | ||
working-directory: 'deployments/chef' | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
|
@@ -46,6 +240,9 @@ jobs: | |
|
||
chef-kitchen-matrix: | ||
runs-on: ubuntu-24.04 | ||
defaults: | ||
run: | ||
working-directory: 'deployments/chef' | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
@@ -80,20 +277,40 @@ jobs: | |
|
||
chef-kitchen-linux: | ||
runs-on: ubuntu-24.04 | ||
needs: [chef-lint-spec-test, chef-kitchen-matrix] | ||
needs: [chef-lint-spec-test, chef-kitchen-matrix, build-package] | ||
defaults: | ||
run: | ||
working-directory: 'deployments/chef' | ||
strategy: | ||
matrix: ${{ fromJSON(needs.chef-kitchen-matrix.outputs.linux-matrix) }} | ||
fail-fast: false | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp | ||
|
||
# Chef doesn't have an easy way to get names of files from unarchived packages | ||
# It's simpler to manually unarchive and move the built artifacts to the | ||
# cookbook files directory here. The files/ dir under the Chef deployment is a special | ||
# directory in Chef, used for copying files from the cookbook to the host running | ||
# Chef. | ||
# Cookbook files reference: https://docs.chef.io/files/ | ||
- name: Extract artifacts | ||
run: | | ||
mkdir -p files | ||
deb_path=$(find /tmp/deb-amd64-package/splunk-otel-collector*amd64.deb) | ||
mv $deb_path ./files/soc.deb | ||
rpm_path=$(find /tmp/rpm-amd64-package/splunk-otel-collector*x86_64.rpm) | ||
mv $rpm_path ./files/soc.rpm | ||
|
||
- name: Install chef | ||
uses: actionshub/[email protected] | ||
with: | ||
version: ${{ env.CHEF_VERSION }} | ||
|
||
|
||
# Install of fluentd is failing on Debian 11, so we disable it for that distro. | ||
- name: Set `with_fluentd` to false on Debian 11 | ||
if: matrix.DISTRO == 'debian-11' | ||
|
@@ -110,14 +327,33 @@ jobs: | |
|
||
chef-kitchen-windows: | ||
runs-on: ${{ matrix.DISTRO }} | ||
needs: [chef-lint-spec-test, chef-kitchen-matrix] | ||
needs: [chef-lint-spec-test, chef-kitchen-matrix, msi-build] | ||
defaults: | ||
run: | ||
working-directory: 'deployments/chef' | ||
strategy: | ||
matrix: ${{ fromJSON(needs.chef-kitchen-matrix.outputs.win-matrix) }} | ||
fail-fast: false | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp | ||
|
||
# Chef doesn't have an easy way to get names of files from unarchived packages | ||
# It's simpler to unarchive and move the built artifacts manually to the | ||
# cookbook files directory. The files/ dir under the Chef deployment is a special | ||
# directory in Chef, used for copying files from the cookbook to the host running | ||
# Chef. | ||
# Cookbook files reference: https://docs.chef.io/files/ | ||
- name: Extract artifacts | ||
run: | | ||
mkdir files | ||
Get-ChildItem /tmp -Recurse -Include 'splunk-otel-collector*.msi' | Select FullName -OutVariable msiPath | ||
mv $msiPath.FullName ./files/splunk-otel-collector.msi | ||
|
||
- name: Install chef | ||
uses: actionshub/[email protected] | ||
with: | ||
|
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
For all three paths,
deb_path
,rpm_path
, andmsiPath
, we're relying on the directories to only have a single file that matches the regex. This might fail in the future if built artifacts change names, or end up having more than one matching artifact.