Skip to content

🐳 Dockerized yamllint with proper versioning, a linter for YAML files.

Notifications You must be signed in to change notification settings

PeterDaveHello/docker-yamllint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-yamllint

Build Status Docker Hub pulls

Docker Hub badge

Dockerized yamllint with various versions, easy to use and easy to integrate with CI.

Table of Contents

Usage

Command line

Use latest version

docker run --rm -v $PATH_TO_YAML:/yaml peterdavehello/yamllint yamllint YAML_FILE.yml

# Please replace "$PATH_TO_YAML" with your custom path,
# and replace "YAML_FILE.yml" with your real yaml file filename.

Use specific version

Just like above, but you can specify version of yamllint, for example:

docker run --rm -v $PATH_TO_YAML:/yaml peterdavehello/yamllint:1.16.0 yamllint YAML_FILE.yml

# Please replace "1.16.0" with the version number you want.
# Don't forget to replace "$PATH_TO_YAML" & "YAML_FILE.yml".

Continuous Integration (CI)

Travis CI

Enable Docker service in your .travis.yml:

services:
  - docker

And use the same command in the scripts part as the command line mentions, for example:

services:
  - docker

scripts:
  - docker run --rm -v $TRAVIS_BUILD_DIR:/yaml peterdavehello/yamllint:1.16.0 yamllint .travis.yml

This will lint the Travis CI config file .travis.yml

GitLab CI

Add this block to your .gitlab-ci.yml:

yamllint:
  stage: lint
  variables:
    yamllint_version: "1.16.0"
  image: peterdavehello/yamllint:$yamllint_version
  only:
    changes:
      - "**/*.yml"
      - "**/*.yaml"
  script:
    - find . -name "*.yml" -o -name "*.yaml" | xargs -n 1 yamllint

Replace "1.16.0" with the version you want to use, you can also use "latest" for the very new version.

Build

Build command, you need to specify a valid yamllint version argument to YAMLLINT_VERSION:

docker build --build-arg YAMLLINT_VERSION="1.16.0" -t docker-yamllint .

# Replace "docker-yamllint" with the preferred image name

You can find a valid version in the release history on PyPI, or just poke the API to retrieve more details.