-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (67 loc) · 2.77 KB
/
Copy pathgithub-sync-chart-crds.yml
File metadata and controls
76 lines (67 loc) · 2.77 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
65
66
67
68
69
70
71
72
73
74
75
76
name: Sync chart CRDs
# The Helm chart lives in devops-ia/helm-dwpk, but its CRDs and the manager
# ClusterRole are generated here by controller-gen. Nothing in the chart repo
# can notice when api/v1alpha1 changes, so this pushes the regenerated files
# there as a pull request instead of waiting for someone to remember.
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "api/v1alpha1/**"
- "config/crd/bases/**"
- "config/rbac/role.yaml"
- "hack/sync-chart-crds.sh"
permissions: {}
jobs:
sync:
name: Regenerate and open a chart PR
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout dwpk
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: dwpk
persist-credentials: false
- name: Checkout helm-dwpk
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: devops-ia/helm-dwpk
path: helm-dwpk
token: ${{ secrets.PAT_GITHUB }}
persist-credentials: true
- name: Setup Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: dwpk/go.mod
- name: Regenerate the CRDs into the chart
working-directory: dwpk
run: make sync-chart-crds HELM_CHART_DIR=../helm-dwpk/charts/dwpk
# The chart ships example CRs that rot the same way the CRDs do: a field
# removed from a type leaves a YAML that kubectl refuses outright. This
# is the only place both repositories are checked out together, so it is
# the only place that check can run.
- name: Check the chart's example CRs still decode
working-directory: dwpk
env:
DWPK_CHART_EXAMPLES: ../../../helm-dwpk/charts/dwpk/examples/crs
run: go test ./api/v1alpha1/ -run TestShippedManifestsMatchTheCurrentSchema -count=1
- name: Open a pull request on helm-dwpk
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
path: helm-dwpk
token: ${{ secrets.PAT_GITHUB }}
branch: fix/sync-crds
delete-branch: true
commit-message: "fix: sync CRDs from dwpk@${{ github.sha }}"
title: "fix: sync CRDs from dwpk"
labels: auto-pr-bump-version
body: |
Regenerated by `make sync-chart-crds` in
[devops-ia/dwpk@${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}).
Covers `templates/crd/*` and `templates/rbac/manager-role.yaml`, both
of which are generated from `api/v1alpha1` and the `+kubebuilder:rbac`
markers. Edit those upstream, never here.