Git Product home page Git Product logo

simple-build-for-pipeline-plugin's Introduction

Jenkinsfile - making the easy things easy

This plugin aims to build out a DSL for Jenkinfile (pipeline as code) to make the easy things easy, without taking away any of the power of Jenkins Pipeline for when you really need it.

Build Status

Example

This example runs a very simple build with some environment variables. This would work with pipeline-as-code and branch source.

This should be familiar and declarative-ish looking to anyone familiar with tools like .travis.yml, however, it is implemented as a pipeline DSL (so you can do all the other powerful pipeline things).

simpleBuild {
 
    env = [
        FOO : 42,
        BAR : "YASS"
    ]
    

    before_script = "echo before"
    script = 'echo after $FOO'
    
    
    notifications = [
        email : "[email protected]"    
    ]
    
    
}

It will do the right thing, and send emails when things break.

Optional things: You can specify a machine label, and/or a docker image to run builds under:

machine = "hi-speed"
docker_image = "java:1.9"

See src/main/resources for the actual DSL used for the details.

To play with this:

mvn hpi:run

or build and install it to your Jenkins (it is just a plugin). You can also commit the simpleBuild.groovy to the Jenkins workflowLibs repo (if you know what I mean, if not... then ignore me!).

Secondary aim

The secondary aim of this plugin is to show how plain pipeline-script can be used easily to make a plugin to allow you to share the DSL. The only code you need to care about is the src/main/resources/dslsimpleBuild.groovy and SimpleBuildDSL.java - that is all.

TODO

  • More scenario tests of the permutations
  • Use named stages (?) if it makes sense.
  • Support all the same _script semantics as https://github.com/jenkinsci/simple-travis-runner-plugin/blob/pure-script-approach/README.md (eg after_failure, after_success etc to happen on the appropriate events and around error handling).
  • Allow execution of all script entries even if one fails (?)
  • Time out individual script entries.
  • Add in simple matrix (a la travis)
  • Add in branch inclusions/exclusions (what branches to run on or not)
  • Allow parallel scripts (across nodes?? or a whole block of parallel?)
  • Implement auto-generation of script and friends for (some) languages? Debatable whether to do this.
  • Decide whether to keep emulating Travis's behavior of ignore after_* steps' failures when setting build status.
  • allow block for simple user input
  • More notification types (slack, for example)
  • Change email to only be on failure or return to health (convention, Yo).
  • Retries of scripts if specified
  • May need to configure docker to work under a node() block...

simple-build-for-pipeline-plugin's People

Contributors

michaelneale 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.