forked from pulp/pulp-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
280 lines (259 loc) · 8.87 KB
/
ci.yml
File metadata and controls
280 lines (259 loc) · 8.87 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
name: Pulp CI
on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
pull_request:
branches:
- main
schedule:
# * is a special character in YAML so you have to quote this string
# runs at 3:00 UTC daily
- cron: '00 3 * * *'
env:
COLORTERM: 'yes'
TERM: 'xterm-256color'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# by default, it uses a depth of 1
# this fetches all history so that we can read each commit
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: false
- name: Check commit message
if: github.event_name == 'pull_request'
env:
GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }}
run: |
echo ::group::REQUESTS
pip install pygithub
echo ::endgroup::
for sha in $(curl $GITHUB_CONTEXT | jq '.[].sha' | sed 's/"//g')
do
python .ci/scripts/validate_commit_message.py $sha
VALUE=$?
if [ "$VALUE" -gt 0 ]; then
exit $VALUE
fi
done
shell: bash
- name: Check code format
run: |
make tidy fmt vet
shell: bash
docs:
# The workflow tag and the pulpdocs_ref must match.
uses: "pulp/pulp-docs/.github/workflows/docs-ci.yml@main"
with:
pulpdocs_ref: "main"
bundle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check if bundle files are updated
run: |
.ci/scripts/bundle_check.sh
shell: bash
upgrade:
uses: "./.github/workflows/upgrade.yml"
two-deployments:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: false
- name: Install kind
run: .ci/scripts/kind_with_registry.sh v1.31.6
- name: Install OLM
run: |
make sdkbin OPERATOR_SDK_VERSION=v1.31.0 LOCALBIN=/tmp
/tmp/operator-sdk olm install --version v0.31.0
shell: bash
- uses: actions/checkout@v4
- name: Install Pulp CRD
run: make install
- name: Build operator image
run: make docker-build docker-push IMG=localhost:5001/pulp-operator:dev
- name: Build bundle image
run: make bundle bundle-build bundle-push BUNDLE_IMG=localhost:5001/pulp-operator-bundle:testing IMG=localhost:5001/pulp-operator:dev
- name: Install the operator
run: /tmp/operator-sdk run bundle --skip-tls localhost:5001/pulp-operator-bundle:testing
- name: Deploy example-pulp and test-pulp
run: |
kubectl apply -f config/samples/simple-with-reduced-migration-cpu.yaml
kubectl apply -f config/samples/simple-test.yaml
- name: Check and wait for example-pulp deployment
run: kubectl wait --for condition=Pulp-Operator-Finished-Execution pulp/example-pulp --timeout=600s
- name: Check and wait for test-pulp deployment
run: kubectl wait --for condition=Pulp-Operator-Finished-Execution pulp/test-pulp --timeout=600s
- name: Logs
if: always()
run: .github/workflows/scripts/show_logs.sh --kind
- name: OLM Logs
if: always()
run: |
echo ::group::SUB
kubectl get sub -oyaml -A
echo ::endgroup::
echo ::group::InstallPlan
kubectl get ip -A -oyaml
echo ::endgroup::
echo ::group::PODS
kubectl -nolm get pods
kubectl get pods -A
echo ::endgroup::
echo ::group::CATALOG-OPERATOR-LOGS
kubectl -nolm logs deployment/catalog-operator
echo ::endgroup::
echo ::group::OLM-OPERATOR-LOGS
kubectl -nolm logs deployment/olm-operator
echo ::endgroup::
echo ::group::CATALOGSOURCE
kubectl get catalogsource -oyaml -A
echo ::endgroup::
echo ::group::CATALOGSOURCE-POD-LOGS
kubectl -ndefault logs localhost-5001-pulp-operator-bundle-testing
kubectl -ndefault describe pod/localhost-5001-pulp-operator-bundle-testing
echo ::endgroup::
echo ::group::CSV
kubectl get csv -A -oyaml
echo ::endgroup::
shell: bash
envtest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: false
- name: Check code format and generate manifests
run: |
make test
shell: bash
helm:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pre-reqs
with:
ingress-type: nodeport
- name: Build operator container and install CRDs
run: |
make docker-build install IMG=localhost/pulp-operator:devel
- name: Create pulp-operator namespace
run: |
kubectl create ns pulp-operator-system
kubectl config set-context --current --namespace=pulp-operator-system
- uses: actions/checkout@v4
with:
repository: pulp/pulp-k8s-resources
ref: main
- name: Install helm chart from source
run: |
helm install --skip-crds --set namespace=pulp-operator-system --set image=localhost/pulp-operator:devel pulp helm-charts/
- uses: actions/checkout@v4
- name: Create Pulp Operator CR
run: |
kubectl apply -f .ci/assets/kubernetes/pulp-admin-password.secret.yaml
kubectl apply -f config/samples/simple.yaml
- name: Check and wait pulp-operator deploy
run: |
kubectl wait --for=condition=Ready $(kubectl get pod -l app.kubernetes.io/component=operator -oname)
kubectl logs -f -l app.kubernetes.io/component=operator -c manager &
kubectl wait --for condition=Pulp-Operator-Finished-Execution pulp/example-pulp --timeout=900s
- name: Test all components
run: |
.ci/scripts/pulp_tests.sh -m
shell: bash
env:
PY_COLORS: '1'
- name: Logs
if: always()
run: |
.github/workflows/scripts/show_logs.sh
helm list
containerized:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pre-reqs
with:
ingress-type: nodeport
- name: Deploy pulp-operator to K8s
run: |
make docker-build deploy
kubectl get namespace
kubectl config set-context --current --namespace=pulp-operator-system
kubectl apply -f config/samples/simple.yaml
shell: bash
- name: Check and wait pulp-operator deploy
run: |
journalctl --unit=pulp-operator -f &
kubectl logs -f -l app.kubernetes.io/component=operator -c manager &
kubectl wait --for condition=Pulp-Operator-Finished-Execution pulp/example-pulp --timeout=900s
shell: bash
- name: KubeLinter
if: github.event_name == 'pull_request'
run: .ci/scripts/kubelinter.sh
- name: Test all components
run: |
.ci/scripts/pulp_tests.sh -m
shell: bash
env:
PY_COLORS: '1'
- name: Logs
if: always()
run: .github/workflows/scripts/show_logs.sh
components:
uses: "./.github/workflows/components.yml"
deploy:
runs-on: ubuntu-latest
needs: [containerized, components]
if: |
github.event_name != 'pull_request' &&
github.repository_owner == 'pulp'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pre-reqs
with:
deploy: true
- name: Quay login
env:
QUAY_BOT_PASSWORD: ${{ secrets.QUAY_BOT_PASSWORD }}
QUAY_BOT_USERNAME: pulp+github
run: echo "$QUAY_BOT_PASSWORD" | docker login -u "$QUAY_BOT_USERNAME" --password-stdin quay.io
- name: Build and Push images
run: |
if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then
export IMG=quay.io/pulp/pulp-operator:nightly
export CATALOG_IMG=quay.io/pulp/pulp-operator-catalog:nightly
export BUNDLE_IMG=quay.io/pulp/pulp-operator-bundle:nightly
elif [ "$GITHUB_EVENT_NAME" != "push" ] || [[ ! "$GITHUB_REF" =~ ^refs/tags/ ]]; then
export VERSION=$(awk '/^VERSION \?= / {print $3}' Makefile)-dev
fi
make docker-buildx bundle-build bundle-push catalog-build catalog-push
shell: bash