From 1d0561045e1d6487228879925ef042544ac8a3e0 Mon Sep 17 00:00:00 2001 From: Ruslan Aliev Date: Mon, 8 Nov 2021 15:48:54 -0600 Subject: [PATCH] Add check manifests zuul job Signed-off-by: Ruslan Aliev Closes: #665 Change-Id: I53283e0c3b2e5807abdb84433c5563d2e391dcfe --- Makefile | 5 ++++ .../airship-airshipctl-check-manifests.yaml | 20 +++++++++++++ tools/git_diff_check | 28 +++++++++++++++++++ zuul.d/jobs.yaml | 12 ++++++++ zuul.d/projects.yaml | 2 ++ 5 files changed, 67 insertions(+) create mode 100644 playbooks/airship-airshipctl-check-manifests.yaml diff --git a/Makefile b/Makefile index 7b3b820e8..9b7d60cb3 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 3b8864c9c..7685db3a9 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 @@ -118,6 +124,8 @@ soft: true - name: airship-airshipctl-unit soft: true + - name: airship-airshipctl-check-manifests + soft: true - name: airship-airshipctl-build-image soft: true vars: @@ -157,6 +165,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 @@ -198,6 +208,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 16553038c..3a50326fb 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 @@ -52,6 +53,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