Overview of Jenkins and Apache Groovy
Jenkins is an open-source automation tool written in Java for continuous integration purposes. Jenkins gives the complete view of the application's software development life cycle, which starts from version control and goes till the packaging. Advantages of Using Jenkins:- Plug-in Availability
- Easily Configurable
- Jenkins supports the ability to build cloud-native applications.
- Platform Independent
Jenkins Pipeline Execution Flow
The following points tell how a Jenkins Pipeline executes: 1. This pipeline starts from the version control system, which maintains the code followed by continuous integration. 2. The further proceeding includes the build phase, compile phase, testing, and review. After continuous integration, we have continuous delivery, which handles the application's delivery to the test servers. 3. After this, last but not least is continuous deployment, which is responsible for deploying the application to the production phase. The delivery flexibility associated with the pipeline as code is beneficial as it allows the client to make their own decisions on when and how to deliver/deploy.Implementing Pipeline as Code
1. Initialize the Jenkins after installing Jenkins into your Linux environment.systemctl
Start Jenkins.systemctl
Enable Jenkins.
systemctl
start docker. 3. As we also want to add groovy in our environment, add the Jenkins' groovy plugin. 4. Now move forward to the localhost:8180
to get access into the Jenkins where you will be asked for a username and password. 5. Now, your main task is to create jobs, including building the project, testing the project, and then deploying the project, and for every step we take, we have to create a separate job for that.
- You can select the jobs from the dashboard and add them to the pipeline.
- But before adding them to the pipeline, you have to attach a version control system or repository with it, for example, git.
- Go to the configuration of jobs and go-to source code managing tab and select git.
- You have to follow this same process for every job.
- Add a source code.
- Go to configuration, move to the build tab and select the execute shell from the drop-down list and move to the command shell where you will add scripts.
- Each job has scripts, be it the build phase, test phase, and the deploy phase.
- In the test job, you have to add the docker container, while in the case of the deploy job, you have to cross-check whether the image is already created or no.
- Jenkins uses maven for installing packages that handle taking care of all dependencies.
mvn install
(will install the dependencies).
- Use post-build actions from the configuration of each job and add the next job associated with every post.
- Use
‘+’
, after choosing for view name for providing the pipeline name. - Use various options available and also mention the job should be the first job. (Select apply after that) and after that RUN.
localhost:8180
A Comprehensive Approach
Jenkins offers easy configurations as per the continuous integration requirements and continuous delivery and automates the software development process. To discover more about Jenkins, we advise taking the subsequent steps -- Learn more about Building Interactive Dashboard with "Jenkins"
- Get an insight about ASP.NET Core Application on Azure using "Jenkins Azure Pipeline"