-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ee99f3
commit 0517489
Showing
10 changed files
with
297 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
venv,.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,8 @@ | |
/minion | ||
/top.sls | ||
/var/ | ||
venv | ||
.envrc | ||
.direnv | ||
shell.nix | ||
.ropeproject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
extends: default | ||
|
||
ignore: | | ||
venv | ||
rules: | ||
# 80 chars should be enough, but don't fail if a line is longer | ||
line-length: | ||
max: 160 | ||
level: warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# kudos: | ||
# - https://medium.com/@exustash/three-good-practices-for-better-ci-cd-makefiles-5b93452e4cc3 | ||
# - https://le-gall.bzh/post/makefile-based-ci-chain-for-go/ | ||
# - https://makefiletutorial.com/ | ||
# - https://www.cl.cam.ac.uk/teaching/0910/UnixTools/make.pdf | ||
# | ||
#SHELL := /usr/bin/bash # set default shell | ||
#.SHELLFLAGS = -c # Run commands in a -c flag | ||
|
||
.NOTPARALLEL: ; # wait for this target to finish | ||
.EXPORT_ALL_VARIABLES: ; # send all vars to shell | ||
|
||
.PHONY: all # All targets are accessible for user | ||
.DEFAULT: help # Running Make will run the help target | ||
|
||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | ||
ifeq ($(BRANCH), HEAD) | ||
BRANCH := ${CI_BUILD_REF_NAME} | ||
endif | ||
|
||
# help: @ List available tasks of the project | ||
help: | ||
@grep -E '[a-zA-Z\.\-]+:.*?@ .*$$' $(MAKEFILE_LIST)| tr -d '#' | awk 'BEGIN {FS = ":.*?@ "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
## test section | ||
# All tests are called on "." if possible. | ||
# If this is not possible a special loop is used | ||
# to sum up all error codes. | ||
|
||
# test: @ Run all defined tests | ||
test: test-tab test-codespell test-shellcheck test-yamllint test-jsonlint test-salt | ||
@echo "All tests Done!" | ||
|
||
# test-tab: @ Run linting to find files containing tabspaces | ||
test-tab: | ||
@for file in $(shell find . -regextype egrep -regex '.*\.(sls|yml|yaml)' ! -path "**/venv/*"); do\ | ||
grep -q -P '\t' $${file} ;\ | ||
if [ "$$?" -eq 0 ]; then\ | ||
err_add=1 ;\ | ||
echo "Tab found in $${file}" ;\ | ||
grep -H -n -P '\t' $${file} ;\ | ||
else \ | ||
err_add=0 ;\ | ||
fi;\ | ||
err=$$((err_add + err)) ;\ | ||
done; exit $$err | ||
|
||
# test-codespell: @ Run spell check | ||
test-codespell: | ||
codespell -H -f -s -I .codespell.ignore.words -S $(shell cat .codespell.ignore.files) -C 4 -q 6 | ||
|
||
# test-shellcheck: @ Run linting on all shell scripts | ||
test-shellcheck: | ||
for file in $(shell find . -name '*.sh' ! -path "**/venv/*"); do\ | ||
echo $${file} ;\ | ||
shellcheck -s bash -x $${file};\ | ||
err=$$(($$? + err)) ;\ | ||
done; exit $$err | ||
|
||
# test-yamllint: @ Run linting on all yaml files | ||
test-yamllint: | ||
# yamllint -c .yamllint.yaml -s . | ||
yamllint -c .yamllint.yaml . | ||
|
||
# test-jsonlint: @ Run linting on all json files | ||
test-jsonlint: | ||
for file in $(shell find . -name '*.json' ! -path "**/venv/*"); do\ | ||
echo $${file} ;\ | ||
jq << $${file} >/dev/null;\ | ||
err=$$(($$? + err)) ;\ | ||
done; exit $$err | ||
|
||
# test-mlc: @ Run markup link checker | ||
test-mlc: | ||
mkdir -p aws/.terraform # make sure ingore-path exists | ||
mlc --throttle 1000 | ||
|
||
# test-salt: @ Run Salt Unit Tests | ||
test-salt: | ||
cp pillar.example example/pillar/hana.sls | ||
cp example/salt/top.sls . | ||
echo "===========================================" | ||
echo " Using primary host " | ||
echo "===========================================" | ||
cp ci/grains_hana01 grains | ||
cp ci/minion minion | ||
salt-call state.show_highstate --local --file-root=./ --config-dir=. --pillar-root=example/pillar --retcode-passthrough -l debug | ||
echo | ||
echo "===========================================" | ||
echo " Using secondary host " | ||
echo "===========================================" | ||
cp ci/grains_hana02 grains | ||
cp ci/minion minion | ||
salt-call state.show_highstate --local --file-root=./ --config-dir=. --pillar-root=example/pillar --retcode-passthrough -l debug | ||
|
||
|
||
# all: @ Runs everything | ||
all: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
host: hana01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
host: hana02 | ||
hana_inst_folder: myfold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
root_dir: ./ | ||
id: ci |
Oops, something went wrong.