My road to Certified Jenkins Engineer
Yay I am Jenkins Certified now
WARNING: Some House Keeping task, before reading this blog
1: As everyone needs to sign NDA with Cloudbees, I can’t tell you the exact questions asked during the exam neither I have GB of memory, but I can give you the pointers what to expect in the exam.
2: As we all know devops technology updates everyday, so some of the stuff might not be relevant after a few days/weeks/months…
3: Please don’t ask for any exam dump or questions, that defeats the whole purpose of the exam.
Exam Preparation
- CloudBees University offers three free courses. AFAIK these three are the best resources to prepare for this exam.
- Linux Academy: Unfortunately, Linux Academy Certified Jenkins Course doesn’t cover topics in-depth. I will talk more about this in the gotchas section, but I really like Implementing CI/CD Pipeline course, which is more of hands-on.
- Jenkins World 2019 Video
Exam Pattern
- 60 multiple-choice questions in 90 minutes
- You must correctly answer 66% of the questions to pass the exam.
- Exam cost: $150
- The entire exam is divided into 4 main topics
For more info
Based on my experience you must need to know these three topics to clear this exam-
- Jenkins Plugins
- Artifacts
- DSL(Scripted and Declarative pipeline)
1: Difference between CI and CD?
Continuous Integration(CI)
- Is the frequent, automatic integration of code.
- Automatically tests all new and modified code with the master
Continuous Delivery(CD)
- Ensures that the code is always ready to be deployed.
- Manual approval is required to actually deploy the software to production.
NOTE: Please remember CD is the natural extension of CI.
2: Artifacts Question? (Surprisingly there were 6–8 questions related to Artifacts)
- In simplest word, it’s just a file produced as a result of a Jenkins build.
- As a default process, artifacts are stored where they are created so they are deleted when the workspace is wiped.
- To save the artifacts we need to achieve it.
- They store indefinitely unless you have a retention policy and should be deleted periodically.
Few points to remember-
- Archiving artifacts is the Post build action.
- For Pipeline step you need to use archiveArtifacts. Practice it using Snippet Generator.
- As well as using Blue Ocean Editor
stage('archiveartifacts') {
steps {
archiveArtifacts(artifacts: 'my-test.zip', fingerprint: true)
- Location of fingerprints(fingerprint is the MD5 checksum of an artifact)
/var/lib/jenkins/fingerprints
- How to enable it(Merely check the Fingerprint box when you create the archiving step)
NOTE: Jenkins uses Fingerprint to keep track of artifacts without any ambiguity.
- Once archived, an archive is attached to the build that produced it.
http://<jenkins url?/job/<your job name>/<build number>/artifact/
- Use of Copy Artifact Plugin(to take artifacts from one project(Pipeline run) and copy them to another project)
Reference
- To access the artifacts via Blue Ocean Editor
3: Scripted Pipeline vs Declarative Pipeline?
# Declarative Pipeline Examplepipeline {
agent anystages {
stage('Hello') {
steps {
echo 'Hello World'
}
}
}
}# Scripted Pipeline Examplenode {
def mvnHome
stage('Preparation') { // for display purposes
// Get some code from a GitHub repository
git 'https://github.com/jglick/simple-maven-project-with-tests.git'
// Get the Maven tool.
// ** NOTE: This 'M3' Maven tool must be configured
// ** in the global configuration.
mvnHome = tool 'M3'
}
stage('Build') {
// Run the maven build
withEnv(["MVN_HOME=$mvnHome"]) {
if (isUnix()) {
sh '"$MVN_HOME/bin/mvn" -Dmaven.test.failure.ignore clean package'
} else {
bat(/"%MVN_HOME%\bin\mvn" -Dmaven.test.failure.ignore clean package/)
}
}
}
stage('Results') {
junit '**/target/surefire-reports/TEST-*.xml'
archiveArtifacts 'target/*.jar'
}
}
Reference
4: Difference between Polling/Pull vs Pushing/Webhook
Pull/Polling: Setup an SCM Polling Trigger
Push/Webhook: Setup a hook from the repository to trigger job
When to use Push vs Pull
- Pull for when you don’t control the repository or polling is ok
- Push for when you need an immediate build or don’t want to waste resources on polling
NOTE: Polling is less efficient, both for your computers and for your people since you have to wait — on the order of minutes — for your builds to happen, instead of them happening essentially instantly.
Reference
5: Jenkinsfile
- Make sure you understand all the constructs in Jenkinsfile
pipeline {
agent any
stages {
stage('Build') {
steps {
//
}
}
stage('Test') {
steps {
//
}
}
stage('Deploy') {
steps {
//
}
}
}
}
agent: The agent
section specifies where the entire Pipeline or a specific stage, will execute in the Jenkins environment depending on where the agent
section is placed.
- Check the different parameter agent support
1: any
2: none
3: label
4: node
5: docker
6: Kubernetes
Stages
- Containing a sequence of one or more stage directives, the
stages
section is where the bulk of the "work" described by a Pipeline will be located.
Steps
- The
steps
section defines a series of one or more steps to be executed in a givenstage
directive.
NOTE: Exam will try to confuse you with words like step vs steps.
6: Different type of testing
Make sure you understand different types of testing
- Unit Tests: Test a small piece of code
- Integration Tests: Validate Integration between multiple sub-systems(eg: database)
- Smoke Tests: Validates basic functions of the system also known as Sanity Checking
- Functional Tests: Validates the normal behaviors against the expectations and requirements
- Acceptance Tests: Tests the full product from the perspective of the end user use cases.
7: Notification in Jenkins?
Understand the different kind of notification mechanism
- Slack(Slack Notification plugin)
- Email(Pay special attention to Email extension plugin)
8: Distributed Build
- How to configure Node(Worker)
- Remember this term Fungible which means Replaceable/Throwable i.e Agent can be substituted by any other agent.
- Minimum Requirement for Jenkins
1: Java8 or Java 11 is required(Java 9 and Java10 not supported)
Beware of operating system Limits
2: Maximum number of open files
3: Maximum number of forked processes
4: Network tuning (packet size, TCP timeouts)
9: Bunch of question related to plugins
- Make sure you go to each and every tab of the Plugin Manager page
- Pay special attention to these options, eg. under Installed Tab you have the option to Uninstall
- Under advanced tab, you have the option to configure proxy
- Upload Plugin
NOTE: Plugin extension is .hpi
10: Jenkins API
- How to use jenkins cli
java -jar jenkins-cli.jar -s <jenkins url> -auth username:<jenkins token> list-jobsjava -jar jenkins-cli.jar -s http://localhost:8080 -auth username:<jenkins token> build <build name>
11: Matrix Security/Project Based Security
Matrix Based Security: Maps user/groups to Jenkins actions
Project Based Matrix Authorization Strategy: It allows an access control list matrix to be defined for project. This feature is very useful when we want to give access to specific jobs to specific users
12: Installation wizard
- Make sure you remember initial setup screen
- You can skip user creation during installation by continuing as admin
- How to skip install wizard
/etc/sysconfig/jenkinsJENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -D jenkins.install.runSetupWizard=false"
13: Parameterized jobs
- You should know how to parameterized the build
14: Freestyle job
- Hands-on experience on how to create the Freestyle Job
15: Difference between the Folder and View
- Folder creates a container that stores nested items in it. Useful for grouping things together. Unlike view, which is just a filter, a folder creates a separate namespace so you can have multiple things of the same name as long as they are in different folders.
16: Global Libraries
- I will highly recommend watching this video.
17: MultiBranch Pipeline
- Please try to create and play with these pipelines.
18: Few questions related to GitHub Organization which I have no idea how it works with Jenkins
Gotchas
1: The exam I took was Certified Jenkins Engineer 2020, all the resources available on Internet talk about the Certified Jenkins Engineer 2018 exam.
2: Resources I listed above(exam preparation section), none of them covered topics in depth. I would like to divide the exam into three sections.
a: Straight forward question(Either you know the answer or not)
b: Question which required memorization(Definitely not my cup of tea)
c: In-depth question, you must need to know that topic in-depth to answer those question
3: After reading all the blogs, I thought it’s going to be an easy ride, but the exam was much tougher than my expectation, I barely crossed the passing line.
Final Words
- Key to clear this exam is your hands on experience
- Keep calm and write this exam
- Thanks for taking the time to read my blog, let me know in case if you have any questions.