From 4997e4826085b6513ad800bdca5acce21d623ff3 Mon Sep 17 00:00:00 2001 From: Dexter Yan Date: Tue, 15 Oct 2024 14:36:09 +1300 Subject: [PATCH 1/2] fix(make): make sure github action can check schemas change --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 02593d246..d702cede0 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,8 @@ openapischema: controller-gen controller-gen crd +output:dir=./config/crds paths=./pkg/apis/troubleshoot/v1beta2 check-schemas: generate schemas - @if [ -n "$(shell git status --short)" ]; then \ + cp -r ./../../../github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset ./pkg/client/ + @if [ -n "$$(git status --short)" ]; then \ echo -e "\033[31mThe git repo is dirty :( Ensure all generated files are committed e.g CRD schema files\033[0;m"; \ git status --short; \ exit 1; \ From 191f7a9c64f162c62e248c24eec600669ae5def2 Mon Sep 17 00:00:00 2001 From: Dexter Yan Date: Wed, 16 Oct 2024 13:03:49 +1300 Subject: [PATCH 2/2] fix github actuib --- .github/workflows/build-test-deploy.yaml | 7 +++++-- Makefile | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test-deploy.yaml b/.github/workflows/build-test-deploy.yaml index 0849d49a8..d35380708 100644 --- a/.github/workflows/build-test-deploy.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -81,7 +81,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - run: make check-schemas + path: github.com/replicatedhq/troubleshoot + - run: | + cd github.com/replicatedhq/troubleshoot + make check-schemas compile-preflight: runs-on: ubuntu-latest @@ -388,4 +391,4 @@ jobs: # if the validate-pr-tests job was successful, this job will succeed - name: succeed if validate-pr-tests job succeeded if: needs.validate-pr-tests.result == 'success' - run: echo "Validation succeeded" \ No newline at end of file + run: echo "Validation succeeded" diff --git a/Makefile b/Makefile index d702cede0..391daa8ad 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ generate: controller-gen client-gen $(CONTROLLER_GEN) \ object:headerFile=./hack/boilerplate.go.txt paths=./pkg/apis/... $(CLIENT_GEN) \ - --output-base=./../../../ \ + --output-base=$$(pwd)/../../../ \ --output-package=github.com/replicatedhq/troubleshoot/pkg/client \ --clientset-name troubleshootclientset \ --input-base github.com/replicatedhq/troubleshoot/pkg/apis \ @@ -147,7 +147,6 @@ openapischema: controller-gen controller-gen crd +output:dir=./config/crds paths=./pkg/apis/troubleshoot/v1beta2 check-schemas: generate schemas - cp -r ./../../../github.com/replicatedhq/troubleshoot/pkg/client/troubleshootclientset ./pkg/client/ @if [ -n "$$(git status --short)" ]; then \ echo -e "\033[31mThe git repo is dirty :( Ensure all generated files are committed e.g CRD schema files\033[0;m"; \ git status --short; \