From 2186ce2dc8c379d08ac47bb512c601956a5e22a6 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Fri, 27 Sep 2019 00:06:01 +0200 Subject: [PATCH] CI Jenkinsfile: add parallel task for shellcheck lint --- contrib/ci/Jenkinsfile | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/contrib/ci/Jenkinsfile b/contrib/ci/Jenkinsfile index 4ab6300d..d62464f8 100644 --- a/contrib/ci/Jenkinsfile +++ b/contrib/ci/Jenkinsfile @@ -1,3 +1,22 @@ +def lualint() { + sh 'luacheck package scripts targets' +} + +def shelllint() { + sh 'find -not \( -path './*.git/*' -prune \) -not \( -path './package/*' -prune \) -not \( -path './scripts/*' -prune \) -type f -exec bash -c 'if echo $1 | grep -qE ".*\.sh$" || head -n1 $1 | grep -qE "^#.*(sh|bash|dash|ksh)$"; then shellcheck -f gcc $1; fi' _ {} \;' + sh 'find package -type f -exec bash -c 'if echo $1 | grep -qE ".*\.sh$" || head -n1 $1 | grep -qE "^#.*(sh|bash|dash|ksh)$"; then shellcheck -x -f gcc -s sh -eSC2039,SC1091,SC2155,SC2034 $1; fi' _ {} \;' + sh 'find scripts -type f -exec bash -c 'if echo $1 | grep -qE ".*\.sh$" || head -n1 $1 | grep -qE "^#.*(sh|bash|dash|ksh)$"; then shellcheck -f gcc -x -e SC2154,SC1090,SC2181,SC2155,SC2148,SC2034,SC2148 $1; fi' _ {} \;' +} + +run_lint_set = [ + "task1": { + lualint() + }, + "task2": { + shelllint() + } +] + pipeline { agent { label 'gluon-docker' } environment { @@ -8,7 +27,9 @@ pipeline { stages { stage('lint') { steps { - sh 'luacheck package scripts targets' + script { + parallel(run_lint_set) + } } } stage('docs') {