Skip to content

Commit

Permalink
verify crds have been generated and move overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhelfand committed Jun 16, 2021
1 parent 3e8425d commit f7828f7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
mkdir /tmp/bin
export PATH=/tmp/bin:$PATH
./hack/verify-no-dirty-files.sh
wget -O- https://github.com/kubernetes/minikube/releases/download/v1.10.0/minikube-linux-amd64 > /tmp/bin/minikube
echo "9d34cb50bc39f80d39f92d1fb7cb23a271504b519f5e805574894d395ce3e7b3 /tmp/bin/minikube" | sha256sum -c -
chmod +x /tmp/bin/minikube
Expand Down
1 change: 1 addition & 0 deletions hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ go mod tidy
go build $repro_flags -mod=vendor -o controller ./cmd/main.go
ls -la ./controller

./hack/gen-crds.sh
ytt -f config/ >/dev/null

echo SUCCESS
2 changes: 1 addition & 1 deletion config/crd-overlay.yml → hack/crd-overlay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
#@overlay/match missing_ok=True
status:

#@overlay/match by=overlay.subset({"metadata":{"name":"internalpackagemetadata.internal.packaging.carvel.dev"}}), expects="0+"
#@overlay/match by=overlay.subset({"metadata":{"name":"internalpackagemetadata.internal.packaging.carvel.dev"}})
---
metadata:
name: internalpackagemetadatas.internal.packaging.carvel.dev
Expand Down
1 change: 0 additions & 1 deletion hack/deploy-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
set -e

./hack/build.sh && ytt -f config/ -f config-test/ | kbld -f- | kapp deploy -a kc -f- -c -y

2 changes: 1 addition & 1 deletion hack/gen-crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go \
output:dir=./tmp/crds \
paths=./pkg/apis/...

ytt -f tmp/crds -f config/crd-overlay.yml > config/crds.yml
ytt -f tmp/crds -f ./hack/crd-overlay.yml > config/crds.yml

rm -rf tmp/crds
10 changes: 10 additions & 0 deletions hack/verify-no-dirty-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

./hack/build.sh

if ! git diff --exit-code >/dev/null; then
echo "Error: Running ./hack/build.sh resulted in non zero exit code from git diff. Please run './hack/build.sh' and 'git add' the generated file(s)."
exit 1
fi

0 comments on commit f7828f7

Please sign in to comment.