diff --git a/Makefile b/Makefile index b6e46a462..d7c3f3b93 100644 --- a/Makefile +++ b/Makefile @@ -310,6 +310,11 @@ docker-image-golint: docker-image_MAKETGT = golint docker-image-golint: docker-image_DOCKERTGT = builder docker-image-golint: docker-image +.PHONY: docker-image-check-manifests +docker-image-check-manifests: docker-image_MAKETGT = "generate manifests check-git-diff" +docker-image-check-manifests: docker-image_DOCKERTGT = builder +docker-image-check-manifests: docker-image + .PHONY: clean clean: @rm -fr $(BIN_DIR) diff --git a/playbooks/airship-airshipctl-check-manifests.yaml b/playbooks/airship-airshipctl-check-manifests.yaml new file mode 100644 index 000000000..81c2b4ac2 --- /dev/null +++ b/playbooks/airship-airshipctl-check-manifests.yaml @@ -0,0 +1,20 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- hosts: primary + tasks: + - name: Run manifests check + block: + - name: "make docker-image-check-manifests" + make: + chdir: "{{ zuul.project.src_dir }}" + target: docker-image-check-manifests diff --git a/tools/git_diff_check b/tools/git_diff_check index e8c36b518..3ad28339e 100755 --- a/tools/git_diff_check +++ b/tools/git_diff_check @@ -30,6 +30,20 @@ then exit 1 fi +git diff-files --quiet --ignore-submodules **/zz_generated.deepcopy.go +if [ $? -ne 0 ] +then + echo "git diff found modified zz_generated.deepcopy.go file, please run make generate" + exit 1 +fi + +git diff-files --quiet --ignore-submodules manifests/function/airshipctl-schemas/airshipit.org_*.yaml +if [ $? -ne 0 ] +then + echo "git diff found modified CRD files, please run make manifests" + exit 1 +fi + # Evaluate git index for differences, if found print message and fail. git diff-index --cached --quiet --ignore-submodules HEAD -- **/*.golden if [ $? -ne 0 ] @@ -45,4 +59,18 @@ then exit 1 fi +git diff-index --cached --quiet --ignore-submodules HEAD **/zz_generated.deepcopy.go +if [ $? -ne 0 ] +then + echo "git diff found modified zz_generated.deepcopy.go file, please run make generate" + exit 1 +fi + +git diff-index --cached --quiet --ignore-submodules HEAD manifests/function/airshipctl-schemas/airshipit.org_*.yaml +if [ $? -ne 0 ] +then + echo "git diff found modified CRD files, please run make manifests" + exit 1 +fi + echo "no git diff detected, make target completed successfully" diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 5984b90b8..013eebb9c 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -42,6 +42,12 @@ nodeset: airship-airshipctl-single-node files: *gofiles +- job: + name: airship-airshipctl-check-manifests + pre-run: playbooks/airship-airshipctl-deploy-docker.yaml + run: playbooks/airship-airshipctl-check-manifests.yaml + nodeset: airship-airshipctl-single-node + - job: name: airship-airshipctl-check-github-issues description: Checks if a Github issue is referenced in the commit message @@ -125,6 +131,8 @@ soft: true - name: airship-airshipctl-unit soft: true + - name: airship-airshipctl-check-manifests + soft: true - name: airship-airshipctl-build-image soft: true vars: @@ -164,6 +172,8 @@ soft: true - name: airship-airshipctl-golint soft: true + - name: airship-airshipctl-check-manifests + soft: true - name: airship-airshipctl-unit soft: true - name: airship-airshipctl-build-image @@ -206,6 +216,8 @@ soft: true - name: airship-airshipctl-golint soft: true + - name: airship-airshipctl-check-manifests + soft: true - name: airship-airshipctl-build-image soft: true - name: airship-airshipctl-validate-site-docs diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 13f4ec58b..fcd5c0206 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -34,6 +34,7 @@ - airship-airshipctl-golint - airship-airshipctl-lint - airship-airshipctl-unit + - airship-airshipctl-check-manifests - airship-airshipctl-roles-test - airship-airshipctl-check-github-issues - airship-airshipctl-build-image @@ -53,6 +54,7 @@ - openstack-tox-docs: *docs - airship-airshipctl-lint - airship-airshipctl-unit + - airship-airshipctl-check-manifests - airship-airshipctl-build-image - airship-airshipctl-validate-site-docs - airship-airshipctl-gate-script-runner