Skip to content

Instantly share code, notes, and snippets.

@aheumaier
Created May 27, 2020 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aheumaier/008fa452cbddf24517b27861fc9b304e to your computer and use it in GitHub Desktop.
Save aheumaier/008fa452cbddf24517b27861fc9b304e to your computer and use it in GitHub Desktop.
Enable shellcheck in your Azure Pipelines
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
vmImage: 'ubuntu-18.04'
steps:
- checkout: self
submodules: true
- bash: |
echo "This checks for formatting and common bash errors. See wiki for error details and ignore options: https://github.com/koalaman/shellcheck/wiki/SC1000"
export scversion="stable"
wget -qO- "https://storage.googleapis.com/shellcheck/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
mv "shellcheck-${scversion}/shellcheck" .
rm -r "shellcheck-${scversion}"
./shellcheck ./scripts/*.sh
displayName: "Validate Scripts: Shellcheck"
@spoelstraethan
Copy link

The shellcheck archive URL has changed.

This checks for formatting and common bash errors. See wiki for error details and ignore options: https://github.com/koalaman/shellcheck/wiki/SC1000
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 540 100 540 0 0 910 0 --:--:-- --:--:-- --:--:-- 913
shellcheck-stable/
shellcheck-stable/LICENSE.txt
shellcheck-stable/shellcheck
shellcheck-stable/README.txt
You are downloading ShellCheck from an outdated URL!

Please update to the new URL:
https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz

For more information, see:
koalaman/shellcheck#1871

PS: Sorry for breaking your build :(
##[error]Bash exited with code '1'.

Also, it is possible to run the scripts on a windows-2019 or windows-latest host, just have to use curl instead of wget.

      - bash: |
          echo "This checks for formatting and common bash errors. See wiki for error details and ignore options: https://github.com/koalaman/shellcheck/wiki/SC1000"
          export scversion="stable"
          curl -L "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv
          mv "shellcheck-${scversion}/shellcheck" .
          rm -r "shellcheck-${scversion}"
          ./shellcheck ./*.sh
        displayName: "Validate Scripts: Shellcheck"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment