Code Monkey home page Code Monkey logo

build-bookend's Introduction

Build Bookend

Version Downloads Build Status Open Issues Dependency Status License

creates setup and teardown steps for builds

Usage

npm install screwdriver-build-bookend

Using the bookend interface

Extend the bookend interface in this module. You will need to define getSetupCommand and getTeardownCommand to return the commands needed to execute and return these in a promise.

const { BookendInterface } = require('screwdriver-build-bookend');

class MyBookend extends BookendInterface {
    getSetupCommand() {
        return Promise.resolve('echo "hello world"');
    }
    getTeardownCommand() {
        return Promise.resolve('echo "goodbye world"');
    }
}

module.exports = MyBookend;

Getting final bookend commands

Use the Bookend module to combine a set of BookendInterface based modules into single set of setup and teardown commands. See more examples in the tests.

const SampleBookend = require('sd-sample-bookend');
const { Bookend } = require('screwdriver-build-bookend');
const b = new Bookend(
    // Provide a set of default instantiated plugins
    { 'sample': new SampleBookend() },
    /*
        Provide a list of plugins to use for setup, by name or with a config object
        You can also choose to include your own modules with a config, these will be initialized for you with the given config.
        The following config will use the default sample plugin, then the users my-bookend plugin
     */
    [ 'sample', { name: 'my-bookend', config: { foo: 'bar' } }],
    // Provide a list of plugins for teardown. format is the same as setup
    [ 'sample', { name: 'my-bookend', config: { foo: 'bar' } }]
);

// Get the setup commands [ { name: 'setup-sample', command: '...' }, { name: 'setup-my-bookend', command: '...' } ] given the models and configuration for the pipeline, job, and build
b.getSetupCommands({ pipeline, job, build }).then((commands) => { ... });

// Get the teardown command [ { name: 'teardown-sample', command: '...' }, { name: 'teardown-my-bookend', command: '...' } ] given the models and configuration for the pipeline, job, and build
b.getTeardownCommands({ pipeline, job, build }).then((commands) => { ... });

Testing

npm test

License

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

build-bookend's People

Contributors

d2lam avatar fenrirunbound avatar jerryzhang222 avatar minzcmu avatar petey avatar stjohnjohnson avatar tkyi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.