creates setup and teardown steps for builds
npm install screwdriver-build-bookend
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;
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) => { ... });
npm test
Code licensed under the BSD 3-Clause license. See LICENSE file for terms.