Skip to content

radziejewicz/shellcheck-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Shellcheck Docker

Shellcheck is a static analysis tool for bash scripts: https://www.shellcheck.net

Docker build

1. Build Docker container

docker build --rm -t aljandor/shellcheck-docker:latest .

2. Run Docker container

docker run --rm -it -v `pwd`:/scripts shl shellcheck /scripts/script.sh

3. Example usage in bitbucket-pipelines.yml

pipelines:
  branches:
    master:    
      - step:        
          name: Run Shellcheck linter
          image: aljandor/shellcheck-docker:latest
          script:
            - shellcheck -V
            - find ./scripts -type f -name "*.sh" | sort -u | xargs shellcheck -e SC2034 --color=always

4. Example usage in GitLab CI

shellcheck:
  stage: test
  image: aljandor/shellcheck-docker:latest
  only:
    changes:
      - "**/*.bash"
  before_script:
    - shellcheck -V
  script:
    - find ./scripts -type f -name "*.sh" | sort -u | xargs shellcheck -e SC2034 --color=always
  tags:
    - docker

5. Example usage in GitHub Actions

name: Run Shellcheck linter

on:
  push:
    branches: [ master ]

jobs:
  run_shellcheck_linter:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Run Shellcheck linter
        uses: aljandor/shellcheck-docker:latest
        with:
            cli-args: "--color=always ./scripts"

6. Example usage in Drone CI

---
kind: pipeline
type: docker
name: default

steps:
- name: Run Shellcheck linter
  image: aljandor/shellcheck-docker:latest
  commands:
  - shellcheck --version
  - find . -type f -name "*.sh" | sort -u | xargs shellcheck -e SC2034 -e SC1090 --color=always

trigger:
  event:
  - push

CI/CD to Dockerhub

https://hub.docker.com/r/aljandor/shellcheck-docker

Dockerhub is integrated with the repository, it automatically starts the build image from the master branch: aljandor/shellcheck-docker:latest

TODO

  • tags for shellcheck version

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •