mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created Azure Pipelines (markdown)
36
Azure-Pipelines.md
Normal file
36
Azure-Pipelines.md
Normal file
@@ -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'
|
||||
```
|
Reference in New Issue
Block a user