Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
fix: Add verify-fmt and fmt, fail PR if not formatted
Browse files Browse the repository at this point in the history
This is a first attempt to solve some of the problems we get hit with
relating to merging `jenkins-x.yml`, mandating that `jenkins-x.yml` is
consistently formatted (by using a little utility I wrote that reads
in the file and outputs it again via marshalling with `sigs.k8s.io/yaml`).

Signed-off-by: Andrew Bayer <[email protected]>
  • Loading branch information
abayer committed Nov 5, 2019
1 parent 37df9b2 commit 84ba05b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
GO := GO111MODULE=off go

install-fmt-deps:
$(GO) get github.com/abayer/fmt-yml-for-k8s

fmt: install-fmt-deps
${GOPATH}/bin/fmt-yml-for-k8s --file jenkins-x.yml --output-dir .

verify-fmt: install-fmt-deps fmt
$(eval CHANGED = $(shell git ls-files --modified --exclude-standard))
@if [ "$(CHANGED)" == "" ]; \
then \
echo "jenkins-x.yml properly formatted"; \
else \
echo "jenkins-x.yml is not properly formatted"; \
echo "$(CHANGED)"; \
git diff; \
exit 1; \
fi

2 changes: 2 additions & 0 deletions jenkins-x-bdd-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ pipelineConfig:
- mountPath: /secrets
name: sa
steps:
- name: verify-fmt
command: make verify-fmt
- name: run-bdd
command: bdd/bdd.sh
args: ['bdd/boot-local', 'bdd-config']

0 comments on commit 84ba05b

Please sign in to comment.