To know the environment variables
http://<<system-name>>:8080/env-vars.html
http://localhost:8080/env-vars.html
To know the API of Jenkins
http://localhost:8080/api/
Basic Jenkins example
https://www.theserverside.com/tutorial/Create-a-Jenkins-build-job-A-CI-tutorial-for-beginners
To invoke a build on a project we need to form the REST API as below
JENKINS_URL/job/JOB_NAME/build
Path :
http://192.168.43.103:8080/job/FirstSample/build
For more details in term of build refer below
https://wiki.jenkins.io/display/JENKINS/Remote+access+API
Jenkins hand book
Jenkins Shared library
Sudoers file when using sudo command
Lock and Milestone
to get the changes from last build to current build
https://support.cloudbees.com/hc/en-us/articles/217630098-How-to-access-Changelogs-in-a-Pipeline-Job-
checkout([$class: 'TeamFoundationServerScm',
credentialsConfigurer: [$class: 'AutomaticCredentialsConfigurer'],
projectPath: '$/STG',
serverUrl: TFS_SERVER,
workspaceName: '${JOB_NAME}-${NODE_NAME}'])
script{
println("currentBuild : "+currentBuild);
def changedFiles = []
def changeLogSets = currentBuild.changeSets
for (entries in changeLogSets) {
for (entry in entries) {
for (file in entry.affectedFiles) {
echo "Found changed file: ${file.path}"
changedFiles += "${file.path}"
}
}
}
}
https://stackoverflow.com/questions/6260383/how-to-get-list-of-changed-files-since-last-build-in-jenkins-hudson
https://stackoverflow.com/questions/38084806/how-to-get-the-changes-since-the-last-successful-build-in-jenkins-pipeline
https://support.cloudbees.com/hc/en-us/articles/217630098-How-to-access-Changelogs-in-a-Pipeline-Job-
Jenkins environment variables
https://code-maven.com/jenkins-pipeline-environment-variables
****************************************************************
We can now communicate Linux and windows using powershell
Install powershell in linux
https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7.1
https://en.opensuse.org/PowerShell
Install the following plugins as well verify before installing the plugins
Powershell
envinject
************************************************************
Jenkins shared library
https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Jenkins-Shared-Library-GitHub-Example-Pipeline
https://www.codurance.com/publications/2019/05/25/private-jenkins-shared-libraries
https://devopscube.com/jenkins-shared-library-tutorial/
*****************************************************************
To start slave
https://pravinrajput.wordpress.com/2016/08/02/configure-jenkins-slave-and-connect-to-master/
https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+agent+machines+on+Windows
*****************************************************
Parallel, stash , unstash
how to avoid @2 or temp for projects
***************************
Variables usage from Jenkins pipeline to shellscript
for (i in [ 'a', 'b', 'c' ]) {
echo i
sh """
echo "from shell i=${i}"
"""
sh '''
echo "from shell i='''+i+''' check"
'''
sh '''
echo "from shell i='''+"${i}"+''' check"
'''
}
https://stackoverflow.com/questions/41539076/how-to-pass-variables-from-jenkinsfile-to-shell-command
https://stackoverflow.com/questions/40323490/passing-variable-to-bash-script-in-a-jenkins-pipeline-job
*********************************************************
how to set environment variable in scripted pipeline
https://stackoverflow.com/questions/55123079/how-to-set-environment-variables-in-a-jenkins-scripted-pipeline