Announcing the Blue Ocean beta, Declarative Pipeline and Pipeline Editor

    At Jenkins World on Wednesday 14th of September, the Jenkins project was happy to introduce the beta release of Blue Ocean. Blue Ocean is the new user experience for Jenkins, built from the ground up to take advantage of Jenkins Pipeline. It is an entire rethink of the the way that modern developers will use Jenkins.

    Blue Ocean is available today via the Jenkins Update Center for Jenkins users running 2.7.1 and above.

    Get the beta

    Just search for BlueOcean beta in the Update Center, install it, browse to the dashboard, and then click the Try BlueOcean UI button on the dashboard.

    Whats included?

    Back in April we open sourced Blue Ocean and shared our vision with the community. We’re very happy that all the things we showed you then have shipped in the beta (software projects run on time?!).

    For a refresher on Blue Ocean, watch this short video:

    Declarative Pipeline

    We have heard from the community about the usability of Jenkins Pipeline. Much of the feedback we received was to a desire to configure Pipelines rather than script them, and to make it easy for beginners to get started with their first Pipeline.

    This is how Declarative Pipeline was born. We’ve introduced a new method whereby you declare how you want your Pipeline to look rather than using Pipeline Script - it’s configuration rather than code.

    Here’s a small example of a Declarative Pipeline for nodejs that runs the whole Pipeline inside a Docker container:

    // Declarative //
    pipeline {
      agent docker:'node:6.3'
      stages {
        stage('build') {
          sh 'npm --version'
          sh 'npm install'
        }
        stage ('test') {
          sh 'npm test'
        }
      }
    }
    
    // Script //
    node('docker') {
      docker.image('node:6.3').inside {
        stage('build') {
          sh 'npm --version'
          sh 'npm install'
        }
    
        stage('test') {
          sh 'npm test'
        }
      }
    }

    Docker support in Declarative Pipeline allows you to version your application code, Jenkins Pipeline configuration, and the environment where your pipeline will run, all in a single repository. It’s a crazy powerful combination.

    Declarative Pipeline introduces the postBuild section that makes it easy to run things conditionally at the end of your Pipeline without the complexity of the try…​ catch of Pipeline script.

    // Declarative //
    postBuild {
      always {
        sh 'echo "This will always run"'
      }
      success {
        sh 'echo "This will run only if successful"'
      }
      failure {
        sh 'echo "This will run only if failed"'
      }
      unstable {
        sh 'echo "This will run only if the run was marked as unstable"'
      }
      changed {
        sh 'echo "This will run only if the state of the Pipeline has changed"'
        sh 'echo "For example, the Pipeline was previously failing but is now successful"'
        sh 'echo "... or the other way around :)"'
      }
    }
    
    
    // Script //
    node('docker') {
      try {
        stage('build') {
          /* .. snip .. */
        }
        stage('test') {
          /* .. snip .. */
        }
    
        sh 'echo "This will run only if successful"'
      }
      catch (exc) {
        if (currentBuild.result == 'UNSTABLE') {
          sh 'echo "This will run only if the run was marked as unstable"'
        }
        if (currentBuild.result == 'FAILURE') {
          sh 'echo "This will run only if failed"'
        }
      }
      finally {
        sh 'echo "This will always run"'
      }
    }

    And there is so much more!

    If you have the Blue Ocean beta installed you already have Declarative Pipeline. While Declarative Pipeline is still alpha at the moment, we do encourage you to follow our getting started guide, give us feedback on the Jenkins Users mailing list or file bugs against the 'pipeline-model-definition' component in JIRA.

    Introducing the Pipeline Editor

    The Pipeline Editor is a graphical user interface that gives Jenkins users the simplest way yet to get started with creating Pipelines in Jenkins. It will also save a lot of time for intermediate and advanced Jenkins users as a way to author Pipelines.

    When you build your Pipeline in the Editor and click the save button, the editor will commit a new Jenkinsfile back to your repository in the form of the new Declarative Pipeline. When you want to edit again, Jenkins will read it from your repository exactly how you saw it previously.

    The Pipeline Editor is a work in progress and should arrive in a beta release soon.

    Personalized dashboard

    Thank you

    Thanks for reading our news from Jenkins World and be sure to check the blog for regular updates!

    I’d also like to thank our amazing community for their feedback and support as we change the way software teams around the world use Jenkins. We couldn’t do this without you.

    About the Author
    James Dumay
    James Dumay

    This author has no biography defined. See social media links referenced below.