Advertisement
satishfrontenddev5

Untitled

Feb 25th, 2024
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. **Q&A for Jenkins Interview Preparation**
  2.  
  3. **1. What is Jenkins?**
  4. - Jenkins is a self-contained, open-source automation server.
  5. - It automates tasks related to building, testing, and delivering/deploying software.
  6. - It can be installed via native system packages, Docker, or standalone with a Java Runtime Environment.
  7.  
  8. **2. What are Continuous Integration (CI), Continuous Delivery (CD), and Continuous Deployment (CD)?**
  9. - CI: Integrating code changes into the main codebase continuously to ensure readiness for building, testing, and deployment.
  10. - CD: Delivering integrated changes into a specific environment, usually through a manual release process.
  11. - Continuous Deployment: Automatically deploying integrated changes into the target environment after successful quality checks.
  12.  
  13. **3. What are common use cases for Jenkins?**
  14. - Software build jobs
  15. - Testing jobs (sanity/smoke/CI/regression)
  16. - Web/data scraping tasks
  17. - Code coverage measurement
  18. - General-purpose automation
  19. - Reverse engineering
  20. - Key decoding
  21.  
  22. **4. What are the ways to install Jenkins?**
  23. - Native system package manager (e.g., apt, brew)
  24. - Docker
  25. - Kubernetes (via Helm chart)
  26. - Standalone (requires Java Runtime Environment)
  27.  
  28. **5. What is a Jenkins job?**
  29. - A fundamental unit of work in Jenkins, representing tasks like software builds, automation, or test execution.
  30. - Can be of types: freestyle project, multi-configuration project, pipeline project, multi-branch project, etc.
  31.  
  32. **6. What is a Jenkins Pipeline?**
  33. - A sequence of steps controlled by defined logic in Jenkins.
  34. - Orchestrates long-running activities across multiple build agents.
  35. - Suitable for building pipelines or organizing complex activities.
  36.  
  37. **7. What are the types of Jenkins pipelines?**
  38. - Declarative Pipeline
  39. - Scripted Pipeline
  40.  
  41. **8. Explain Jenkins Multibranch Pipeline.**
  42. - Creates a set of pipeline projects based on detected branches in a single SCM repository.
  43. - Useful for configuring pipelines for different branches (e.g., production code branches).
  44.  
  45. **9. How do you store credentials securely in Jenkins?**
  46. - Use the Credentials plugin to store credentials securely.
  47. - Supports various types of credentials like username/password, SSH keys, AWS credentials, etc.
  48.  
  49. **10. How can we temporarily stop a scheduled job from being executed?**
  50. - Disable the job from the job details page.
  51. - Enable it back to resume scheduled executions.
  52. - Alternatively, delete the job if not required permanently.
  53.  
  54. **11. What are the ways to trigger a Jenkins Job/Pipeline?**
  55. - API request
  56. - Manual trigger from Jenkins web application
  57. - Jenkins CLI
  58. - Time-based scheduled triggers (cron job)
  59. - Event-based triggers (SCM actions, webhooks)
  60. - Upstream/downstream triggers by other Jenkins jobs
  61.  
  62. **12. What is Jenkins Build Cause?**
  63. - A text attribute representing what triggered a job's build.
  64. - Can be Jenkins user, timer, upstream job, etc.
  65.  
  66. **13. How does Jenkins know when to execute a scheduled job/pipeline and how is it triggered?**
  67. - Jenkins master has cron entries set up for the jobs.
  68. - As scheduled time approaches, Jenkins commands agents to execute the job.
  69.  
  70. **14. What credential types are supported by Jenkins?**
  71. - Secret text
  72. - Username and password
  73. - Secret file
  74. - SSH username with a private key
  75. - Certificate (PKCS#12)
  76. - Docker host certificate authentication credentials
  77.  
  78. **15. What are the Scopes of Jenkins Credentials?**
  79. - Global: Usable across all Jenkins jobs
  80. - System: Used by Jenkins core functionalities and some plugins
  81.  
  82. **16. What is a Jenkins Shared Library and how is it useful?**
  83. - Set of code common for multiple pipeline jobs, maintained separately.
  84. - Improves maintenance, modularity, and readability of pipeline code.
  85.  
  86. **17. How can Jenkins jobs be Triggered/Stopped/Controlled programmatically?**
  87. - Using Jenkins Remote Access API
  88. - CURL commands for triggering builds, stopping/aborting builds, enabling/disabling jobs, etc.
  89.  
  90. **18. How to get the Jenkins version programmatically in Jobs/Pipelines or nodes other than master?**
  91. - Check the 'X-Jenkins' response header from the top-level page or API paths.
  92.  
  93. **19. What happens when a Jenkins agent is offline and what is the best practice in that situation?**
  94. - Jobs tied to offline agents wait indefinitely.
  95. - Best practice: Tie jobs to a group of nodes/agents using a label to reduce wait time, add more nodes/agents if needed.
  96.  
  97. **20. What is the Blue Ocean?**
  98. - Redefined user experience for Jenkins, focusing on Pipeline projects.
  99. - Features sophisticated visualizations, pipeline editor, personalization, pinpoint precision, and native integration for branch and pull requests.
  100.  
  101. **21. What is the Jenkins User Content service?**
  102. - Mechanism to serve static resources like images and stylesheets from the $JENKINS_HOME/userContent folder.
  103.  
  104. **22. How is continuous integration achieved using Jenkins?**
  105. - Developer makes a change in a feature/dev branch.
  106. - SCM plugins detect events and trigger build/test jobs in Jenkins.
  107. - CD/CD tools take integrated changes forward based on test results.
  108.  
  109. **23. What is Artifact Archival & how to do it in Pipelines?**
  110. - Archiving exportable/storable results of a job build.
  111. - Configured using the Copy Artifact Plugin in pipelines.
  112.  
  113. **24. How to configure inclusions & exclusions in Artifacts Archival?**
  114. - Use patterns for including and excluding files/directories.
  115.  
  116. **25. How can we share information between different build steps or stages in a Jenkins Job?**
  117. - Use files, database entries, environment variables, or post-build actions to share information.
  118.  
  119. **26. How is code coverage measured/tracked using Jenkins in a CI environment?**
  120. - Using language-specific code coverage plugins or tools like JaCoCo, CodeCov, Sonarqube, etc.
  121.  
  122. **27. What are the default Environment Variables by Jenkins & How to introduce custom environment variables?**
  123. - Default variables include BRANCH_NAME, BUILD_NUMBER, WORKSPACE, etc.
  124. - Custom variables can be introduced via Jenkinsfile or pipeline script.
  125.  
  126. **28. How can a job configuration be reset to an earlier version/state?**
  127. - Use Job Config History to review and revert job configurations from the history of changes.
  128.  
  129. **29. How to do Global Tools Configuration in Jenkins?**
  130. - Install tool plugins, configure global tools in Jenkins, and use them in jobs/pipelines.
  131.  
  132. **30. How to create & use a Shared Library in Jenkins?**
  133. - Maintain shared library code in SCM repository.
  134. - Configure global shared library in Jenkins.
  135. - Include and use shared library methods in pipeline code.
  136.  
  137. **31. How to install a Custom Jenkins Plugin or a Version of Plugin Not available in Jenkins Update Center?**
  138. - Use Jenkins CLI, web UI, or manually place .hpi file in the $JENKINS_HOME/plugins directory.
  139.  
  140. **32. How to download the Console log for a particular Jenkins build programmatically?**
  141. - Use Jenkins CLI console command to retrieve console output for a specific build.
  142.  
  143. **33. What is Jenkins Remote Access API?**
  144. - Provides remote access to Jenkins functionalities in XML, JSON, or Python formats.
  145.  
  146. **34. What is In-process Script Approval and how it works?**
  147. - Allows administrators to approve unsafe methods used in user-provided scripts to improve security.
  148. - Appears in "Manage Jenkins" for administrators to make decisions.
  149.  
  150. **35. Can we monitor Jenkins using common Observability tools?**
  151. - Yes,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement