forked from open-telemetry/opentelemetry-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
225 lines (208 loc) · 7.82 KB
/
Copy pathe2e-reusable.yaml
File metadata and controls
225 lines (208 loc) · 7.82 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: "Reusable End-to-end tests"
on:
workflow_call:
inputs:
collector-image:
description: "Collector image to use for tests"
required: false
type: string
default: ""
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
env:
IMAGE_ARCHIVE_FILENAME: images.tar
VERSION: e2e
jobs:
build-test-images:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
id: setup-go
with:
go-version: "~1.26.5"
- name: Cache tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: bin
key: tools-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile') }}-${{ steps.setup-go.outputs.go-version }}
- name: Install tools
run: make install-tools
- name: Build test image archive
run: make container-image-archive IMAGE_ARCHIVE=${IMAGE_ARCHIVE_FILENAME} VERSION=${VERSION}
- name: Upload test image archive
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Test image archive
path: ${{ env.IMAGE_ARCHIVE_FILENAME }}
if-no-files-found: 'error'
retention-days: 1
overwrite: true
e2e-tests:
runs-on: ubuntu-latest
needs: [ build-test-images ]
strategy:
fail-fast: false
matrix:
# The e2e tests are run on the lowest and highest supported k8s version.
# All Kubernetes version in between expose the same APIs, hence the operator
# should be compatible with them.
kube-version:
- "1.25"
- "1.35"
group:
- e2e
- e2e-automatic-rbac
- e2e-autoscale
- e2e-instrumentation-default
- e2e-instrumentation
- e2e-no-crds
- e2e-opampbridge
- e2e-pdb
- e2e-prometheuscr
- e2e-sidecar
- e2e-targetallocator
- e2e-targetallocator-cr
# https://github.com/open-telemetry/opentelemetry-operator/issues/4887
- e2e-upgrade
- e2e-multi-instrumentation-default
- e2e-multi-instrumentation
- e2e-metadata-filters
- e2e-ta-collector-mtls
- e2e-crd-validations
- e2e-ta-standalone
include:
- group: e2e-instrumentation-default
setup: "add-instrumentation-params prepare-e2e"
- group: e2e-instrumentation
setup: "add-instrumentation-params add-instrumentation-images prepare-e2e"
- group: e2e-multi-instrumentation-default
setup: "add-instrumentation-params prepare-e2e"
- group: e2e-multi-instrumentation
setup: "add-instrumentation-params add-instrumentation-images prepare-e2e"
- group: e2e-metadata-filters
setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=.*filter.out --annotations-filter=config.*.gke.io.* --labels-filter=.*filter.out' prepare-e2e"
- group: e2e-ta-collector-mtls
setup: "add-certmanager-permissions prepare-e2e"
- group: e2e-automatic-rbac
setup: "add-rbac-permissions-to-operator prepare-e2e"
- group: e2e-ta-standalone
setup: "prepare-e2e-ta-standalone"
- group: e2e-no-crds
setup: "prepare-e2e-no-crds"
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
id: setup-go
with:
go-version: "~1.26.5"
- name: Cache tools
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: bin
key: tools-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile') }}-${{ steps.setup-go.outputs.go-version }}
- name: Install tools
run: make install-tools
- name: Download test image archive
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: Test image archive
- name: Prepare e2e tests
env:
KUBE_VERSION: ${{ matrix.kube-version }}
COLLECTOR_IMG: ${{ inputs.collector-image }}
SETUP_COMMANDS: ${{ matrix.setup != '' && matrix.setup || 'prepare-e2e' }}
run: |
set -e
if [ -n "${COLLECTOR_IMG}" ]; then
export SETUP_COMMANDS="add-image-collector COLLECTOR_IMG=${COLLECTOR_IMG} ${SETUP_COMMANDS}"
fi
eval "make ${SETUP_COMMANDS} KUBE_VERSION=$KUBE_VERSION VERSION=$VERSION IMAGE_ARCHIVE=$IMAGE_ARCHIVE_FILENAME"
- name: Run e2e tests
env:
KUBE_VERSION: ${{ matrix.kube-version }}
run: |
set -e
make ${{ matrix.group }}
- name: "log operator if failed"
if: ${{ failure() }}
env:
KUBE_VERSION: ${{ matrix.kube-version }}
run: |
set -e
make e2e-log-operator KUBE_VERSION=$KUBE_VERSION
- name: Upload test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
path: .testresults/e2e/*.xml
name: e2e-junit-${{ matrix.group }}-${{ matrix.kube-version }}
retention-days: 7
overwrite: true
# Aggregate the JUnit results from every matrix job into a single Codecov
# upload. Uploading per-matrix-job races Codecov's PR comment, which it posts
# as uploads arrive without knowing how many to expect. A single upload that
# runs only after all e2e jobs finish yields one complete comment.
upload-test-results:
runs-on: ubuntu-latest
if: always()
# Reporting must never gate a merge: a Codecov hiccup shouldn't fail the
# workflow and flip the required e2e check red.
continue-on-error: true
needs: [e2e-tests]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Download all e2e test results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: e2e-junit-*
path: .testresults/e2e
# download-artifact unpacks each artifact into its own subdirectory as
# <report-name>.xml. Codecov's test-results finder only matches basenames
# like *junit*.xml/*test*.xml, so flatten every report into a junit-named
# file. Prefixing with the artifact directory (which carries the group and
# kube version) keeps names unique across matrix cells.
- name: Collect JUnit reports for Codecov
run: |
set -euo pipefail
mkdir -p .testresults/junit
find .testresults/e2e -name '*.xml' -print0 | while IFS= read -r -d '' f; do
artifact=$(basename "$(dirname "$f")")
cp "$f" ".testresults/junit/${artifact}-$(basename "$f")"
done
ls -l .testresults/junit
- name: Upload test results to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
report_type: test_results
directory: .testresults/junit
e2e-tests-check:
runs-on: ubuntu-latest
if: always()
needs: [e2e-tests]
outputs:
result: ${{ needs.e2e-tests.result }}
steps:
- name: Print result
run: echo ${{ needs.e2e-tests.result }}
- name: Interpret result
run: |
if [[ success == ${{ needs.e2e-tests.result }} ]]
then
echo "All matrix jobs passed!"
else
echo "One or more matrix jobs failed."
false
fi