Giter VIP home page Giter VIP logo

versionone.javascript.pipelinebuilder's Introduction

VersionOne.PipelineBuilder Codeship

Use this JavaScript library to build Continuum Pipeline Definitions with code!

Continuum pipeline definitions are declarative in nature providing a configuration as code approach. Some people prefer their imperative programming languages and want to write code over configuration.

Meet PipelineBuilder.

Consider the example where a pipeline conditionally sets the status of a work item in your favorite ALM tool. The pipeline may look something like this:

{
    name: "pipeline as code",
    description: "description",
    phases: [
        {
            name: "phase name",
            stages: [
                {
                    name: "stage name",
                    steps: [
                        {
                            name: "",
                            plugin: {
                                args: {
                                    action: {
                                        args: {
                                            current_status: "None",
                                            instance_name: "VersionOne",
                                            number: "D-1234",
                                            status: "Ready"
                                        },
                                        label: 'VersionOne - Set Workitem Status',
                                        method: 'set_workitem_status',
                                        module: 'main',
                                        name: 'v1plugin'
                                    },
                                    else_action: {
                                        args: {
                                            current_status: "None",
                                            instance_name: "VersionOne",
                                            number: "D-1234",
                                            status: "Done"
                                        },
                                        label: 'VersionOne - Set Workitem Status',
                                        method: 'set_workitem_status',
                                        module: 'main',
                                        name: 'v1plugin'
                                    },
                                    expression: "epic.isClosed"
                                },
                                label: 'Utility - Conditional',
                                method: 'conditional',
                                module: 'utility',
                                name: 'utility'
                            },
                            when: "always"
                        }
                    ]
                }
            ]
        }
    ]
}

This pipeline expressed conditional logic in a declarative way, which is very different from what we would see in most programming languages. The aid of a graphical user interface may have helped us reason about some of the details of this pipeline, However some may want to express this same pipeline with code. Let's do it!

import { create_stage, create_phase, create_pipeline, plugins } from './../src/pipeline';
const { utility, v1 } = plugins;

const set_to_ready = v1.set_workitem_status('S-12345', 'Ready', 'None', 'VersionOne', 'always');
const set_to_done = v1.set_workitem_status('S-12345', 'Done', 'None', 'VersionOne', 'always');

const pipeline = create_pipeline('pipeline as code', 'description', [
    create_phase('phase name', [
        create_stage('stage name', [
            utility.conditional('epic.isClosed', set_to_ready, set_to_done, 'always')
        ])
    ])
]);

##Development Install Node.js

####Install Node Modules

npm install

####Run Linter

npm run lint

####Run Tests

npm t

versionone.javascript.pipelinebuilder's People

Contributors

walkerrandolphsmith avatar

Watchers

 avatar  avatar  avatar

Forkers

versionone

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.