diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af82d73e48aced496e568978c15093fa9cd1f993..f9b11ab3fd53be85797359169b218ecfbe38a34d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,6 +10,7 @@ include: - '/gci-templates/job/ansible-syntax-check.yml' - '/gci-templates/job/molecule.yml' - '/gci-templates/job/bats.yml' + - '/gci-templates/job/bash-lint.yml' ansible-syntax-check: variables: @@ -21,4 +22,8 @@ molecule: bats: variables: - working_directory: "test/bats" \ No newline at end of file + working_directory: "test/bash" + +bash-lint: + variables: + working_directory: "test/bash" \ No newline at end of file diff --git a/gci-templates/job/bash-lint.yml b/gci-templates/job/bash-lint.yml new file mode 100644 index 0000000000000000000000000000000000000000..bdc0e501f741959070f2b752aa2fa96d7ef7e37f --- /dev/null +++ b/gci-templates/job/bash-lint.yml @@ -0,0 +1,21 @@ +bash-lint: + extends: .base_tpl + stage: lint + variables: + files_to_lint: "" + script: | + cd $working_directory + for script in $(find . -name "*.sh"); do + echo "----> lint script $script" + xargs docker run --rm \ + -v "$(pwd):/mnt/" \ + -v "/tmp:/tmp_ro":ro \ + koalaman/shellcheck $script + done + for script in $files_to_lint; do + echo "----> lint script $script" + xargs docker run --rm \ + -v "$(pwd):/mnt/" \ + -v "/tmp:/tmp_ro":ro \ + koalaman/shellcheck $script + done \ No newline at end of file diff --git a/test/bats/test/test.bats b/test/bash/test/test.bats similarity index 100% rename from test/bats/test/test.bats rename to test/bash/test/test.bats diff --git a/test/bats/true.sh b/test/bash/true.sh similarity index 100% rename from test/bats/true.sh rename to test/bash/true.sh