diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb8a3c4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.shellcheck.tmp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..dba7864 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,14 @@ +stages: + - test + +image: code.ungleich.ch:5050/ungleich-public/cdist/cdist-ci:latest + +shellcheck: + stage: test + script: + - ./scripts/run-shellcheck.sh + +manpages: + stage: test + script: + - ./scripts/run-manpage-checks.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cd9255..d2ebad0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,3 @@ -# cdist-contrib chsangelog +# cdist-contrib changes -## 2020-0?-??: 0.?.? (Not released yet) - -* New type: __find_exec (Ander Punnar) +* 2020-04-28: New type: __find_exec (Ander Punnar) diff --git a/README.md b/README.md index 7dcd73f..ef4b2c3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ tool with community-maitained types which are either too specific to fit/be maintained in cdist itself or were not accepted in code cdist but could still be useful. -The releases of cdist-contrib are not necessarly synced with cdist itself. +This project does not have releases and is continously updated: see +`CHANGELOG.md` for details. ## Using cdist-contrib @@ -39,3 +40,16 @@ Join us on [#cdist:ungleich.ch][cdistmatrix] on matrix or on [cdistconfig]: https://www.cdi.st/manual/latest/cdist-configuration.html [cdistmatrix]: https://matrix.to/#/#cdist:ungleich.ch [cdistmattermost]: https://chat.ungleich.ch/ungleich/channels/cdist + +## Contributing + +The preferred way to submit patches is by opening Merge Requests against the +[cdist-contrib project on +code.ungleich.ch](https://code.ungleich.ch/ungleich-public/cdist-contrib) (you +can make an account on +[account.ungleich.ch](https://account.ungleich.ch/). + +Every type in cdist-contrib must: + + * Have a `man.rst` documentation page. + * Pass [shellcheck](http://shellcheck.net/) without errors. diff --git a/scripts/run-manpage-checks.sh b/scripts/run-manpage-checks.sh new file mode 100755 index 0000000..828179b --- /dev/null +++ b/scripts/run-manpage-checks.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Move to top-level cdist-contrib directory. +cd $(dirname $0)/.. + +# Check that each type has a man page. +status=0 +for t in type/*; do + if [ ! -f "$t/man.rst" ]; then + echo "No manpage for type $t!" + status=1 + fi +done + +exit $status diff --git a/scripts/run-shellcheck.sh b/scripts/run-shellcheck.sh new file mode 100755 index 0000000..769f853 --- /dev/null +++ b/scripts/run-shellcheck.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +SHELLCHECKCMD="shellcheck -s sh -f gcc -x" +# Skip SC2154 for variables starting with __ since such variables are cdist +# environment variables. +SHELLCHECK_SKIP=': __.*is referenced but not assigned.*\[SC2154\]' +SHELLCHECKTMP=".shellcheck.tmp" + +# Move to top-level cdist-contrib directory. +cd $(dirname $0)/.. + +check () { + find type/ -type f $1 $2 -exec ${SHELLCHECKCMD} {} + | grep -v "${SHELLCHECK_SKIP}" > "${SHELLCHECKTMP}" + test ! -s "${SHELLCHECKTMP}" || { cat "${SHELLCHECKTMP}"; exit 1; } +} + +check -path "*/explorer/*" +check -path "*/files/*" +check -name manifest +check -name gencode-local +check -name gencode-remote