The Jenkins server can run anywhere that Java runs.
Jenkins creates packages for many platforms:
The primary way to interact with the server is through its Web interface, e.g. http://localhost:8080.
It's best practice in Jenkins to use systems other than the server in order to execute tasks.
The original method of defining execution via Jenkins is the Job.
Jobs are broken up into several components:
job("$baseFolder/vagrant-upstream-images") {
description('builds centos, fedora, etc. vagrant images for subman development')
label('rhsm-packer')
scm {
github('candlepin/packer', 'master')
}
wrappers {
colorizeOutput()
credentialsBinding {
string('VAGRANT_CLOUD_TOKEN', 'VAGRANT_CLOUD_TOKEN')
}
}
steps {
shell(readFileFromWorkspace('src/resources/subman-vagrant-images.sh'))
}
}
The preferred, modern way of automating with Jenkins is by implementing Jenkins pipelines.
It was once common practice to create software pipelines by chaining Jenkins jobs together, but now pipelines are a first-class concept in Jenkins.
pipeline {
options { buildDiscarder(logRotator(numToKeepStr: '50')) }
agent {
label 'rhsm'
}
stages {
stage('Clean') {
steps {
sh './gradlew --no-daemon clean'
}
}
stage('Build') {
steps {
sh './gradlew --no-daemon assemble'
}
}
/* more stages omitted */
}
post {
always {
archiveArtifacts artifacts: 'build/reports/checkstyle/*.html'
junit 'build/test-results/**/*.xml'
}
}
}
Jenkinsfile
, optional, but recommended¶Use Jenkins to automate building and releasing your products:
Thanks for attending! Questions?