forked from signalfx/splunk-otel-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (164 loc) · 6 KB
/
otelcol-fips.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: "otelcol-fips"
on:
push:
branches:
- main
pull_request:
paths:
- '.github/workflows/otelcol-fips.yml'
- 'cmd/otelcol/**'
- 'internal/**'
- 'pkg/**'
- 'tests/**'
- 'Makefile'
- 'Makefile.Common'
- 'go.mod'
- 'go.sum'
- '!**.md'
- '!packaging/**'
concurrency:
group: otelcol-fips-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GO_VERSION: "1.22.7"
jobs:
otelcol-fips:
runs-on: ${{ fromJSON('["ubuntu-20.04", "otel-arm64"]')[matrix.GOARCH == 'arm64'] }}
strategy:
matrix:
include:
- GOOS: linux
GOARCH: amd64
- GOOS: linux
GOARCH: arm64
- GOOS: windows
GOARCH: amd64
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- run: make otelcol-fips
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
- uses: actions/upload-artifact@v4
with:
name: otelcol-fips-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
path: ./bin/*
win-binary-test:
runs-on: windows-2022
needs: [ otelcol-fips ]
strategy:
matrix:
FIPSMODE: [ "1", "0" ]
fail-fast: false
steps:
- uses: actions/download-artifact@v4
with:
name: otelcol-fips-windows-amd64
path: ./bin
- run: Set-ItemProperty -Path HKLM:\System\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy -Name Enabled -Value ${{ matrix.FIPSMODE }}
- run: ./bin/otelcol-fips_windows_amd64.exe --version
id: run-otelcol
continue-on-error: true
- run: echo "FIPS enabled, started successfully"
if: matrix.FIPSMODE == '1' && steps.run-otelcol.outcome == 'success'
- run: throw "FIPS enabled, should not have failed"
if: matrix.FIPSMODE == '1' && steps.run-otelcol.outcome == 'failure'
- run: echo "FIPS disabled, failed successfully"
if: matrix.FIPSMODE == '0' && steps.run-otelcol.outcome == 'failure'
- run: throw "FIPS disabled, should have failed"
if: matrix.FIPSMODE == '0' && steps.run-otelcol.outcome == 'success'
docker-otelcol-fips:
runs-on: ${{ fromJSON('["ubuntu-20.04", "otel-arm64"]')[matrix.ARCH == 'arm64'] }}
needs: [ otelcol-fips ]
strategy:
matrix:
ARCH: [ amd64, arm64 ]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- uses: actions/download-artifact@v4
with:
name: otelcol-fips-linux-${{ matrix.ARCH }}
path: ./bin
- run: make docker-otelcol SKIP_COMPILE=true
env:
FIPS: true
ARCH: ${{ matrix.ARCH }}
- name: Ensure the collector container can run with the default config
run: |
docker run -d --name otelcol-fips -e SPLUNK_ACCESS_TOKEN=fake-token -e SPLUNK_REALM=fake-realm otelcol-fips:${{ matrix.ARCH }}
sleep 30
docker logs otelcol-fips
if [ -z "$( docker ps --filter=status=running --filter=name=otelcol-fips -q )" ]; then
exit 1
fi
docker rm -f otelcol-fips
- name: Ensure the collector container can run with all included configs
run: |
for config in cmd/otelcol/fips/config/*.yaml; do
docker run -d --name otelcol-fips -e SPLUNK_ACCESS_TOKEN=fake-token -e SPLUNK_REALM=fake-realm -e SPLUNK_CONFIG=/etc/otel/collector/$(basename $config) otelcol-fips:${{ matrix.ARCH }}
sleep 30
docker logs otelcol-fips
if [ -z "$( docker ps --filter=status=running --filter=name=otelcol-fips -q )" ]; then
exit 1
fi
docker rm -f otelcol-fips
done
- run: docker save -o image.tar otelcol-fips:${{ matrix.ARCH }}
- uses: actions/upload-artifact@v4
with:
name: docker-otelcol-fips-${{ matrix.ARCH }}
path: ./image.tar
win-docker-otelcol-fips:
runs-on: windows-${{ matrix.WIN_VERSION }}
needs: [ otelcol-fips ]
strategy:
matrix:
WIN_VERSION: [ 2019, 2022 ]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: otelcol-fips-windows-amd64
path: ./cmd/otelcol/fips/dist
- run: docker build --pull -t otelcol-fips:${{ matrix.WIN_VERSION }} --build-arg BASE_IMAGE=${env:BASE_IMAGE} -f .\cmd\otelcol\fips\Dockerfile.windows .\cmd\otelcol\fips
env:
BASE_IMAGE: mcr.microsoft.com/windows/servercore:ltsc${{ matrix.WIN_VERSION }}
- name: Ensure the collector container can run with the default config
shell: bash
run: |
docker run -d --name otelcol-fips -e SPLUNK_ACCESS_TOKEN=fake-token -e SPLUNK_REALM=fake-realm otelcol-fips:${{ matrix.WIN_VERSION }}
sleep 30
docker logs otelcol-fips
if [ -z "$( docker ps --filter=status=running --filter=name=otelcol-fips -q )" ]; then
exit 1
fi
docker rm -f otelcol-fips
- name: Ensure the collector container can run with all included configs
shell: bash
run: |
for config in cmd/otelcol/fips/config/*.yaml; do
docker run -d --name otelcol-fips -e SPLUNK_ACCESS_TOKEN=fake-token -e SPLUNK_REALM=fake-realm -e SPLUNK_CONFIG="C:\\ProgramData\\Splunk\\OpenTelemetry Collector\\$(basename $config)" otelcol-fips:${{ matrix.WIN_VERSION }}
sleep 30
docker logs otelcol-fips
if [ -z "$( docker ps --filter=status=running --filter=name=otelcol-fips -q )" ]; then
exit 1
fi
docker rm -f otelcol-fips
done