https://github.com/screwdriver-cd/template-validator
A tool used to validate a Job Template and Pipeline Template
https://github.com/screwdriver-cd/template-validator
screwdriver templates validation
Last synced: 6 months ago
JSON representation
A tool used to validate a Job Template and Pipeline Template
- Host: GitHub
- URL: https://github.com/screwdriver-cd/template-validator
- Owner: screwdriver-cd
- License: other
- Created: 2017-02-28T22:32:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-08-30T22:16:33.000Z (9 months ago)
- Last Synced: 2024-11-09T13:54:32.191Z (7 months ago)
- Topics: screwdriver, templates, validation
- Language: JavaScript
- Homepage: https://cd.screwdriver.cd/pipelines/88
- Size: 84 KB
- Stars: 0
- Watchers: 16
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Template Validator
[![Version][npm-image]][npm-url] ![Downloads][downloads-image] [![Build Status][status-image]][status-url] [![Open Issues][issues-image]][issues-url] ![License][license-image]> A module for validating and parsing a Screwdriver Template file
## yaml
```yaml
# example.yaml
name: tkyi/nodejs_main
version: 2.0.1
description: |
Template for a NodeJS main job. Installs the NPM module dependencies and executes
the test target.
maintainer: [email protected]
config:
image: node:4
steps:
- install: npm install
- test: npm test
environment:
NODE_ENV: production
secrets:
- NPM_TOKEN```
## Usage
```bash
$ npm install screwdriver-template-validator
```Validate in Node.js:
```javascript
const fs = require('fs'); // standard fs module
const validator = require('screwdriver-template-validator');// The "example.yaml" is the YAML described above
validator(fs.readFileSync('example.yaml'))
.then((templateData) => {
console.log(templateData);
});
```Output of the console.log():
```javascript
{
"name": "tkyi/nodejs_main",
"version": "2.0.1",
"description": "Template for a NodeJS main ...", //truncated for brevity
"maintainer": "[email protected]",
"config": {
"environment": {
"NODE_ENV": "production"
},
"image": "node:4",
"secrets": [
"NPM_TOKEN"
],
"steps": [{
"install": "npm install"
}, {
"test": "npm test"
}]
}
}
```## Testing
```bash
npm test
```## License
Code licensed under the BSD 3-Clause license. See LICENSE file for terms.
[npm-image]: https://img.shields.io/npm/v/screwdriver-template-validator.svg
[npm-url]: https://npmjs.org/package/screwdriver-template-validator
[downloads-image]: https://img.shields.io/npm/dt/screwdriver-template-validator.svg
[license-image]: https://img.shields.io/npm/l/screwdriver-template-validator.svg
[issues-image]: https://img.shields.io/github/issues/screwdriver-cd/template-validator.svg
[issues-url]: https://github.com/screwdriver-cd/template-validator/issues
[status-image]: https://cd.screwdriver.cd/pipelines/88/badge
[status-url]: https://cd.screwdriver.cd/pipelines/88