2 Azure Pipelines
John Gardner edited this page 2021-12-22 15:27:26 +11:00

ShellCheck is installed by default on the ubuntu-latest host in Azure Pipelines. To see all installed software, consult the Azure documentation.

Caveats

Trying to run ShellCheck as usual within the pipeline will produce an error:

$ shellcheck myscripts/*.sh
myscripts/*.sh: myscripts/*.sh: openBinaryFile: does not exist (No such file or directory)

The recommended approach is to use find to search the files and pass a list of those to ShellCheck:

$ shellcheck $(find $(pwd)/myscripts/ -name "*.sh")

Example pipeline

Copy the following YAML to run ShellCheck in Azure Pipelines against all *.sh files in the current directory:

trigger:
- master

jobs:
- job: shellcheck
  displayName: ShellCheck
  pool:
    vmImage: 'ubuntu-latest'

  steps:
  - script: shellcheck $(find $(pwd) -name "*.sh")
    displayName: 'Running ShellCheck'