Skip to content

Instantly share code, notes, and snippets.

@bbarman4u
Last active August 11, 2019 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbarman4u/ff6b29472b29ac42496b46ca6e0ee680 to your computer and use it in GitHub Desktop.
Save bbarman4u/ff6b29472b29ac42496b46ca6e0ee680 to your computer and use it in GitHub Desktop.
Certified Jenkins Engineer 2019 Preparation

Preparation Resources -

CLOUDBEES CJE Exam
www.ExamGator.com
Volume: 129 Questions + 9 Labs
Question: 1
What's not true about a build executor?
Choose the correct answer:
A. You can run many of them in parallel.
B. They can run on the master.
C. The default number of executors on a node is 4.
D. It runs projects dictated by Jenkins.
Answer: C
Explanation:
The default number of executors on a node is 2.
Question: 2
Which menu option do you select to add a pipeline or other project?
Choose the correct answer:
A. Manage Jenkins
B. My Views
C. New Item
D. Credentials
Answer: C
Explanation:
Selecting "New Item" from the dashboard will take you to menu where you can add a new project.
Question: 3
You have taken over a build environment where Jenkins is responsible for scanning for changes
made in a Git repository every hour and then applying that build to a few dozen web servers. As
part of that job, Jenkins also is responsible for completing some scripted performance-based
CLOUDBEES CJE Exam
www.ExamGator.com
tests and, depending on the defined results, marking the build as complete and notifying the
team OR rolling back the build, notifying the team, and marking it as failed. You notice that the
build itself is now taking longer than an hour to complete, which is affecting the push of new
changes on occasion. What changes could you make to your Jenkins environment to alleviate
the amount of time it takes to complete and test a build so that the hourly schedule is more
likely to be kept?
Choose the correct answer:
A. Create additional Jenkins Masters and deploy the job to each one. Schedule the job staggered
by 30 minutes on each one so that the additional master servers won’t be busy if the first job
runs long.
B. Add one or more slave nodes to the environment, this will allow us to deploy code to multiple
end points at one time. Break up the single job into multiple jobs so that each one can be
triggered by the successful completion of the previous job to eliminate scheduling problems on
beginning a new build in the event subsequent steps run longer than the intended time period.
C. Remove the performance testing from the build. Schedule performance testing as a separate
job 30 minutes after the build runs and trigger a rollback if the performance testing fails at this
point.
D. None of these
Answer: B
Explanation:
As the load of your Jenkins setup expands, you can distribute the burden by adding one or more
slave nodes.
Question: 4
Which answer best describes continuous delivery?
Choose the correct answer:
A. A software development discipline where software is built so that it can be released to
production at any time.
B. A software development practice where contributors are integrating their work very
frequently.
C. Building in 60 minutes or less.
D. A software development discipline where software is released continuously as part of an
CLOUDBEES CJE Exam
Leading the way in IT testing and certification tools, www.ExamGator.com
automated pipeline.
Answer: A
Explanation:
Continuous delivery is an extension of continuous integration. It means that the software CAN
be released at any time.
Question: 5
Over the last six months, a large number of projects have been added to Jenkins. You have been
asked by your manager to do some cleanup by creating some list views. How would you go about
creating these list views?
Choose the correct answer:
A. Explicitly set projects to view
B. Using a regular expression pattern
C. Explicitly set recursively in sub-folders
D. All of these
Answer: D
Explanation:
You can add projects to list views with all of these options.
Question: 6
You've just become the administrator for the Jenkins server, and the feedback you've received
from the users is they're having trouble locating their jobs to run them. You've determined that
folders are the most logical solution and wish to move the jobs into the new folders you've
created. How would you accomplish this?
Choose the correct answer:
A. Click existing item; in the item view page, select "move" on the left panel; select target folder.
B. Hover and click arrow on existing item, choose "move", select target folder.
C. For new items, click folder; in the folder view, select new item; it will automatically be added to
that folder.
CLOUDBEES CJE Exam
www.ExamGator.com
D. All of these
Answer: D
Explanation:
All of these options are ways to add projects to folders.
Question: 7
You need to grant permissions, via matrix-based security, to run a specific command in a
Jenkins pipeline. The project parameters will not allow you to create a specific user to run this
task, and you have no relevant groups. Which of the following is an option?
Choose the correct answer:
A. Create a group, add an existing user to the task, and grant permissions to that group
B. Set permissions in Jenkins to allow anonymous users to run the command
C. Change the workflow to require an existing user to run the task, and assign permissions to
that user.
D. Either creating a group or reassigning the user will work.
Answer: B
Explanation:
You can set permissions for anonymous users with matrix-based security. Since this requires
the least impact on existing workflows, it's the best solution.
Question: 8
What's the SDLC?
Choose the correct answer:
A. Super Digital Life Chain
B. Sloan Digital Legal Conference
C. Software Development Life Cycle
D. None of these
Answer: C
CLOUDBEES CJE Exam
www.ExamGator.com
Explanation:
The SDLC is contained in CI/CD concepts.
Question: 9
You are working on a project that will build a Docker image. When the job completes it needs to
trigger a build to deploy a container to your development environment for integration testing.
How would you go about triggering the second build?
Choose the correct answer:
A. Both "Triggered by another project" and the "Parameterized Trigger Plugin"
B. In the downstream build, you can select "Triggered by another project"
C. You could use the Parameterized Trigger Plugin to trigger from an upstream project.
D. Use the run() function passing the downstream projects name from within an upstream
project build step.
Answer: A
Explanation:
Both are options for triggering upstream and downstream projects.
Question: 10
Which answer best describes continuous deployment?
Choose the correct answer:
A. A software development practice where contributors are integrating their work very
frequently.
B. A software development discipline where software is built so that it can be released to
production at any time.
C. Building in 60 minutes or less.
D. A software development discipline where software is released continuously as part of an
automated pipeline.
Answer: D
Explanation:
CLOUDBEES CJE Exam
www.ExamGator.com
Continuous deployment is an extension of continuous integration and continuous delivery. It's
important to know the difference. Deployment indicated that the code is continuously deployed
to production.
Question: 11
What interval syntax could I use to trigger a build every day?
Choose the correct answer:
A. @daily
B. 30 12 * * *
C. H H * * *
D. All of these
Answer: D
Question: 12
Where is the initialAdminPassword stored on the system?
Choose the correct answer:
A. /var/lib/jenkins/secrets/
B. /usr/lib/jenkins/password/
C. /opt/jenkins/
D. /tmp/Jenkins/
Answer: A
Explanation:
The initialAdminPassword file, referenced in the Install Wizard, is stored in
/var/lib/jenkins/secrets/.
Question: 13
How can you organize Jenkins projects (or jobs)?
Choose the correct answer:
CLOUDBEES CJE Exam
www.ExamGator.com
A. Folders and views
B. Relational databases
C. Folders
D. Views
Answer: A
Explanation:
Projects can be organized in either folders or views.
Question: 14
What type of agent nodes are there?
Choose the correct answer:
A. JNLP
B. SSH
C. Docker
D. All of the others
Answer: D
Explanation:
All of these are common types of agents.
Question: 15
What directive do you use for a declarative pipeline?
Choose the correct answer:
A. config {..}
B. pipeline {..}
C. project {..}
D. test {..}
CLOUDBEES CJE Exam
www.ExamGator.com
Answer: B
Explanation:
Declarative pipelines use the "pipeline" directive.
Question: 16
What is Ant?
Choose the correct answer:
A. An acceptance testing platform
B. A Java build tool
C. A unit testing tool
D. None of these
Answer: B
Explanation:
Ant is a lightweight build platform for Java projects.
Question: 17
Which is an example of a Jenkins plugin?
Choose the correct answer:
A. Pipeline
B. Parameterized Trigger
C. Credentials
D. All of the others
Answer: D
Explanation:
There are hundreds of Jenkins plugins available, and they can provide a multitude of
functionality.
CLOUDBEES CJE Exam
www.ExamGator.com
Question: 18
What is an SCM?
Choose the correct answer:
A. Source Code (or Control) Management
B. Structural Code Machine
C. Super Core Management
D. None of the above
Answer: A
Explanation:
The use of source code management is a central tenant of continuous integration.
Question: 19
How can you trigger a downstream build?
Choose the correct answer:
A. In the downstream build, you can select "Triggered by another project."
B. You could use the Parameterized Trigger Plugin to trigger from an upstream project.
C. Use the run() function passing the downstream projects name from within an upstream
project build step.
D. Both "Triggered by another project" and the "Parameterized Trigger Plugin"
Answer: D
Explanation:
Both of these options will work. "Triggered by another project" is configured by the downstream
project, and the "Parameterized Trigger Plugin" is invoked from the upstream project. You'd only
want to use one of these options.
Question: 20
You have now been given charge over an existing Jenkins system install that was previously
started by a colleague who is gone on a business trip. He left it in the install wizard phase.
Unfortunately, your colleague did not note the initialAdminPassword. Where on the system
CLOUDBEES CJE Exam
www.ExamGator.com
would this be located?
Choose the correct answer:
A. /var/lib/jenkins/secrets/InitialAdminPassword
B. /home/jenkins/secrets/InitialAdminPassword
C. /var/lib/jenkins/workspace/secrets/InitialAdminPassword
D. /var/lib/jenkins/adminPassword
Answer: A
Explanation:
You'll find the initialAdminPassword that is asked for during the install wizard at this path.
Question: 21
You're a DevOps engineer in charge of your team's Jenkins server. You have a particular stage in
your pipeline that you want to run on a particular build node. You have to have Apache installed
on this node. Assuming the node has been appropriately labeled, "apache", how would you
ensure this stage ran on that node?
Choose the correct answer:
A. apache agent
B. agent { label 'apache' }
C. 'apache' { agent }
D. agent( 'apache' )
Answer: B
Explanation:
Example: stage('deploy') { agent { label 'apache' } steps { sh "if ![ -d
'/var/www/html/rectangles/all/${env.BRANCH_NAME}' ]; then mkdir
/var/www/html/rectangles/all/${env.BRANCH_NAME}; fi" sh "cp
dist/rectangle_${env.MAJOR_VERSION}.${env.BUILD_NUMBER}.jar
/var/www/html/rectangles/all/${env.BRANCH_NAME}/" } }
Question: 22
CLOUDBEES CJE Exam
www.ExamGator.com
You would take 100% then subtract (1%*2), thus 98%.
Question: 129
What is Jenkins auditing?
Choose the correct answer:
A. Ensuring licenses have been paid for and allocated appropriately
B. Tracking system resources
C. Reviewing Build Failure rate
D. Tracking who did what on your Jenkins server
Answer: D
Explanation:
Auditing is the practice of determining what a user has been doing in Jenkins.
Lab1. Install a Jenkins Master and Prerequisites
Task:
1. Download the appropriate Java JDK version from the Oracle website. For this course, we use
jdk-8u121.
2. Copy the package from your local environment to the target server.
3. Install and configure Java (jdk-8u121).
4. Install Jenkins (version 2.19.4).
5. Complete the Install Wizard.
Solution:
Prerequisite Install
1. Go to:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. Download the appropriate Java JDK version from the Oracle website. For this course, we use
jdk-8u121.
3. Copy the package from your local environment to the target server.
. Below is an example using scp:
CLOUDBEES CJE Exam
scp jdk-8u121-linux-x64.rpm user@your-server:/home/user/
4. Install the jdk package.
rpm -Uvh jdk-8u121-linux-x64.rpm
5. Set up alternatives for Java:
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 200000
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000
Note: Check out Terry’s nugget on this for more detail: “Setting Local and Global Java
Environment Variables”
6. Set JAVA_HOME environmental variable in rc.local.
vi /etc/rc.local
export JAVA_HOME=”/usr/java/latest”
Jenkins Install
1. Add the Jenkins repo to your yum sources on the CentOS node.
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.r
epo
2. Import the Jenkins rpm signing key.
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
3. Install the Jenkins package.
. We will be using version 2.19.4, which is the target version for the certification test.
yum install -y jenkins-2.19.4-1.1
4. Check for services running on 8080 before starting the Jenkins service.
netstat -tulpn | grep 8080
5. If nothing is running on 8080, go ahead and start the service via systemctl.
systemctl start jenkins
CLOUDBEES CJE Exam
www.ExamGator.com
6. Also, enable the Jenkins service so it starts on system startup.
systemctl enable jenkins
7. Check again for services running on port 8080.
. There will be a slight delay, so we’ll use watch to wait for the signal.
watch n=1 "netstat -tulpn | grep 8080"
. Use Ctrl-C to break the watch when the service is shown to be running on 8080.
8. Visit the web GUI at:
http://your-server-fqdn:8080/
9. You’ll be prompted for the initialAdminPassword which is located in
/var/lib/jenkins/secrets/initialAdminPassword on the system being configured. You’ll want to
cat that and copy and paste it into the browser.
cat /var/lib/jenkins/secrets/initialAdminPassword
10. Paste the password into Install Wizard.
11. Choose “Install Suggested Plugins.”
12. Set admin settings, user, password, etc.
13. Press “Enter.”
14. Click “Start Using Jenkins.”
15. Now you have your Jenkins Master up and running!
Lab2. Configuring Matrix-Based Security
Prerequisites
. Must have a configured Jenkins Master
Basic Instructions
1. Add a developer user.
2. Set up Matrix-based security in “Configure Global Security.”
3. Give all permissions to the admin user.
4. Give read permissions to Anonymous.
5. Give all permissions except “delete” and “administer” to the developer user.
CLOUDBEES CJE Exam
www.ExamGator.com
Solution:
1. Go to the Jenkins Dashboard:
http://your-server:8080
2. Click Manage Jenkins.
3. Click Manage Users.
4. Click Create User.
5. Create the developer user.
6. Click back to Manage Jenkins.
7. Click Configure Global Security.
8. Check Enable Security.
9. Select Jenkins’ own user database.
10. Place a check mark next to Allow users to sign up.
11. Select Matrix-based Security.
12. Select the admin user and check all the permissions.
13. Set “Read” permissions for “Anonymous.”
14. Set the developer user and select all permissions except Administer and “Delete”
permissions.
15. Click Save.
Lab3. Add a Jenkins Slave
Prerequisites
. Spin up another lab instance for a slave.
. Have an RSA key pair generated for the Jenkins user on the Master.
Basic Instructions
1. Set up Java (jdk-8u121) like you did on the master previously.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. Add a Jenkins user and home to the slave node.
3. Coply the Jenkins Master pub key to the Slave node's authorized keys.
4. Add a node in the Jenkins Dashboard.
5. Set the appropriate configuration items, including the node’s FQDN.
6. Use “Private key” “From Jenkins Master” for credentials.
7. Ensure the agent is available for use from the Node view. (No red x.)

Cron Format -

(1) minute, hour, dayOfMonth, month, dayOfWeek (2) For dayofWeek, 0 is Sunday and 7 is Saturday (3) Can use H (or H/2 etc) for minute column to use a hash based on the job name to distribute jobs so don't all start at the top of the hour. (4) Also support, @yearly, @annually, @monthly, @weekly, @daily, @hourly and @midnight (5) @Midnight means between midnight and one am since uses hash to distribute

OPTIONS DIRECTIVE

Examples:

skipStagesAfterUnstable — Pipeline does not try to run other stages after one stage (such as a test stage) is marked unstable disableConcurrentBuilds — Useful when concurrent builds might simultaneously access shared resources retry — Retry the Pipeline the specified number of time if it fails buildDiscarder - Use the buildDiscarder option to define the number of items to keep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment