Module III
Module III
following similar patterns executed on a developer's laptop that has the necessary tools for
CI; this server is called the CI server.
• The CI server can be either of the on-premises type, installed in the company data center,
Jenkins has become famous thanks to the large community working on it and its plugins.
Indeed, there are more than 1,500 Jenkins plugins that allow you to perform all types of
actions within your jobs. And if, despite everything, one of your tasks does not have a
plugin, you can create one yourself.
Installing and configuring Jenkins
1. To get all the steps to create an Azure VM with Jenkins already installed, read the
documentation available here: https://docs.microsoft.com/en-us/
azure/jenkins/install-jenkins-solution-template.
Once installed and created, we will access Jenkins in the browser by providing its
Uniform Resource Locator (URL) in the Azure portal in the DNS name field, as
shown in the following screenshot:
3. Follow the displayed instructions on the Jenkins home page to enable access to
this Jenkins instance via secure Secure Sockets Layer (SSL) tunneling.
4. Then, follow the configuration instructions on the Unlock Jenkins message
displayed on the Jenkins screen. Once the configuration is complete, we get Jenkins
ready to create a CI job.
Configuring a GitHub
webhook
In order for Jenkins to run a new job, we must first create a
webhook in the GitHub
repository. This webhook will be used to notify Jenkins as
soon as a new push occurs in
the repository.
2. Once the project is created, we'll have a page that indicates the different Git
commands to execute to push its code.
3. To do this, on our local disk, we will create a new gitlab-ci-demo.yml file and
then copy the content of our example, which can be found at https://github.
com/PacktPublishing/Learning-DevOps-Second-Edition/tree/
main/CHAP07, in the gitlab-ci-demo.yml file.
4. Then, we will execute the following commands in a terminal to push the code into
the repository
GitLab
• git init
• git remote add origin <git repo Url>
• git add .
• git commit -m "Initial commit"
• git push -u origin master
Once these
commands have
been executed,
we'll obtain a
remote GitLab
repository with
our lab code
Creating a CI pipeline