Rework TA makefiles #1754
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
name: splunk-ta-otel-build/packaging/technical-addon | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths: | |
- '.github/workflows/splunk-ta-otel.yml' | |
- 'packaging/technical-addon/**' | |
- 'cmd/**' | |
- 'internal/**' | |
- 'pkg/**' | |
- 'tests/**' | |
- '!**.md' | |
concurrency: | |
group: splunk-technical-addon-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
GO_VERSION: 1.23.8 | |
jobs: | |
setup-environment: | |
name: 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 | |
test: | |
name: test | |
runs-on: ubuntu-24.04 | |
needs: [setup-environment] | |
defaults: | |
run: | |
working-directory: ${{github.workspace}}/packaging/technical-addon | |
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: Build & Package TA | |
run: | | |
set -o pipefail | |
pushd ${{github.workspace}} | |
make -e bundle.d otelcol | |
popd | |
make -e generate-technical-addon copy-local-build-to-ta package-ta | |
make -e smoketest-ta | |
test-generator: | |
name: test-modinput-config-generator | |
runs-on: ubuntu-24.04 | |
needs: [setup-environment] | |
defaults: | |
run: | |
working-directory: ${{github.workspace}}/packaging/technical-addon | |
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: install tools | |
run: | | |
set -o pipefail | |
cd ${{github.workspace}} && make install-tools | |
- name: Test addon generator | |
run: | | |
set -o pipefail | |
make -e test-ta-build-tools | |
- name: Test normal go code | |
run: | | |
set -o pipefail | |
make -e test | |
- name: Ensure license | |
run: | | |
set -o pipefail | |
make -e addlicense | |
- name: Ensure lint | |
run: | | |
set -o pipefail | |
make -e lint | |
check_changes: | |
runs-on: ubuntu-24.04 | |
outputs: | |
ta_packaging_change: ${{ steps.filter.outputs.ta_packaging_change }} | |
ta_workflow_change: ${{ steps.filter.outputs.ta_workflow_change }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags | |
- name: Get changed files | |
id: changed-files | |
run: | | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
echo "files=$(git diff --name-only origin/${{ github.base_ref }} ${{ github.sha }} | tr '\n' ' ')" >> $GITHUB_OUTPUT | |
else | |
echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | tr '\n' ' ')" >> $GITHUB_OUTPUT | |
fi | |
- name: Filter paths | |
id: filter | |
run: | | |
files="${{ steps.changed-files.outputs.files }}" | |
if echo "$files" | grep -qE "packaging/technical-addon"; then | |
echo "ta_packaging_change=true" >> $GITHUB_OUTPUT | |
else | |
echo "ta_packaging_change=false" >> $GITHUB_OUTPUT | |
fi | |
if echo "$files" | grep -qE ".github/workflows/splunk-ta-otel.yml"; then | |
echo "ta_workflow_change=true" >> $GITHUB_OUTPUT | |
else | |
echo "ta_workflow_change=false" >> $GITHUB_OUTPUT | |
fi | |
distribute-ta: | |
name: "distribute-ta" # what gets run to package in gitlab | |
runs-on: ubuntu-24.04 | |
needs: [setup-environment, check_changes, test-discovery] | |
if: needs.check_changes.outputs.ta_packaging_change == 'true' || needs.check_changes.outputs.ta_workflow_change == 'true' | |
defaults: | |
run: | |
working-directory: ${{github.workspace}}/packaging/technical-addon | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Build & Package TA | |
run: | | |
set -o pipefail | |
PLATFORM="all" make -e distribute-ta | |
- name: Upload Collector TA | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Splunk_TA_otel | |
path: ${{github.workspace}}/build/out/distribution/Splunk_TA_otel.tgz | |
test-discovery: | |
name: test-discovery | |
runs-on: ubuntu-24.04 | |
needs: [setup-environment, test] | |
defaults: | |
run: | |
working-directory: ${{github.workspace}}/packaging/technical-addon | |
strategy: | |
matrix: | |
PLATFORM: ["all"] | |
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: Build & Package TA | |
run: | | |
set -o pipefail | |
pushd ${{github.workspace}} | |
make -e bundle.d otelcol | |
popd | |
make -e generate-technical-addon copy-local-build-to-ta package-ta | |
make -e discovery-test-ta | |
test-envvars: | |
name: test-envvars | |
runs-on: ubuntu-24.04 | |
needs: [setup-environment, test] | |
defaults: | |
run: | |
working-directory: ${{github.workspace}}/packaging/technical-addon | |
strategy: | |
matrix: | |
PLATFORM: ["all"] | |
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: Build & Package TA | |
run: | | |
set -o pipefail | |
pushd ${{github.workspace}} | |
make -e bundle.d otelcol | |
popd | |
make -e generate-technical-addon copy-local-build-to-ta package-ta | |
make -e envvar-test-ta | |
spell-check: | |
name: spell-check | |
runs-on: ubuntu-latest | |
needs: [setup-environment] | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: packaging/technical-addon/ | |
- uses: streetsidesoftware/cspell-action@v6 | |
with: | |
config: ${{github.workspace}}/packaging/technical-addon/packaging-scripts/cspell/cspell.json | |
root: ${{github.workspace}}/packaging/technical-addon/Splunk_TA_otel | |
files: | | |
!**/agent-bundle/** |