Merge branch 'policies-and-ci' into 'master'

Rolling-release policy, CI, new type requirements (shellcheck + manpage)

See merge request ungleich-public/cdist-contrib!2
This commit is contained in:
fnux 2020-05-08 11:22:01 +02:00
commit c136d33db4
6 changed files with 68 additions and 5 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.shellcheck.tmp

14
.gitlab-ci.yml Normal file
View File

@ -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

View File

@ -1,5 +1,3 @@
# cdist-contrib chsangelog # cdist-contrib changes
## 2020-0?-??: 0.?.? (Not released yet) * 2020-04-28: New type: __find_exec (Ander Punnar)
* New type: __find_exec (Ander Punnar)

View File

@ -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 maintained in cdist itself or were not accepted in code cdist but could still
be useful. 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 ## 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 [cdistconfig]: https://www.cdi.st/manual/latest/cdist-configuration.html
[cdistmatrix]: https://matrix.to/#/#cdist:ungleich.ch [cdistmatrix]: https://matrix.to/#/#cdist:ungleich.ch
[cdistmattermost]: https://chat.ungleich.ch/ungleich/channels/cdist [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.

15
scripts/run-manpage-checks.sh Executable file
View File

@ -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

21
scripts/run-shellcheck.sh Executable file
View File

@ -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