Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

screwdriver-executor-base

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

screwdriver-executor-base

Base class defining the interface for executor implementations

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
decreased by-66.14%
Maintainers
2
Weekly downloads
 
Created
Source

executor base

Version Downloads Build Status Open Issues Dependency Status License

Base class defining the interface for executor implementations

An executor is an engine that is capable of running a set of docker containers together.

i.e. Jenkins, Kubernetes, ECS, Mesos

The intention of an executor is to run the launch script defined in the screwdriver job-tools docker container, which is mounted to a container defined by a screwdriver task

This means:

  1. Mounting the job-tools container as a volume to $MOUNT_POINT on another container
  2. Running the launch script as the entry point to the task container
$MOUNT_POINT/launch ${git_org} ${git_repo} ${git_branch} ${job_name}

Usage

npm install screwdriver-executor-base

Interface

Start
Required Parameters
ParameterTypeDescription
configObjectConfiguration Object
config.buildIdStringThe unique ID for a build
config.jobIdStringThe unique ID for a job
config.pipelineIdStringThe unique ID for a pipeline
config.containerStringContainer for the build to run in
config.scmUrlStringThe scmUrl to checkout
callbackFunctionCallback for when task has been created
Expected Outcome

The start function is expected to create a task in the execution engine.

Expected Callback
  1. When an error occurs, callback(err)
  2. When the task is created correctly, callback(null)
Stream
Required Parameters
ParameterTypeDescription
configObjectConfiguration Object
config.buildIdStringThe unique ID for a build
callbackFunctionCallback for when stream has been created
Expected Outcome

The stream function is expected to return a readable stream upon success

Expected Callback
  1. When an error occurs, callback(err)
  2. When the stream is created correctly, callback(null, stream)

Extending

To make use of the validation function for start, stop and stream, you need to override the _start, _stop, _stream methods.

class MyExecutor extends Executor {
    // Implement the interface
    _start(config, callback) {
        if (config.buildId) {
            // do stuff here...
            return callback(null);
        }

        return process.nextTick(() => {
            callback(new Error('Error starting executor'));
        });
    }
}

const executor = new MyExecutor({});
executor.start({
    buildId: '4b8d9b530d2e5e297b4f470d5b0a6e1310d29c5e',
    jobId: '50dc14f719cdc2c9cb1fb0e49dd2acc4cf6189a0',
    pipelineId: 'ccc49349d3cffbd12ea9e3d41521480b4aa5de5f',
    container: 'node:4',
    scmUrl: 'git@github.com:screwdriver-cd/data-model.git#master'
}, (err) => {
    // do something...
});

Testing

npm test

License

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

Keywords

FAQs

Package last updated on 15 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc