Thursday, 30 December 2021

Top 20 Jenkins Interview Questions and Answers 2022 for SDET - DevOps - Automation QA? Refer for Getting pro in Jenkins.

 


Below are the common interview q&a : Jenkins interview questions for devops and Jenkins interview questions for testers. Jenkins is the most use ci cd tool, so if you are preaparing ci cd pipeline interview questions and answer do refer the post.

11. What are the two major components which are integrated with Jenkins?

Ans: Below are the two major components:
         - Build tools like Maven script.
         - Version control system or source code repository like Git repository.

Pipeline Script Fundamentals

12. Can you write a pipeline script where you can call your Maven with 
automation suite?
node {
stage ('SCM checkout'){
git "https://gitlab.com/mbabilo/experitest"
}
stage ('Build'){
dir("comtest") {
sh "mvn clean install"
}
dir("comtest/target") {
sh "java -jar com.test-1.0-SNAPSHOT.jar"
}
}
}

13. How to control the flow in Jenkins?

Ans: Jenkins flow can be controlled using Stage, Lock and Milestone.

  • stage - the stage step remains but is now focused on grouping steps and providing boundaries for Pipeline segments.

  • lock - the lock step throttles the number of concurrent builds in a defined section of the Pipeline.

  • milestone - the milestone step automatically discards builds that will finish out of order and become stale.

14. How to create parameterized jobs in Jenkins? VERY IMP

15. How to resolve the invalid service logon credentials in windows?

Ans: When installing a service to run under a domain user account, the account must have the right to logon as a service. This logon permission applies strictly to the local computer and must be granted in the Local Security Policy.

Perform the following steps below to edit the Local Security Policy of the computer you want to define the ‘logon as a service’ permission:

  1. Logon to the computer with administrative privileges.

  2. Open the Administrative Tools and open the Local Security Policy

  3. Expand Local Policy and click on User Rights Assignment

  4. In the right pane, right-click Log on as a service and select properties.

  5. Click on the Add User or Group… button to add the new user.

  6. In the Select Users or Groups dialogue, find the user you wish to enter and click OK

  7. Click OK in the Log on as a service Properties to save changes.

After completing the steps above, try logging in again with the added user.


16. How to send email notification in Jenkins using groovy script? VERY IMP

ANS: Click Here For Answer with Groovy Script Steps


17.  What is the ideal memory requirements for the controller in Jenkins?
 
Ans: The amount of memory Jenkins needs is largely dependent on multiple factors, which is why the RAM allotted for it can range from 200 MB for a small installation to 70+ GB for a single and massive Jenkins controller. However, you should be able to estimate the RAM required based on your project build needs.

Each build node connection will take 2-3 threads, which equals about 2 MB or more of memory. You will also need to factor in CPU overhead for Jenkins if there are a lot of users who will be accessing the Jenkins user interface.

18. How you can Fail a build in JenkinsFile?

Ans:  By using error step from pipeline DSL we can be able to Fail a build, like : error("Build failed due to ....")

error: Error signal

Signals an error. Useful if you want to conditionally abort some part of your program. You can also just throw new Exception(), but this step will avoid printing a stack trace.

19. What is Pipeline, Node and Stage in Jenkins?

ANS: Click Here for All Pipeline Concepts and Terminology

20. How to catch error in jenkins file and set build result to failure?

Ans: By using catchError.

If the body throws an exception, mark the build as a failure, but nonetheless continue to execute the Pipeline from the statement following the catchError step. The behavior of the step when an exception is thrown can be configured to print a message, set a build result other than failure, change the stage result, or ignore certain kinds of exceptions that are used to interrupt the build.

node {
    catchError {
        sh 'might fail'
    }
    step([$class: 'Mailer', recipients: 'admin@somewhere'])
}
To explore more, please refer: catchError()
Click Here :   DevOps Related Posts

21. How to resolve out of memory error in JENKINS?

Ans: There are two types of OutOfMemoryError messages that you might encounter while a Jenkins job runs:
  • java.lang.OutOfMemoryError: Heap space – this means that you need to increase the amount of heap space allocated to Jenkins when the daemon starts.
  • java.lang.OutOfMemoryError: PermGen space – this means you need to increase the amount of generation space allocated to store Java object metadata. Increasing the value of the -Xmx parameter will have no affect on this error.

On Ubuntu 12.04 LTS, uncomment the JAVA_ARGS setting on line ten of /etc/default/jenkins:

  • To add more Java heap space, increase the value of the -Xmx Java parameter. That sets the maximum size of the memory allocation pool (the garbage collected heap).
  • To add more PermGen space, add the parameter XX:MaxPermSize=512m (replace 512 with something else if you want more. The permanent generation heap holds meta information about user classes.

To learn more, please refer EXPLORE JENKINS ERROR


Suggested Post:

ALL ABOUT AUTOMATION FRAMEWORK DESIGN

Java Interview question Set-1:

SET-01 1-10

Java Interview question Set-2:

SET-02 10-20

Java Interview question Set-3:

SET-03 21-30

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions


No comments:

Post a Comment

All Time Popular Posts

Most Featured Post

Introduction to Web Testing with Playwright

  Introduction to Web Testing with Playwright 📌  Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl 📌  YouTube channel:  https://lnkd.in/gGUG...