-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (120 loc) · 3.93 KB
/
ci-helm-lint-test.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
name: Lint and Test Chart
on:
pull_request:
paths:
- 'charts/**'
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Install Helm
uses: azure/[email protected]
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
#if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
#fi
- name: Run chart-testing (lint)
id: lint
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'
- name: verify cluster and local path
run: |
kubectl config set-context kind-chart-testing
kubectl cluster-info
kubectl get pods -A
pwd
ls -hal
- name: Install Certmanager
run: |
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--set installCRDs=true \
--set prometheus.enabled=false
- name: Install CNPG Operator
run: |
helm repo add cnpg-operator https://cloudnative-pg.github.io/charts
helm repo update
helm install cnpg-operator cnpg-operator/cloudnative-pg \
--namespace cnpg-system \
--create-namespace
- name: Creat testing values
working-directory: ./charts/cloudnative-pg-cluster
run: |
cat << EOF > test-values.yaml
name: "cnpg"
instances: 1
bootstrap:
initdb:
database: app
owner: app
secret:
name: null
certificates:
server:
enabled: false
generate: false
serverTLSSecret: ""
serverCASecret: ""
client:
enabled: false
generate: false
clientCASecret: ""
replicationTLSSecret: ""
user:
enabled: false
username: "app"
monitoring:
enablePodMonitor: false
postgresql:
pg_hba:
- hostssl all all all cert
storage:
size: 1Gi
testApp:
enabled: false
EOF
- name: Install CNPG cluster
working-directory: ./charts/cloudnative-pg-cluster
run: |
helm repo add cnpg-cluster https://small-hack.github.io/cloudnative-pg-cluster-chart
helm repo update
helm install cnpg-cluster cnpg-cluster/cnpg-cluster --values test-values.yaml
#helm template . -f test-values.yaml > deploy.yaml
#kubectl apply -f deploy.yaml
ITER=0
while true; do
if [[ $ITER -ge 300 ]]; then
echo "Cluster not ready"
exit 1
fi
READY_INSTANCES=$(kubectl get cluster cluster-example -o jsonpath='{.status.readyInstances}')
if [[ "$READY_INSTANCES" == 3 ]]; then
echo "Cluster up and running"
break
fi
sleep 1
(( ++ITER ))
done
- name: Run chart-testing (install)
id: install
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}