diff --git a/Azure-Pipelines.md b/Azure-Pipelines.md new file mode 100644 index 0000000..796cbec --- /dev/null +++ b/Azure-Pipelines.md @@ -0,0 +1,36 @@ +ShellCheck is installed by default on the `ubuntu-latest` host in Azure Pipelines. To see all installed software, consult the [Azure documentation](https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#use-a-microsoft-hosted-agent). + + +## Caveats + +Trying to run ShellCheck as usual within the pipeline will produce an error: + +```console +$ 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: +```console +$ 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: + +```yaml +trigger: +- master + +jobs: +- job: shellcheck + displayName: ShellCheck + pool: + vmImage: 'ubuntu-latest' + + steps: + - script: shellcheck $(find $(pwd) -name "*.sh") + displayName: 'Running ShellCheck' +``` \ No newline at end of file