Catalog / Jenkins Cheatsheet
Jenkins Cheatsheet
A comprehensive cheat sheet covering essential Jenkins concepts, commands, and configurations for DevOps and Cloud environments.
Core Concepts & Setup
Jenkins Fundamentals
Continuous Integration (CI): Automating the building, testing, and integration of code changes. Continuous Delivery (CD): Automating the release of validated code to a repository. Continuous Deployment: Automating the release of code directly into production. |
Pipeline: A user-defined model of a CD pipeline. Code that defines the entire build, test, and deployment process. Node: A machine which is part of the Jenkins environment and is capable of executing Pipelines. Agent: Defines where the Pipeline will execute. Can be a specific node, a Docker container, or any available agent. |
Installation (Ubuntu)
Install Java (OpenJDK 8 or 11) |
|
Add Jenkins repository key |
|
Add Jenkins repository to apt |
|
Install Jenkins |
|
Start Jenkins service |
|
Check Jenkins status |
|
Initial Setup
|
Pipeline as Code
Declarative Pipeline Syntax
|
Pipeline Directives
|
Specifies where the entire Pipeline or a specific stage will execute. Options: |
|
Contains a sequence of one or more stage directives. |
|
Contains a sequence of one or more steps to be executed in a stage. |
|
Defines environment variables to be used within the Pipeline. |
|
Configures Pipeline options, such as |
|
Defines parameters that can be passed to the Pipeline when it’s triggered. |
Common Steps
|
|
|
|
|
Plugins & Integrations
Popular Plugins
Git Plugin |
Integrates with Git repositories for source code management. |
Maven Integration Plugin |
Provides seamless integration with Maven projects. |
Docker Plugin |
Enables building and managing Docker containers. |
Cobertura Plugin |
Generates code coverage reports. |
Slack Notification Plugin |
Sends notifications to Slack channels. |
Email Extension Plugin |
Provides enhanced email notification capabilities. |
Kubernetes Plugin |
Allows Jenkins to dynamically provision and manage build agents in a Kubernetes cluster. |
Integration with Cloud Platforms
Jenkins can be integrated with various cloud platforms such as AWS, Azure, and Google Cloud using plugins or CLI tools. Example (AWS): Use the AWS CLI plugin to interact with AWS services like S3, EC2, and ECS within your Jenkins pipelines. |
Credentials Management
Use Jenkins’ built-in credentials management to securely store and manage secrets, passwords, and API keys. Access credentials in your pipelines using the
|
Advanced Configuration
Jenkins CLI
The Jenkins CLI allows you to interact with Jenkins from the command line. Usage:
Example:
|
Security Considerations
|
Distributed Builds
Configure Jenkins to distribute builds across multiple nodes (agents) to improve build performance and scalability.
|