Skip to content

Finsys/jenkins-pipes-helloworld-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Example project with a Jenkinsfile for the Jenkins Pipes demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%