-
Notifications
You must be signed in to change notification settings - Fork 22
88 lines (79 loc) · 2.28 KB
/
pr.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
name: Lint and Test Chart
on: pull_request
jobs:
go-test:
runs-on: ubuntu-latest
env:
IMAGE: jainishshah17/tugger
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "^1.13.0"
- name: go test
run: |
cd cmd/tugger
go test . -cover -v
lint-test:
runs-on: ubuntu-latest
env:
IMAGE: jainishshah17/tugger
strategy:
fail-fast: false
matrix:
k8sVersion:
- v1.28.0
- v1.27.3
- v1.26.6
- v1.25.11
- v1.24.15
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Helm
uses: azure/[email protected]
- name: Lint Chart
run: helm lint chart/* -f chart/*/ci/lint-values.yaml
- name: Build
run: docker build . -t $IMAGE
- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: kindest/node:${{ matrix.k8sVersion }}
- name: Install
run: |
kind load docker-image $IMAGE --name=chart-testing
helm install $USER chart/tugger --debug --wait \
--set=createMutatingWebhook=true \
--set=image.tag=latest
- name: Test Mutation
timeout-minutes: 1
run: |
function test_jsonpath() {
until [ "$1" = "$(kubectl -n nginx get po -l test=tugger -o jsonpath="$2")" ]
do
echo "test failed \"$1\" = \"$2\""
sleep 1
done
}
kubectl apply -f test/nginx.yaml
test_jsonpath "jainishshah17/nginx" '{.items[0].spec.containers[0].image}'
test_jsonpath "original-secret" '{.items[0].spec.imagePullSecrets[0].name}'
test_jsonpath "regsecret" '{.items[0].spec.imagePullSecrets[1].name}'
- name: Print debug
if: ${{ always() }}
run: |
set +x
while read cmd
do
echo "::group::$cmd"
$cmd
echo "::endgroup::"
done <<< 'git diff
helm list
kubectl get po,rs,svc,ep,secrets,configmap
kubectl describe po
kubectl logs -l app=tugger'