-
Notifications
You must be signed in to change notification settings - Fork 158
132 lines (113 loc) · 3.64 KB
/
splunk-ta-otel.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: splunk-ta-otel-build
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.22.10
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]
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
make -e package-technical-addon
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'
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
- name: Build & Package TA
run: |
set -o pipefail
PLATFORM="all" make -e distribute-ta
test-discovery:
name: test-discovery
runs-on: ubuntu-24.04
needs: [setup-environment, test]
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
make -e bundle.d otelcol generate-technical-addon copy-local-build-to-ta package-ta
make -e discovery-test-ta