Skip to content

screwdriver-cd/command-validator

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

command-validator

Version Downloads Build Status Open Issues Dependency Status License

A module for validating a Screwdriver Command file

YAML

# example.yaml
namespace: git
name: clone
version: '1.1'
description: SD Command for git clone with habitat.
maintainer: example@gmail.com
format: habitat
habitat:
    mode: remote
    package: core/git/2.14.1
    command:  git clone

Usage

$ npm install screwdriver-command-validator

Validate in Node.js:

const fs = require('fs');  // standard fs module
const validator = require('screwdriver-command-validator');

// The "example.yaml" is the YAML described above
validator(fs.readFileSync('example.yaml'))
    .then((commandData) => {
        console.log(commandData);
    });

Output of the console.log():

config: {
    description: 'SD Command for git clone with habitat.',
    maintainer: 'example@gmail.com',
    name: 'git',
    namespace: 'clone',
    version: '1.0',
    format: 'habitat',
    habitat: {
        mode: 'remote',
        package: 'core/git/2.14.1',
        command: 'git clone'
    }
}

Validate in CLI:

$ ./node_modules/.bin/command-validate -h

  Usage: validate [options]


  Options:

    -j, --json         output with JSON
    -f, --file [name]  screwdriver command file (default: ./sd-command.yaml)
    -h, --help         output usage information

$ ./node_modules/.bin/command-validate -j
{"valid":true}

Testing

npm test

License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.