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