HUB
Sign inSign up
jenkinsfile-runner logo

marcellodesales/jenkinsfile-runner

By marcellodesales

•Updated over 8 years ago

Validate Jenkinsfile locally without the need to push to github before

Image
0

481

marcellodesales/jenkinsfile-runner repository overview

⁠Jenkinsfile Runner

Jenkinsfile Runner is an experiment to package Jenkins pipeline execution as a command line tool. The intend use cases include:

  • Use Jenkins in Function-as-a-Service context
  • Assist editing Jenkinsfile locally
  • Integration test shared libraries

⁠Usage

Say you have your Git repository checked out at ~/foo that contains Jenkinsfile and your source code. You can now run Jenkinsfile Runner like this:

$ cat ~/foo/Jenkinsfile
pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                echo 'Hello world!'
                sh 'ls -la'
            }
        }
    }
}

$ docker run -v $(pwd):/workspace marcellodesales/jenkinsfile-runner

⁠Steps with Docker

  • Steps with docker commands can be run as follows:
docker run -v $(pwd):/workspace   \
    -v /var/run/docker.sock:/var/run/docker.sock   \
    -v $(which docker):$(which docker) marcellodesales/jenkinsfile-runner

[Pipeline] [Validate Runtime] // stage
[Pipeline] [Validate Test] // stage
[Pipeline] [Validate Runtime] }
[Pipeline] [Validate Test] }
[Pipeline] // parallel
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build Test Image)
[Pipeline] script
[Pipeline] {
[Pipeline] }
[Pipeline] // script
[Pipeline] echo
Building docker image for tests from build stage null
[Pipeline] sh
[job] Running shell script
+ docker build -t tests:null -f Dockerfile --target builder .
Sending build context to Docker daemon  13.75MB
Step 1/9 : FROM maven:3.2.5-jdk-8 as builder
 ---> 95dd59c15f5d
Step 2/9 : MAINTAINER [email protected]
 ---> Using cache
 ---> e4edaeb48381
Step 3/9 : ADD ./pom.xml /opt/build/pom.xml
 ---> Using cache
 ---> 2ca95e0b276e
Step 4/9 : ADD ./settings.xml /opt/build/settings.xml
 ---> Using cache
Tag summary
Recent tags
Content type
Image
Digest
Size
564.8 MB
Last updated
over 8 years ago
docker pull marcellodesales/jenkinsfile-runner:latest