Skip to content

devatherock/drone-yaml-validator

Repository files navigation

CircleCI Version Coverage Status Codacy Badge Docker Pulls - Drone Docker Image Size License: MIT

yaml-validator

CI plugin to validate yaml files

Usage

Docker

docker run --rm \
  -e PLUGIN_DEBUG=true \
  -v path/to/yamls:/work \
  -w /work \
  devatherock/drone-yaml-validator:latest

CI

The following parameters can be set to configure the plugin.

  • debug - Flag to enable debug logs. Optional, by default, debug logs are disabled

  • continue_on_error - Flag to indicate if processing should continue when an invalid file is encountered. Optional, defaults to true

  • search_path - If specified, only YAMLs present in this path will be validated

  • allow_duplicate_keys - Flag to indicate if YAML files with duplicate keys should be considered valid. Optional, defaults to false

  • ignore_unknown_tags - Flag to indicate if YAML files with unknown tags should be considered valid. Optional, defaults to true

vela

steps:
  - name: yaml_validator
    ruleset:
      branch: master
      event: push
    image: devatherock/drone-yaml-validator:latest
    parameters:
      debug: false
      continue_on_error: true
      allow_duplicate_keys: false
      ignore_unknown_tags: true

drone

steps:
  - name: yaml_validator
    image: devatherock/drone-yaml-validator:latest
    settings:
      debug: false
      continue_on_error: true
      allow_duplicate_keys: false
      ignore_unknown_tags: true

CircleCI

version: 2.1
jobs:
  validate_yamls:
    docker:
      - image: devatherock/drone-yaml-validator:latest
    working_directory: ~/my-repo
    environment:
      PARAMETER_DEBUG: false
      PARAMETER_CONTINUE_ON_ERROR: true
      PARAMETER_ALLOW_DUPLICATE_KEYS: false
      PARAMETER_IGNORE_UNKNOWN_TAGS: true
    steps:
      - checkout
      - run: sh /scripts/entry-point.sh

Tests

To test the latest plugin image, run the below command

make functional-test