-
Notifications
You must be signed in to change notification settings - Fork 66
64 lines (53 loc) · 2.81 KB
/
Copy pathkubebuilder_helm.yaml
File metadata and controls
64 lines (53 loc) · 2.81 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
name: Kubebuilder Helm Chart Validation
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
# this version will need to match the one in https://github.com/argoproj-labs/gitops-promoter-helm/
env:
KUBEBUILDER_VERSION: v4.15.0
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
helm-chart-validation:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.27.1"
- name: Install kubebuilder
run: |
curl -L -o kubebuilder "https://github.com/kubernetes-sigs/kubebuilder/releases/download/${{ env.KUBEBUILDER_VERSION }}/kubebuilder_$(go env GOOS)_$(go env GOARCH)"
chmod +x kubebuilder && sudo mv kubebuilder /usr/local/bin/
kubebuilder version
- name: Set up Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
with:
version: v4.2.4
- name: Generate Helm chart with Kubebuilder
run: |
kubebuilder edit --plugins=helm/v2-alpha --output-dir=./tmp_chart --manifests=./dist/install-without-ui.yaml
- name: Update example blocks from generated CRDs
run: |
sed -i 's/{{- if eq \(.Environment\)/{{ `{{- if eq .Environment` }}/g; s/{{- else if eq \(.Environment\)/{{ `{{- else if eq .Environment` }}/g; s/{{- end -}}/{{ `{{- end -}}` }}/g; s/{{- range \$key, \$value := \.ArgoCDCommitStatus/{{ `{{- range $key, $value := .ArgoCDCommitStatus` }}/g' tmp_chart/chart/templates/crd/argocdcommitstatuses.promoter.argoproj.io.yaml
# Kubebuilder leaves {{ range }}/{{ if }} in urlTemplate example as real Helm actions; wrap as a raw string (same pattern as ArgoCD CRD above).
sed -i 's|{{ range .PromotionStrategy.Status.Environments }}{{ if eq .Branch \$\.Branch }}{{ "{{ .Proposed.Hydrated.Sha }}" }}{{ end }}{{ end }}|{{ `{{ range .PromotionStrategy.Status.Environments }}{{ if eq .Branch $.Branch }}{{ .Proposed.Hydrated.Sha }}{{ end }}{{ end }}` }}|g' tmp_chart/chart/templates/crd/webrequestcommitstatuses.promoter.argoproj.io.yaml
- name: Lint Helm chart
run: |
# we set these to true to match the defaults from the Helm chart's values.yaml
helm lint --debug ./tmp_chart/chart --set crd.enable=true --set webhook.enable=true
- name: Upload Helm chart artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: helm-chart
path: ./tmp_chart
retention-days: 3