Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 2.07 KB

README.md

File metadata and controls

62 lines (46 loc) · 2.07 KB

Jenkins Pipes HelloWorld

A minimal and stupid "helloworld" example project for the Jenkins Pipes demo:

  • the Jenkinsfile describes HOW to build this project in Pipeline-DSL

How it works

This example will be built on our jenkins-pipes-infra because in jenkins-pipes-jobs we configured to build all master and feature/* branches of this repo.

The Jenkinsfile in here describes HOW this project is built, in terms of the individual stages that make up the build pipeline and what happens within them:

node {
  try {
    stage('checkout') {
      checkout scm
    }
    stage('prepare') {
      sh "git clean -fdx"
    }
    stage('compile') {
      echo "nothing to compile for hello.sh..."
    }
    stage('test') {
      sh "./test_hello.sh"
    }
    stage('package') {
      sh "tar -cvzf hello.tar.gz hello.sh"
    }
    stage('publish') {
      echo "uploading package..."
    }
  } finally {
    stage('cleanup') {
      echo "doing some cleanup..."
    }
  }
}

The master branch build should succeed:

image

The feature/make-it-fail branch shows how a build failure looks like:

image

Where to go from here?

Now that you have a minimal example running, here are some ideas on how to dig further:

  • go and explore the Pipeline-DSL and Steps Reference
  • add email notifications on success / failure
  • create a similar helloworld example in your favorite programming language
  • use node labels to run your builds on specific nodes only
  • try modeling more complex pipelines with parallel execution etc
  • ...