Jenkins for the Crazy (using Jenkinsfiles) part 1

One of the craziest CI/CD tools out there is Jenkins. Now the reason why this tool is by far the most popular tool out there is that of how you can bend and break it to do things that it was never intended for. I have worked in organizations that have used Jenkins ask a CI tool, A Scheduler (cron box), and advance vault (credential injections), Build system etc. one the less know uses of jenkins is the Jenkinsfile usage. now, this was introduced in Jenkins 1.X as a plugin using and was formally introduced as the Jenkins workflow. in Jenkins 2.0 it was renamed to the jenkins pipeline.

so what is a jenkins file.
In its basic form is a Groovy script that is executed as several steps thereby creating a more intelligent dev CI/CD system.

So here is a simple jenkins file

pipeline {
    agent none 
    stages {
        stage('Example Build') {
            agent { docker 'maven:3-alpine' } 
            steps {
                echo 'Hello, Maven'
                sh 'mvn --version'
            }
        }
        stage('Example Test') {
            agent { docker 'openjdk:8-jre' } 
            steps {
                echo 'Hello, JDK'
                sh 'java -version'
            }
        }
    }