Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devatherock/drone-yaml-validator

CI plugin to validate yaml files
https://github.com/devatherock/drone-yaml-validator

ci ci-cd ci-plugin circleci docker drone-ci plugin vela yaml yaml-validator yml

Last synced: about 2 months ago
JSON representation

CI plugin to validate yaml files

Awesome Lists containing this project

README

        

[![CircleCI](https://circleci.com/gh/devatherock/drone-yaml-validator.svg?style=svg)](https://circleci.com/gh/devatherock/drone-yaml-validator)
[![Version](https://img.shields.io/docker/v/devatherock/drone-yaml-validator?sort=semver)](https://hub.docker.com/r/devatherock/drone-yaml-validator/)
[![Coverage Status](https://coveralls.io/repos/github/devatherock/drone-yaml-validator/badge.svg?branch=master)](https://coveralls.io/github/devatherock/drone-yaml-validator?branch=master)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/eee25e47d4104a20894d2a0f8f35d2fd)](https://www.codacy.com/gh/devatherock/drone-yaml-validator/dashboard?utm_source=github.com&utm_medium=referral&utm_content=devatherock/drone-yaml-validator&utm_campaign=Badge_Grade)
[![Docker Pulls - Drone](https://img.shields.io/docker/pulls/devatherock/drone-yaml-validator.svg)](https://hub.docker.com/r/devatherock/drone-yaml-validator/)
[![Docker Image Size](https://img.shields.io/docker/image-size/devatherock/drone-yaml-validator.svg?sort=date)](https://hub.docker.com/r/devatherock/drone-yaml-validator/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# yaml-validator
CI plugin to validate yaml files

## Usage
### Docker

```shell script
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

```yaml
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

```yaml
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

```yaml
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

```shell
make functional-test
```