Jenkins
Getting started with Essentials of Jenkins.
Jobs
Create a first job of type Pipeline.




For this first demo, we can make use of the sample Pipeline script by clicking try sample Pipeline.









Builds
With Parameters
pipeline {
agent any
parameters {
string(name: 'Greeting', defaultValue: 'Hello', description: 'How should I greet the world?')
}
stages {
stage('Example') {
steps {
echo "${params.Greeting} World!"
}
}
}
}



After the first build is completed, look at the new option, Build with Parameters.



With multiple Steps
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'echo "Hello Jenkins"'
sh '''
echo "Example to show multiple scripts"
ls -la
'''
sh 'date'
}
}
}
}




Build with a Shell Script
pipeline {
agent any
stages {
stage('Deploy') {
steps {
timeout(time: 1, unit: 'MINUTES') {
sh 'for n in `seq 1 10`; do echo $n; sleep 1; done'
}
timeout(time: 1, unit: 'MINUTES') {
sh 'for n in `seq 1 50`; do echo $n; sleep 1; done'
}
}
}
}
}





Manage Jenkins



Credentials





Free-Style Project
Let us create a simple Freestyle project to ping an IP address.








Click on Build Now.


Click on Build number #1 to view the Console Output.

Build Trend
Build the same project again, and verify the Build trend.

