diff --git a/.github/workflows/verify-helm-chart.yml b/.github/workflows/verify-helm-chart.yml new file mode 100644 index 0000000..56e4ed9 --- /dev/null +++ b/.github/workflows/verify-helm-chart.yml @@ -0,0 +1,46 @@ +name: Verify Helm Chart + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + verify-helm-chart: + runs-on: ubuntu-latest + steps: + - name: Clone the code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Install kubebuilder + run: | + curl -L -o kubebuilder "https://go.kubebuilder.io/dl/latest/$(go env GOOS)/$(go env GOARCH)" + chmod +x kubebuilder + sudo mv kubebuilder /usr/local/bin/ + + - name: Regenerate manifests and Helm chart + run: | + IMG_TAG=$(grep 'newTag:' config/manager/kustomization.yaml | awk '{print $2}') + go mod tidy + make build-installer IMG="octopusdeploy/octopus-permissions-controller:${IMG_TAG}" + kubebuilder edit --plugins=helm/v2-alpha + + - name: Check for uncommitted changes + run: | + if git diff --exit-code; then + echo "All generated files are up to date." + else + cat <<'EOF' + Generated files are out of date. + + Please run the following commands locally and commit the changes: + + make build-installer + kubebuilder edit --plugins=helm/v2-alpha + EOF + exit 1 + fi diff --git a/api/v1beta1/workloadserviceaccount_types.go b/api/v1beta1/workloadserviceaccount_types.go index 96d37b0..7f6d497 100644 --- a/api/v1beta1/workloadserviceaccount_types.go +++ b/api/v1beta1/workloadserviceaccount_types.go @@ -58,6 +58,9 @@ type WorkloadServiceAccountScope struct { Projects []string `json:"projects,omitempty"` // +optional // +kubebuilder:validation:items:Pattern="^[\\p{Ll}\\p{N}]+(?:-[\\p{L}\\p{N}]+)*$" + NewProperty []string `json:"newProperty,omitempty"` + // +optional + // +kubebuilder:validation:items:Pattern="^[\\p{Ll}\\p{N}]+(?:-[\\p{L}\\p{N}]+)*$" ProjectGroups []string `json:"projectGroups,omitempty"` // +optional // +kubebuilder:validation:items:Pattern="^[\\p{Ll}\\p{N}]+(?:-[\\p{L}\\p{N}]+)*$" diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 1c6c722..a7c44b6 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -250,6 +250,11 @@ func (in *WorkloadServiceAccountScope) DeepCopyInto(out *WorkloadServiceAccountS *out = make([]string, len(*in)) copy(*out, *in) } + if in.NewProperty != nil { + in, out := &in.NewProperty, &out.NewProperty + *out = make([]string, len(*in)) + copy(*out, *in) + } if in.ProjectGroups != nil { in, out := &in.ProjectGroups, &out.ProjectGroups *out = make([]string, len(*in)) diff --git a/config/crd/bases/agent.octopus.com_clusterworkloadserviceaccounts.yaml b/config/crd/bases/agent.octopus.com_clusterworkloadserviceaccounts.yaml index efe26f0..d38c00c 100644 --- a/config/crd/bases/agent.octopus.com_clusterworkloadserviceaccounts.yaml +++ b/config/crd/bases/agent.octopus.com_clusterworkloadserviceaccounts.yaml @@ -131,6 +131,11 @@ spec: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ type: string type: array + newProperty: + items: + pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ + type: string + type: array projectGroups: items: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ diff --git a/config/crd/bases/agent.octopus.com_workloadserviceaccounts.yaml b/config/crd/bases/agent.octopus.com_workloadserviceaccounts.yaml index 5b43a7b..d6af4b9 100644 --- a/config/crd/bases/agent.octopus.com_workloadserviceaccounts.yaml +++ b/config/crd/bases/agent.octopus.com_workloadserviceaccounts.yaml @@ -151,6 +151,11 @@ spec: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ type: string type: array + newProperty: + items: + pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ + type: string + type: array projectGroups: items: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ diff --git a/dist/chart/templates/crd/clusterworkloadserviceaccounts.agent.octopus.com.yaml b/dist/chart/templates/crd/clusterworkloadserviceaccounts.agent.octopus.com.yaml index a833352..c151c3f 100644 --- a/dist/chart/templates/crd/clusterworkloadserviceaccounts.agent.octopus.com.yaml +++ b/dist/chart/templates/crd/clusterworkloadserviceaccounts.agent.octopus.com.yaml @@ -121,6 +121,11 @@ spec: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ type: string type: array + newProperty: + items: + pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ + type: string + type: array projectGroups: items: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ diff --git a/dist/chart/templates/crd/workloadserviceaccounts.agent.octopus.com.yaml b/dist/chart/templates/crd/workloadserviceaccounts.agent.octopus.com.yaml index 90fa9b8..3e221d6 100644 --- a/dist/chart/templates/crd/workloadserviceaccounts.agent.octopus.com.yaml +++ b/dist/chart/templates/crd/workloadserviceaccounts.agent.octopus.com.yaml @@ -141,6 +141,11 @@ spec: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ type: string type: array + newProperty: + items: + pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ + type: string + type: array projectGroups: items: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ diff --git a/dist/install.yaml b/dist/install.yaml index de73325..46ae863 100644 --- a/dist/install.yaml +++ b/dist/install.yaml @@ -139,6 +139,11 @@ spec: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ type: string type: array + newProperty: + items: + pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ + type: string + type: array projectGroups: items: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ @@ -402,6 +407,11 @@ spec: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ type: string type: array + newProperty: + items: + pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$ + type: string + type: array projectGroups: items: pattern: ^[\p{Ll}\p{N}]+(?:-[\p{L}\p{N}]+)*$