From ed6f409ef42da7a2d067b4986517e3c5fed41c74 Mon Sep 17 00:00:00 2001 From: asifdxtreme Date: Mon, 22 Jul 2019 14:50:20 +0530 Subject: [PATCH 1/2] Add Verify Job to check consistency between generate yaml and the yaml in the repo --- .travis.yml | 5 +++++ Makefile | 4 ++++ hack/check-generated-yaml.sh | 33 ++++++++++++++++++++++++++++++ installer/volcano-development.yaml | 25 +++++++++++----------- 4 files changed, 55 insertions(+), 12 deletions(-) create mode 100755 hack/check-generated-yaml.sh diff --git a/.travis.yml b/.travis.yml index 37671c4350..ead3daaba4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,11 @@ jobs: - go get -u golang.org/x/lint/golint script: - make verify + - stage: Verify Deployment Yaml + script: + - echo "Verifying contents of installer/development.yaml with generated yaml" + - make TAG=latest generate-yaml + - make verify-generated-yaml - stage: UT Tests before_script: - go get github.com/mattn/goveralls diff --git a/Makefile b/Makefile index a3756fc623..4cf0fc8e91 100644 --- a/Makefile +++ b/Makefile @@ -88,3 +88,7 @@ verify: generate-code hack/verify-gofmt.sh hack/verify-golint.sh hack/verify-gencode.sh + +verify-generated-yaml: + ./hack/check-generated-yaml.sh + diff --git a/hack/check-generated-yaml.sh b/hack/check-generated-yaml.sh new file mode 100755 index 0000000000..fe2151502a --- /dev/null +++ b/hack/check-generated-yaml.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright 2019 The Volcano Authors. + +# 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. + +set -o errexit +set -o nounset +set -o pipefail + +VK_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.. +export RELEASE_FOLDER=${VK_ROOT}/${RELEASE_DIR} + + +if ! diff ${VK_ROOT}/installer/volcano-development.yaml ${RELEASE_FOLDER}/volcano-latest.yaml ; then + { + echo + echo "The Generated yaml is different from the one in installer/volcano-development.yaml" + echo "Suggest to sync both the files" + echo + } >&2 + false +fi \ No newline at end of file diff --git a/installer/volcano-development.yaml b/installer/volcano-development.yaml index 27906e59cb..69946c8658 100644 --- a/installer/volcano-development.yaml +++ b/installer/volcano-development.yaml @@ -34,7 +34,7 @@ data: - name: predicates - name: proportion - name: nodeorder - + --- apiVersion: v1 kind: ServiceAccount @@ -134,13 +134,13 @@ spec: app: volcano-scheduler spec: serviceAccount: volcano-scheduler - + containers: - name: volcano-scheduler image: volcanosh/vc-scheduler:latest args: - --alsologtostderr - - --scheduler-conf=/volcano.scheduler/volcano-scheduler-ci.conf + - --scheduler-conf=/volcano.scheduler/volcano-scheduler.conf - -v=3 - 2>&1 imagePullPolicy: "IfNotPresent" @@ -223,7 +223,7 @@ spec: app: volcano-admission spec: serviceAccount: volcano-admission - + containers: - args: - --tls-cert-file=/admission.local.config/certificates/tls.crt @@ -372,15 +372,15 @@ spec: app: volcano-controller spec: serviceAccount: volcano-controllers - + containers: - - name: volcano-controllers - image: volcanosh/vc-controllers:latest - args: - - --alsologtostderr - - -v=4 - - 2>&1 - imagePullPolicy: "IfNotPresent" + - name: volcano-controllers + image: volcanosh/vc-controllers:latest + args: + - --alsologtostderr + - -v=4 + - 2>&1 + imagePullPolicy: "IfNotPresent" --- # Source: volcano/templates/batch_v1alpha1_job.yaml @@ -800,3 +800,4 @@ spec: type: object type: object version: v1alpha2 + From 8140cfac4a8b6c804682ada21211d58f02cee978 Mon Sep 17 00:00:00 2001 From: Mohammad Asif Siddiqui Date: Mon, 22 Jul 2019 17:00:36 +0530 Subject: [PATCH 2/2] Add new line character --- hack/check-generated-yaml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/check-generated-yaml.sh b/hack/check-generated-yaml.sh index fe2151502a..212e352a77 100755 --- a/hack/check-generated-yaml.sh +++ b/hack/check-generated-yaml.sh @@ -30,4 +30,4 @@ if ! diff ${VK_ROOT}/installer/volcano-development.yaml ${RELEASE_FOLDER}/volcan echo } >&2 false -fi \ No newline at end of file +fi