-
Notifications
You must be signed in to change notification settings - Fork 0
316 lines (257 loc) · 11.2 KB
/
dry-run.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
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
name: dry-run in kind
env:
kind_version: "v0.15.0"
kind_kubectl_version: "v1.25.0"
argocd_params: "--grpc-web --insecure --server argocd.127.0.0.1.nip.io"
argocd_version: "2.4.11"
argocd_projects_dir: "argocd/projects"
go_version: '>=1.18.0'
ACK_GINKGO_DEPRECATIONS: "1.16.5"
KEPTN_VERSION: "0.13.6"
on:
workflow_dispatch:
workflow_run:
workflows:
- "trivy check"
- "sh-checker"
branches:
- main
pull_request:
branches:
- main
types:
- completed
pull_request:
branches:
- main
# paths:
# - .github/workflows/dry-run.yml
# - argocd/**
# - kind/**
# - tests/e2e/**
# - Makefile
# push:
# branches-ignore:
# - main
# paths:
# - .github/workflows/dry-run.yml
# - argocd/**
# - kind/**
# - tests/e2e/**
# - Makefile
jobs:
dry-run:
runs-on: ubuntu-latest
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
checks: write
pull-requests: write
steps:
- name: "prepare env: clone repo"
uses: actions/checkout@v3
# - name: "prepare env: show vars"
# run: env
# - name: "debug: end workflow"
# run: "false"
- name: "prepare env: install make"
run: |
sudo apt update
sudo apt install make -y
- name: "prepare env: install golang"
uses: actions/setup-go@v4
with:
go-version: ${{ env.go_version }}
- name: "prepare env: init kind"
uses: helm/kind-action@main
with:
version: "${{ env.kind_version }}"
kubectl_version: "${{ env.kind_kubectl_version }}"
install_only: true
- name: "cluster create"
run: make kind-create
- name: "debug info: golang version"
run: go version
- name: "debug info: kubectl version"
run: kubectl version
- name: "debug info: k8s nodes and cluster-info"
run: kubectl get nodes -o wide; kubectl cluster-info
- name: "prepare cluster: fix prometheus-operator's CRDs"
run: make kind-install-crds
- name: "prepare cluster: install cilium"
run: make cilium-install-ci
- name: "prepare cluster: show all pods"
run: sleep 5 && kubectl get pods -A
- name: "prepare cluster: install ArgoCD"
run: make argocd-deploy
- name: "prepare cluster: wait for argo-cd server ready"
run: kubectl wait -n argocd --timeout=2m --for=condition=available deployment argocd-single-server
- name: "prepare cluster: install nginx-ingress (and gateway-api CRDs)"
run: make nginx-ingress-deploy
- name: "prepare cluster: wait for argo-cd nginx init"
run: sleep 15
# - name: "prepare cluster: install cert-manager"
# run: make cert-manager-deploy
- name: "argo-cd: wait to ingress ready"
run: kubectl wait -n ingress-nginx --timeout=2m --for=condition=available deployment nginx-ingress-ingress-nginx-controller
- name: "debug info: show all deployments"
if: always()
run: kubectl get deployments -A
- name: "debug info: show all pods"
if: always()
run: kubectl get pods -A
- name: "debug info: show all services"
if: always()
run: kubectl get svc -A
- name: "argo-cd: cli init"
uses: clowdhaus/argo-cd-action/@main
with:
version: ${{ env.argocd_version }}
command: version
options: --client
- name: "argo-cd: create projects"
run: kubectl apply -f ${{ env.argocd_projects_dir }}
# - name: "argo-cd: install changed app's defs"
# run: ./scripts/detect_updated_argocd_apps.sh
- name: "argo-cd: install prometheus-stack-deploy"
run: make prometheus-stack-deploy
- name: "fixtures: decrease cpu requests for some workload"
run: |
kubectl -n kube-system scale deployment coredns --replicas=1
kubectl -n kube-system patch deployment coredns --patch '{"spec": {"template": {"spec": {"containers": [{"name": "coredns", "resources": {"requests": {"cpu": "25m"}}}]}}}}'
argocd ${{ env.argocd_params }} app set nginx-ingress -p controller.resources.requests.cpu=25m
sleep 5
# kubectl -n ingress-nginx delete pods -l app.kubernetes.io/component=controller
kubectl wait -n ingress-nginx --timeout=2m --for=condition=available deployment nginx-ingress-ingress-nginx-controller
- name: "argo-cd: keptn-prepare-images and install projects"
run: |
make keptn-prepare-images
kubectl -n argocd apply -f argocd/projects/system-keptn.yaml
- name: "argo-cd: install argo-rollouts (and sleep)"
run: kubectl -n argocd apply -f argocd/argo-rollouts.yaml && sleep 10
- name: "argo-cd: install keptn-nats (and sleep)"
run: kubectl -n argocd apply -f argocd/keptn-nats.yaml && sleep 10
- name: "argo-cd: install keptn-mongodb (and sleep)"
run: kubectl -n argocd apply -f argocd/keptn-mongodb.yaml && sleep 10
- name: "keptn: wait for keptn nats ready"
id: keptnWaitToReady1
timeout-minutes: 10
run: |
kubectl -n keptn wait --timeout=10m pod --for=condition=ready -l app=keptn-nats-cluster
- name: "keptn: debug info (nats & mongodb)"
if: failure() && steps.keptnWaitToReady1.outcome == 'failure'
run: |
kubectl -n keptn get deployments,sts --show-kind=true || true
kubectl -n keptn get pods -o wide --show-kind=true || true
kubectl -n keptn get sc,pv,pvc --show-kind=true || true
kubectl -n keptn get svc --show-kind=true || true
kubectl -n keptn get smon --show-kind=true || true
# kubectl -n keptn describe sts -l app=keptn-nats-cluster || true
# kubectl -n keptn describe deployments -l app.kubernetes.io/component=mongodb || true
# kubectl -n keptn describe pod -l app.kubernetes.io/component=mongodb || true
- name: "argo-cd: install keptn control plane (and sleep)"
run: kubectl -n argocd apply -f argocd/keptn.yaml && sleep 10
- name: "keptn: wait for deploy keptn services"
id: keptnWaitToReady2
timeout-minutes: 15
run: |
kubectl -n keptn wait --timeout=10m deployments --for=condition=available -l app.kubernetes.io/component=mongodb
kubectl -n keptn wait --timeout=15m deployments --for=condition=available -l argocd.argoproj.io/instance=keptn
- name: "keptn: debug info"
if: failure() && steps.keptnWaitToReady2.outcome == 'failure'
run: |
kubectl -n keptn get deployments,sts --show-kind=true || true
kubectl -n keptn get pods --show-kind=true -o wide || true
kubectl -n keptn get sc,pv,pvc --show-kind=true || true
kubectl -n keptn get svc --show-kind=true || true
kubectl -n keptn get smon --show-kind=true || true
echo "debug shipyard: "
kubectl -n keptn describe deployments/shipyard-controller || true
echo "debug statistic service:"
kubectl -n keptn describe deployments/statistics-service || true
kubectl -n keptn describe rs -l app.kubernetes.io/name=statistics-service || true
kubectl -n keptn describe pod -l app.kubernetes.io/name=statistics-service || true
echo "debug configuration service:"
kubectl -n keptn describe persistentvolumeclaim/configuration-volume || true
- name: "argo-cd: show all apps"
if: always()
run: argocd app list ${{ env.argocd_params }}
- name: "keptn: download cli"
run: curl --no-progress-meter -sL https://get.keptn.sh | bash
- name: "keptn: set login (and check keptn api)"
run: make keptn-set-login
- name: "keptn: wait to roll-out bridge"
id: keptnWaitToReady3
run: kubectl -n keptn rollout status --watch --timeout=5m deployments.apps bridge
- name: "keptn: wait to roll-out bridge - debug info"
if: failure() && steps.keptnWaitToReady3.outcome == 'failure'
run: |
kubectl -n keptn get deployment bridge || true
kubectl -n keptn get deployment -l app.kubernetes.io/name=bridge || true
kubectl -n keptn describe pod -l app.kubernetes.io/name=bridge || true
- name: "keptn: prepare helm chart for hello"
run: make keptn-helloserver-prepare-helm-charts
- name: "keptn: install podtato-head project & app"
run: make keptn-create-project-podtato-head
- name: "keptn: show projects"
run: keptn get projects
- name: "keptn: show services for podtato-head project"
run: keptn get service --project=podtato-head
- name: "run test-network test: create assets"
run: make test-network-apply-assets
- name: "run test-network test: wait to assets"
id: runNetTestWait
run: |
kubectl wait -n test-network --timeout=3m --for=condition=available deployment client
kubectl wait -n test-network --timeout=3m --for=condition=available deployment podinfo
- name: "run test-network test - (double) check"
run: |
rs=$(make test-network-check-status)
echo "$rs"
echo "$rs" |grep "greetings from podinfo"
- name: "run test-network test: debug"
if: failure() && steps.runNetTestWait.outcome == 'failure'
run: |
kubectl -n test-network get po,svc,cnp --show-kind=true || true
kubectl -n test-network describe deployments/client || true
kubectl -n test-network describe rs -l app=client || true
- name: "e2e tests: install dependencies"
run: |
cd tests/e2e
go mod vendor
go env -w GO111MODULE=auto
- name: "e2e tests: list"
run: go list ./...
- name: "e2e tests: run"
id: runE2eTests
run: |
cd tests/e2e
go test ./... -report-dir=./junit -v
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v1
if: always()
with:
comment_mode: off
files: 'tests/e2e/**/junit_*.xml'
- name: "e2e tests: debug info"
if: failure() && steps.runE2eTests.outcome == 'failure'
run: |
kubectl get pods -A -o wide --show-kind=true || true
kubectl get svc -A --show-kind=true || true
kubectl get secrets -A --show-kind=true || true
kubectl get cnp -A --show-kind=true || true
kubectl get ccnp -A --show-kind=true || true
kubectl get issuers -A --show-kind=true || true
kubectl get certificates -A --show-kind=true || true
kubectl get smon -A --show-kind=true || true
- name: "keptn: show status of podtato-head"
if: always()
run: |
kubectl -n podtato-head-dev get deployment || true
kubectl -n podtato-head-prod get deployment || true
kubectl -n podtato-head-dev get pods || true
kubectl -n podtato-head-prod get pods || true
kubectl -n podtato-head-dev get smon || true
kubectl -n podtato-head-prod get smon || true
- name: "debug: kind node details"
if: always()
run: kubectl describe node