-
Notifications
You must be signed in to change notification settings - Fork 11
238 lines (211 loc) · 7.2 KB
/
go.yaml
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
226
227
228
229
230
231
232
233
234
235
236
237
238
name: "OPCT"
on:
pull_request:
branches:
- main
- release-*
push:
tags:
- '*'
env:
GO_VERSION: 1.22
GOLANGCI_LINT_VERSION: v1.59
STATIC_CHECK_VERSION: 2023.1.7
jobs:
go-lint:
name: go-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
# https://github.com/golangci/golangci-lint-action
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout=10m
go-static:
name: "go-staticcheck"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: WillAbides/[email protected]
with:
go-version: ${{ env.GO_VERSION }}
- name: Run static code analysis
uses: dominikh/[email protected]
with:
version: "${{ env.STATIC_CHECK_VERSION }}"
install-go: false
go-test:
name: go-test
runs-on: ubuntu-latest
needs:
- go-lint
- go-static
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run unit tests
run: make test
go-vet:
name: "go-vet"
runs-on: ubuntu-latest
needs:
- go-lint
- go-static
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run go vet
run: make vet
build:
name: "build-artifact"
runs-on: ubuntu-latest
needs:
- go-test
- go-vet
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make git -y
- name: Build (OS=linux-amd64)
env:
OS_ARCH: linux-amd64
run: |
make clean
make linux-amd64-container
make build-${OS_ARCH}
- name: Save artifacts (OS=linux-amd64)
uses: actions/upload-artifact@v4
with:
name: opct-linux-amd64
path: |
build/opct-*
- name: Build (OS=darwin-arm64)
env:
OS_ARCH: darwin-arm64
run: |
make clean
make build-${OS_ARCH}
- name: Save artifacts (OS=darwin-arm64)
uses: actions/upload-artifact@v4
with:
name: opct-darwin-arm64
path: |
build/opct-*
e2e-cmd_report:
name: "e2e-cmd_report"
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: opct-linux-amd64
path: /tmp/build/
- name: Running report
env:
RESULT_ARTIFACT_URL: "https://openshift-provider-certification.s3.us-west-2.amazonaws.com"
RESULT_ARTIFACT_VERSION: "v0.4.0/default/4.15.0-20240228-HighlyAvailable-vsphere-None.tar.gz"
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
run: |
echo "> Downloading sample artifact: ${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
wget -qO /tmp/result.tar.gz "${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
echo "> Setting run permissions to OPCT:"
chmod u+x ${CUSTOM_BUILD_PATH}
echo "> Running OPCT report:"
${CUSTOM_BUILD_PATH} report /tmp/result.tar.gz
e2e-cmd_adm-parse-etcd-logs:
name: "e2e-cmd_adm-parse-etcd-logs"
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: opct-linux-amd64
path: /tmp/build/
- name: Preparing testdata
env:
RESULT_ARTIFACT_URL: "https://openshift-provider-certification.s3.us-west-2.amazonaws.com"
RESULT_ARTIFACT_VERSION: "testdata/must-gather-etcd-logs.tar.gz"
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA: /tmp/must-gather.tar.gz
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
echo "> Downloading sample artifact: ${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
wget -qO ${LOCAL_TEST_DATA} "${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
echo "> Setting run permissions to OPCT:"
chmod u+x ${CUSTOM_BUILD_PATH}
echo "> Extracting testdata:"
mkdir ${LOCAL_TEST_DATA_DIR}
tar xfz ${LOCAL_TEST_DATA} -C ${LOCAL_TEST_DATA_DIR}
- name: "e2e stdin reader: cat <etcd pod logs> | opct adm parse-etcd-logs"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
cat ${LOCAL_TEST_DATA_DIR}/*/*/namespaces/openshift-etcd/pods/*/etcd/etcd/logs/*.log | \
${CUSTOM_BUILD_PATH} adm parse-etcd-logs
- name: "e2e must-gather dir: opct adm parse-etcd-logs <must-gather-dir>"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
${CUSTOM_BUILD_PATH} adm parse-etcd-logs ${LOCAL_TEST_DATA_DIR}
- name: "e2e aggregate by hour: opct adm parse-etcd-logs --aggregator hour <must-gather-dir>"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
${CUSTOM_BUILD_PATH} adm parse-etcd-logs --aggregator hour ${LOCAL_TEST_DATA_DIR}
- name: "e2e ignore error counters: opct adm parse-etcd-logs --skip-error-counter=true <must-gather-dir>"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
${CUSTOM_BUILD_PATH} adm parse-etcd-logs --skip-error-counter=true ${LOCAL_TEST_DATA_DIR}
e2e-cmd_adm-parse-metrics:
name: "e2e-cmd_adm-parse-metrics"
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: opct-linux-amd64
path: /tmp/build/
- name: Preparing testdata
env:
RESULT_ARTIFACT_URL: "https://openshift-provider-certification.s3.us-west-2.amazonaws.com"
RESULT_ARTIFACT_VERSION: "testdata/ci-external-aws-ccm_1757495441294888960-artifacts_must-gather-metrics.tar.xz"
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA: /tmp/opct-metrics.tar.xz
run: |
echo "> Downloading sample artifact: ${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
wget -qO ${LOCAL_TEST_DATA} "${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
echo "> Setting run permissions to OPCT:"
chmod u+x ${CUSTOM_BUILD_PATH}
- name: "e2e parse metrics: opct adm parse-etcd-logs <must-gather-dir>"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA: /tmp/opct-metrics.tar.xz
run: |
${CUSTOM_BUILD_PATH} adm parse-metrics --input ${LOCAL_TEST_DATA} --output /tmp/metrics
tree /tmp/metrics