13 GitLab CI
Olliver Schinagl edited this page 2023-11-14 21:33:30 +01:00

Simple test job for GitLab (analyse testScript.sh):

test:
    image: koalaman/shellcheck-alpine:latest
    stage: test
    script: 
    - shellcheck testScript.sh

Here is a CI job that will lint all shell-scripts in a Git repository:

test:
    image: koalaman/shellcheck-alpine:latest
    stage: test
    before_script:
    - apk update
    - apk add git
    script:
    - git ls-files --exclude='*.sh' --ignored -c -z | xargs -0r shellcheck

If you want to create a JUnit XML report to see in the GitLab's UI, check the instructions here, additionally checkstyle can also be transformed back into text again for logging purposes.