Support Linting YAML as part of Travis CI build (#554)

* add yamllint command to travis CI

installs and runs a linter across the YAML in the
project to ensure consistency in the written YAML.

this uses yamllint and the default yamllint config with
"truthy" and "line-length" disabled.

* run dos2unix on CRLF files

* YAMLLINT: remove trailing spaces

* YAMLLint: add YAML document start

* YAMLLint: too many spaces around bracket

* YAMLLint: fix indentation

* YAMLLint: remove duplicate key

* YAMLLint: newline at end of file

* YAMLLint: Too few spaces after comma

* YAMLLint: too many spaces after colon
pull/544/head
James Ward 4 years ago committed by Liz Rice
parent dc14cb14b0
commit 5f34058dc7

@ -1,3 +1,4 @@
---
env: env:
- GO111MODULE=on - GO111MODULE=on
- KUBEBENCH_CFG=/etc/kube-bench/cfg - KUBEBENCH_CFG=/etc/kube-bench/cfg

@ -10,10 +10,12 @@ notifications:
before_install: before_install:
- sudo apt-get -qq update - sudo apt-get -qq update
- sudo apt-get install -y rpm - sudo apt-get install -y rpm
- pip install --user yamllint==1.18.0
- gem install --no-ri --no-rdoc fpm - gem install --no-ri --no-rdoc fpm
- go get -t -v ./... - go get -t -v ./...
script: script:
- yamllint -c ./.yamllint.yaml .
- GO111MODULE=on go test ./... - GO111MODULE=on go test ./...
- IMAGE_NAME=kube-bench make build-docker - IMAGE_NAME=kube-bench make build-docker
- docker run -v `pwd`:/host kube-bench install - docker run -v `pwd`:/host kube-bench install

@ -0,0 +1,6 @@
---
extends: default
rules:
line-length: disable
truthy: disable

@ -774,7 +774,6 @@ groups:
op: has op: has
value: "/etc/origin/master/ca-bundle.crt" value: "/etc/origin/master/ca-bundle.crt"
set: true set: true
test_items:
- flag: "masterCA" - flag: "masterCA"
compare: compare:
op: has op: has

@ -1,3 +1,4 @@
---
# use this pod with: kubectl run ubuntu -it --pid=host -- /bin/bash # use this pod with: kubectl run ubuntu -it --pid=host -- /bin/bash
# this allows you to debug what is running on the host. # this allows you to debug what is running on the host.
apiVersion: v1 apiVersion: v1

@ -1,3 +1,4 @@
---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:

@ -1,3 +1,4 @@
---
apiVersion: kind.sigs.k8s.io/v1alpha3 apiVersion: kind.sigs.k8s.io/v1alpha3
kind: Cluster kind: Cluster
networking: networking:
@ -16,4 +17,3 @@ nodes:
# the control plane node config # the control plane node config
- role: control-plane - role: control-plane
image: "kindest/node:v1.14.6" image: "kindest/node:v1.14.6"

@ -1,3 +1,4 @@
---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
@ -29,4 +30,3 @@ spec:
- name: etc-kubernetes - name: etc-kubernetes
hostPath: hostPath:
path: "/etc/kubernetes" path: "/etc/kubernetes"

@ -1,3 +1,4 @@
---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:

@ -1,3 +1,4 @@
---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:

@ -1,3 +1,4 @@
---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:

@ -1,3 +1,4 @@
---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:

Loading…
Cancel
Save