Summary
Highlights
Jenkins is an automation tool used to create and automate processes, including CI/CD pipelines. It is written in Java, open-source, and has been used for over 10 years. Jenkins is flexible due to its plugin-based architecture and can be used in cloud or on-premises environments.
Jenkins consists of a Jenkins server (the core) and Jenkins agents/nodes, which execute the automations. The server holds configurations, while agents handle execution. Agents can be VMs, Docker containers, or Kubernetes clusters.
The tutorial uses a virtual machine and a Kubernetes cluster in Azure, created using Terraform. The video provides the steps on how to install Java as a requirement and then Jenkins in an Ubuntu server.
Guide to install jenkins on a linux distribution using the steps available in the official documentation, including the usage of commands to add the key and repository, update packages and install Jenkins.
Accessing jenkins from the browser on the 8080 port, and retrieving the admin password to complete the installation using the tool's guided steps and sugested plugins.
Relevant plugins like Docker and Kubernetes plugins for use in the pipeline are installed from the 'Manage Jenkins' section.
Docker and Kubectl are installed on the VM. The current user also needs to be granted access to the docker group in order to run commands, and finally restart the Jenkins server.
A new pipeline is created in Jenkins, named 'guia-jenkins'. The pipeline script is set to be managed from a Git repository. The github repository URL is defined along with the 'main' branch option.
The tutorial describes the structure of a Jenkinsfile, using the pipeline > agent > stages > stage > steps structure and the usage of 'echo' commands for testing purposes.
Instead of using shell commands, the tutorial adds the usage of the docker plugin to build an image and tag it, using the build ID to make it dynamic.
Docker registry and credentials are created in Jenkins for Docker Hub using username and password. The dockerhub credential ID is used to push the image.
Kubernetes credentials are created in Jenkins using the kube config. The Cubectl image tag is versioned based on the environment build ID.
Github webhooks are setup to automatically trigger the execution of a pipeline when a commit is performed. The Github Webhook option is configured in Jenkins and linked to the correct URL.