From 9305f12ecf7ddcb3a533017f8e6c191fd250eecc Mon Sep 17 00:00:00 2001 From: subhamkrai Date: Mon, 19 Apr 2021 14:01:11 +0530 Subject: [PATCH] ci: make build not failing currently, the build action is not failing if there is/are any modified files after the build. this commit will validate build with `git status` after `make build` command will fail if any changed file found. Signed-off-by: subhamkrai --- .github/workflows/canary-integration-test.yml | 9 +++++++++ tests/scripts/validate_modified_files.sh | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/canary-integration-test.yml b/.github/workflows/canary-integration-test.yml index 593bbb497..df96d22c3 100644 --- a/.github/workflows/canary-integration-test.yml +++ b/.github/workflows/canary-integration-test.yml @@ -54,6 +54,7 @@ jobs: run: | # set VERSION to a dummy value since Jenkins normally sets it for us. Do this to make Helm happy and not fail with "Error: Invalid Semantic Version" GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' VERSION=0 build + tests/scripts/validate_modified_files.sh build docker images docker tag $(docker images|awk '/build-/ {print $1}') rook/ceph:master @@ -168,6 +169,7 @@ jobs: run: | # set VERSION to a dummy value since Jenkins normally sets it for us. Do this to make Helm happy and not fail with "Error: Invalid Semantic Version" GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' VERSION=0 build + tests/scripts/validate_modified_files.sh build docker images docker tag $(docker images|awk '/build-/ {print $1}') rook/ceph:master @@ -275,6 +277,7 @@ jobs: run: | # set VERSION to a dummy value since Jenkins normally sets it for us. Do this to make Helm happy and not fail with "Error: Invalid Semantic Version" GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' VERSION=0 build + tests/scripts/validate_modified_files.sh build docker images docker tag $(docker images|awk '/build-/ {print $1}') rook/ceph:master @@ -369,6 +372,7 @@ jobs: run: | # set VERSION to a dummy value since Jenkins normally sets it for us. Do this to make Helm happy and not fail with "Error: Invalid Semantic Version" GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' VERSION=0 build + tests/scripts/validate_modified_files.sh build docker images docker tag $(docker images|awk '/build-/ {print $1}') rook/ceph:master @@ -457,6 +461,7 @@ jobs: run: | # set VERSION to a dummy value since Jenkins normally sets it for us. Do this to make Helm happy and not fail with "Error: Invalid Semantic Version" GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' VERSION=0 build + tests/scripts/validate_modified_files.sh build docker images docker tag $(docker images|awk '/build-/ {print $1}') rook/ceph:master @@ -552,6 +557,7 @@ jobs: run: | # set VERSION to a dummy value since Jenkins normally sets it for us. Do this to make Helm happy and not fail with "Error: Invalid Semantic Version" GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' VERSION=0 build + tests/scripts/validate_modified_files.sh build docker images docker tag $(docker images|awk '/build-/ {print $1}') rook/ceph:master @@ -646,6 +652,7 @@ jobs: run: | # set VERSION to a dummy value since Jenkins normally sets it for us. Do this to make Helm happy and not fail with "Error: Invalid Semantic Version" GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' VERSION=0 build + tests/scripts/validate_modified_files.sh build docker images docker tag $(docker images|awk '/build-/ {print $1}') rook/ceph:master @@ -734,6 +741,7 @@ jobs: run: | # set VERSION to a dummy value since Jenkins normally sets it for us. Do this to make Helm happy and not fail with "Error: Invalid Semantic Version" GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' VERSION=0 build + tests/scripts/validate_modified_files.sh build docker images docker tag $(docker images|awk '/build-/ {print $1}') rook/ceph:master @@ -833,6 +841,7 @@ jobs: run: | # set VERSION to a dummy value since Jenkins normally sets it for us. Do this to make Helm happy and not fail with "Error: Invalid Semantic Version" GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' VERSION=0 build + tests/scripts/validate_modified_files.sh build docker images docker tag $(docker images|awk '/build-/ {print $1}') rook/ceph:master diff --git a/tests/scripts/validate_modified_files.sh b/tests/scripts/validate_modified_files.sh index 5afb63245..5f7cc6724 100755 --- a/tests/scripts/validate_modified_files.sh +++ b/tests/scripts/validate_modified_files.sh @@ -7,6 +7,7 @@ set -ex CODEGEN_ERR="found codegen files! please run 'make codegen' and update your PR" MOD_ERR="changes found by mod.check. You may need to run make clean" CRD_ERR="changes found by 'make crds'. please run 'make crds' locally and update your PR" +BUILD_ERR="changes found by make build', please commit your go.sum or other changed files" ############# # FUNCTIONS # @@ -36,7 +37,10 @@ case "$1" in crd) validate "$CRD_ERR" ;; + build) + validate "$BUILD_ERR" + ;; *) - echo $"Usage: $0 {codegen|modcheck|crd}" + echo $"Usage: $0 {codegen|modcheck|crd|build}" exit 1 esac