-
Notifications
You must be signed in to change notification settings - Fork 156
108 lines (93 loc) · 3.03 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
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.7
jobs:
setup-environment:
name: setup-environment
runs-on: ubuntu-latest
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-latest
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-latest
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-latest
needs: [setup-environment, check_changes]
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