feat: add reviewers to promotion pull requests (GitHub) #2628
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |