@@ -20,11 +20,30 @@ jobs:
2020 - name : Checkout repository
2121 uses : actions/checkout@v5
2222
23+ - name : Enable Prometheus in kustomize (testdata sample)
24+ run : |
25+ sed -i 's/^#- \.\.\/prometheus/- ..\/prometheus/' testdata/project-v4-with-plugins/config/default/kustomization.yaml
26+
27+ - name : Build kubebuilder CLI
28+ run : make build
29+
2330 - name : Setup Go
2431 uses : actions/setup-go@v6
2532 with :
2633 go-version-file : go.mod
2734
35+ - name : Prepare project-v4-with-plugins
36+ run : |
37+ cd testdata/project-v4-with-plugins/
38+ go mod tidy
39+ make all
40+
41+ - name : Rebuild installer and regenerate Helm chart (v2-alpha)
42+ working-directory : testdata/project-v4-with-plugins
43+ run : |
44+ make build-installer
45+ ../../bin/kubebuilder edit --plugins=helm/v2-alpha --force
46+
2847 - name : Install the latest version of kind
2948 run : |
3049 curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
3756 - name : Create kind cluster
3857 run : kind create cluster
3958
40- - name : Prepare project-v4-with-plugins
41- run : |
42- cd testdata/project-v4-with-plugins/
43- go mod tidy
44- make docker-build IMG=project-v4-with-plugins:v0.1.0
45- kind load docker-image project-v4-with-plugins:v0.1.0
46-
4759 - name : Install Helm
4860 run : |
4961 curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
@@ -55,39 +67,50 @@ jobs:
5567 run : |
5668 helm lint testdata/project-v4-with-plugins/dist/chart
5769
70+ - name : Build project-v4-with-plugins
71+ run : |
72+ cd testdata/project-v4-with-plugins/
73+ go mod tidy
74+ make docker-build IMG=project-v4-with-plugins:v0.1.0
75+ kind load docker-image project-v4-with-plugins:v0.1.0
76+
5877 - name : Install Prometheus Operator CRDs
5978 run : |
6079 helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
6180 helm repo update
6281 helm install prometheus-crds prometheus-community/prometheus-operator-crds
6382
64- - name : Install cert-manager via Helm
83+ - name : Install cert-manager via Helm (wait for readiness)
6584 run : |
6685 helm repo add jetstack https://charts.jetstack.io
6786 helm repo update
68- helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set crds.enabled=true
69-
70- - name : Wait for cert-manager to be ready
71- run : |
72- kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager
73- kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector
74- kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook
87+ helm install cert-manager jetstack/cert-manager \
88+ --namespace cert-manager \
89+ --create-namespace \
90+ --set crds.enabled=true \
91+ --wait \
92+ --timeout 300s
7593
7694 - name : Render Helm chart for project-v4-with-plugins
7795 run : |
7896 helm template testdata/project-v4-with-plugins/dist/chart --namespace=project-v4-with-plugins-system
7997
8098 - name : Install Helm chart for project-v4-with-plugins
8199 run : |
82- helm install my-release testdata/project-v4-with-plugins/dist/chart --create-namespace --namespace project-v4-with-plugins-system --set prometheus.enable=true
100+ helm install my-release \
101+ testdata/project-v4-with-plugins/dist/chart \
102+ --namespace project-v4-with-plugins-system \
103+ --create-namespace \
104+ --set prometheus.enable=true
83105
84106 - name : Check Helm release status
85107 run : |
86108 helm status my-release --namespace project-v4-with-plugins-system
87109
88- - name : Check Presence of ServiceMonitor
110+ - name : Delete kind cluster
111+ if : always()
89112 run : |
90- kubectl wait --namespace project-v4-with-plugins-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/project-v4-with-plugins-controller-manager-metrics-monitor
113+ kind delete cluster || true
91114
92115 # Test scenario:
93116 # - scaffold project without creating webhooks,
97120 # Command to use to scaffold project without creating webhooks and so no need to install cert manager:
98121 # - kubebuilder init
99122 # - kubebuilder create api --group example.com --version v1 --kind App --controller=true --resource=true
100- # - kubebuilder edit --plugins=helm.kubebuilder.io/v1 -alpha
123+ # - kubebuilder edit --plugins=helm.kubebuilder.io/v2 -alpha
101124 test-helm-no-webhooks :
102125 runs-on : ubuntu-latest
103126 if : github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -149,9 +172,18 @@ jobs:
149172
150173 - name : Deploy Helm chart without cert-manager
151174 working-directory : test-helm-no-webhooks
152- run : helm install my-release ./dist/chart --create-namespace --namespace test-helm-no-webhooks-system
175+ run : |
176+ helm install my-release \
177+ ./dist/chart \
178+ --create-namespace \
179+ --namespace test-helm-no-webhooks-system
153180
154181 - name : Verify deployment is working
155182 working-directory : test-helm-no-webhooks
156183 run : |
157184 helm status my-release --namespace test-helm-no-webhooks-system
185+
186+ - name : Delete kind cluster
187+ if : always()
188+ run : |
189+ kind delete cluster || true
0 commit comments