Unit 2 New
Unit 2 New
● The first type to emerge is the Centralized Version Control System, such as
SVN, CVS, Subversion, and TFVC (or SourceSafe).
● These systems consist of a remote server that centralizes the code of all
developers.
4
Overviewing Git and its command lines
● Centralized Version ● Distributed Version
Control System Control System
5
Overviewing Git and its command lines
● Centralized Version Control System
● All developers can archive and retrieve their code on the remote server.
● The system allows better collaboration between teams and a guarantee of
code backup.
● Drawbacks:
○ In case of no connection between the developers and the remote server, no
more archiving or code recovery actions can be performed.
○ If the remote server no longer works, the code, as well as the history, will be
lost.
6
Overviewing Git and its command lines
● Distributed Version Control System
● The second type of CVS is a distributed system
● Ex: Git or Mercurial
● These systems consist of a remote repository and a local copy of this repository
on each developer's local machine.
● Even in the event of disconnection from the remote repository, the developer
can continue to work with the local repository, and synchronization will be done
when the remote repository is accessible again.
● A copy of the code and its history is also present in the local repository.
7
Overviewing Git and its command lines
● The first type to emerge is the centralized systems, such as SVN, CVS,
Subversion, and TFVC (or SourceSafe).
8
Continuous Integration and
Continuous Delivery
Introduction
● One of the main pillars of DevOps culture is the implementation of
continuous integration and deployment processes.
● It occurs when each user's code commit retrieves and merges the code
from a remote repository, compiles it, and tests it.
10
The CI/CD Principles
● To implement a CI/CD pipeline, it is important to know the different
elements that will be required to build an efficient and safe pipeline.
11
Continuous Integration (CI)
● The CI phase checks the code archived by the team members.
● Must be executed on each commit that has been pushed to the remote
repository.
● The setting up of a Git-type SCV is necessary to centralize the code of all the
members of a team.
● The team will have to decide on a code branch that will be used for
continuous integration.
● CI server ensures that the entire team is alerted any time the central code
repository contains broken code.
13
Continuous Integration (CI)
14
Continuous Integration (CI)
● The CI server can be
● The tasks performed during the CI phase must be automated and take into
account all the elements that are necessary for the verification of the code.
● The tasks performed during the CI phase are generally the compilation of
code and the execution of unit tests with code coverage.
15
Continuous Integration (CI)
● At the end of the verification tasks, the CI generates an application package
that will be deployed on the different environments (also called stages).
● Necessary to involve Devs, Ops, and also the security team in the
implementation of CI/CD tools and processes.
17
Continuous Delivery (CD)
● This union of people with the tools and processes will deploy applications
on the different servers or cloud resources, following the network rules &
company's security standards.
18
Continuous Delivery (CD)
● When there is a new configuration key, it is good practice for every
environment, including production, to be entered with the involvement of
the Ops team.
19
Continuous Delivery (CD)
● The different tools for setting up a CI/CD pipeline are as follows:
2. A package manager
3. A CI server
4. A configuration manager
● These tools will only be effective in delivering added value to the product if
development and operations team work together around them.
20
Using a Package Manager
● Version Control System (VCS) or more commonly as a Version Control
Manager (VCM)
21
Using a Package Manager
● NuGet package manager,
which publicly provides more
than 150K .NET Frameworks
● Advantages:
▪ Developer don't have to
store the packages with the
application sources.
▪ In the CI/CD pipeline, we need to make a package for our application and
store it in a package manager that will be private to the company.
23
Using a Package Manager
● Private NuGet and npm repository:
▪ The problem with installing one repository per package type method is that
we need to install and maintain a repository and its infrastructure for the
different types of packages.
24
Using a Package Manager
● Nexus Repository OSS :
• The packages supported today are NuGet, npm, Maven, Gradle, Python,
and also universal packages.
• The main difference from Nexus is that in Azure Artifacts, the feed is not by
package type.
• Advantages:
1. NuGet package
2. npm package
3. Universal package
4. Maven package
5. Python package
29
Using Jenkins
• Jenkins is one of the oldest continuous integration tools, initially released in
2011.
• Jenkins has become famous due to the large community working on it and
its plugins.
• If one of your tasks does not have a plugin, then you can create it yourself.
30
Installing and configuring Jenkins
● Jenkins is a cross-platform tool that can be installed on any type of support,
such as VMs or even Docker containers.
● 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.
31
Installing and configuring Jenkins
● The following screenshot shows Jenkins integration on Azure Marketplace:
32
Installing and configuring Jenkins
● 2. Once installed and created, we will access it in the browser by providing
its URL in the Azure portal in the DNS name field, as shown in the following
screenshot:
33
Installing and configuring Jenkins
● 3. Follow the displayed instructions on the Jenkins home page to enable
access to this Jenkins instance via secure SSL tunneling.
34
Installing and configuring Jenkins
● The following screenshot shows the installation of the GitHub plugin:
● Now configure GitHub with a webhook for its integration with Jenkins.
35
Configuring a GitHub webhook
● In order for Jenkins to run a new job, 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.
3. In the Payload URL field, fill in the URL address of Jenkins followed by /github-webhook/,
leave the secret input as it is, and choose the Just the push event option.
36
Configuring a GitHub webhook
● To do this, follow these
steps:
4. Validate the webhook.
● Configuration of a
GitHub webhook for
Jenkins:
37
Configuring a GitHub webhook
● To do this, follow these steps:
5. Finally, we can check on the GitHub interface, as shown in the following screenshot, that
the webhook is well configured and that it communicates with Jenkins.
38
Configuring a Jenkins CI job
● To configure Jenkins, follow these steps:
1. First, create a new job, by clicking on New Item or on the create new jobs
link:
39
Configuring a Jenkins CI job
● To configure Jenkins, follow these steps:
2. On the job configuration form, enter the name of the job, and choose the
Freestyle project template, then validate that by clicking on OK:
40
Configuring a Jenkins CI job
● To configure Jenkins, follow these steps:
41
Configuring a Jenkins CI job
● To configure Jenkins, follow these steps:
42
Configuring a Jenkins CI job
● To configure Jenkins, follow these steps:
43
Configuring a Jenkins CI job
● To configure Jenkins, follow these steps:
44
Configuring a Jenkins CI job
● To configure Jenkins, follow these steps:
4. Then, finish the configuration by clicking on Apply and then on the Save
button.
45
Executing the Jenkins job
● To test job execution, perform these steps:
2. Then, commit to the master branch directly from the GitHub web interface.
3. After making this commit, the DemoCI job is queued up and running in
Jenkins.
4. By clicking on the job, then on the link of the Console Output menu, see
the job execution logs.
46
Executing the Jenkins job
47
Executing the Jenkins job
● To test job execution, perform these steps:
4. By clicking on the job, then on the link of the Console Output menu, see
the job execution logs.
48
a) Explain the following:
i. Azure Repos
ii. Azure Boards
Azure Test Plans It allows you to make and manage a manual test plan.
50
Using Azure Pipelines
● Azure DevOps is free for up to five users. Beyond that, there is a license
version with per user costs.
● There is also Azure DevOps Server, which is the same product as Azure
DevOps, but it installs itself on premises.
3. On the next page, choose the account to use (either Live or GitHub).
5. In this organization, we will now be able to create projects with our CI/CD
pipeline.
52
Using Azure Pipelines
● Versioning of the code with Git in Azure Repos:
2. Then, in Azure Repos, import code from another Git repository by using
the Import repository option of the repository menu.
3. Once the Import a Git repository window opens, enter the URL of the Git
repository whose sources we want to import.
53
Using Azure Pipelines
● Versioning of the code with Git in Azure Repos:
54
Using Azure Pipelines
● Versioning of the code with Git in Azure Repos:
55
Using Azure Pipelines
● Versioning of the code with Git in Azure Repos:
4. Click on the Import button, then see that the code is imported into the
repository.
56
Using Azure Pipelines
● Creating the CI pipeline:
57
Using Azure Pipelines
● Creating the CI pipeline:
5. Azure Pipelines proposes to select a build template that will contain all
the preconfigured build steps; there is also the possibility to start from
an empty template.
○ The steps
○ The triggers
○ The options 60
Using Azure Pipelines
● Creating the CI pipeline:
61
Using Azure Pipelines
● Creating the CI pipeline:
62
Using Azure Pipelines
● Creating the CI pipeline:
7. Configure the Tasks tab, which contains the configuration of all the steps
to be performed in the build.
● Azure DevOps offers free agents from multiple OSes, called a hosted
agent, and also install your own agents, called self-hosted.
63
Using Azure Pipelines
● Creating the CI pipeline:
64
Using Azure Pipelines
● Creating the CI pipeline:
65
Using Azure Pipelines
● Creating the CI pipeline:
67
Using Azure Pipelines
● Creating the CI pipeline:
68
Using Azure Pipelines
● Creating the CI pipeline:
69
Using Azure Pipelines
● Creating the CI pipeline:
70
Using Azure Pipelines
● Creating the CI pipeline:
71
Using Azure Pipelines
● Creating the CI pipeline:
72
Creating the CD Pipeline: The Release
● In Azure Pipelines, the element that
allows deployment in the different
stages or environments is called the
release.
1. To create the release definition, go to
the Releases menu and click on New
pipeline, as follows:
74
Creating the CD Pipeline: The Release
3. Then, in the next window, the first stage is named, for example, CI as the
continuous integration environment:
75
Creating the CD Pipeline: The Release
4. Configure the entry point
of the release in the
artifacts part by adding
an artifact that is the
build definition
previously created in the
Creating the CI pipeline
section, as follows:
76
Creating the CD Pipeline: The Release
5. Configure the automatic release trigger for each successful build
execution:
77
Creating the CD Pipeline: The Release
6. Configure the steps that will
be executed in the CI stage;
by clicking on the stage, we
get exactly the same
configuration window as the
build:
79
Creating the CD Pipeline: The Release
8. Complete the definition of the release with the deployment of the other
environments (or stages). To simplify the manipulation, clone the CI
environment settings in the release, and change the name of the app
service name settings to the name of the web app:
80
Creating the CD Pipeline: The Release
9. We finally get the release definition as follows:
81
Creating the CD Pipeline: The Release
10.To trigger the deployment
of application, create a
new release by clicking on
the Create release button:
82
Using GitLab CI
● Creating the CI/CD pipelines with Jenkins and Azure Pipelines.
83
Using GitLab CI
● Following operations can be performed in GitLab CI:
1. Authentication at GitLab
84
Authentication at GitLab
● Creating a GitLab account is
free and can be done either
by creating a GitLab account
or using external accounts,
such as Google, GitHub,
Twitter, or Bitbucket.
86
Creating a New Project and Managing Code Source
● To create a new project in GitLab, follow these steps:
87
Creating a New Project and Managing Code Source
2. Then, choose a few
options: To create an
empty project (without
code)—the form asks to
enter its name:
88
Creating a New Project and Managing Code Source
● To create a new project
from a built-in template
project, as follows:
89
Creating a New Project and Managing Code Source
● To import code from an internal or external repository of another SVC
platform:
90
Creating a New Project and Managing Code Source
3. Once the project is created, different Git commands can be executed to
push the code.
4. To do this, on local disk, create a new gitlabdemo directory and then clone
the content.
5. Then, execute the following commands in a terminal to push the code into
the repository
▪ git init
▪ git remote add origin <git repo Url>
▪ git add .
▪ git commit -m "Initial commi
91
Creating a New Project and Managing Code Source
● Once these
commands have been
executed, then a
remote GitLab
repository with lab
code will be available.
● Remote GitLab
repository:
92
Creating the CI Pipeline
● In GitLab CI, the creation of a CI pipeline (and CD) is not done via a
graphical interface, but with a YAML file at the root of the project.
1. To create this pipeline, create, at the root of the application code, a ".gitlab-
ci.yml" file with the following content code:
93
Creating the CI Pipeline
● ".gitlab-ci.yml"
file with the
content code:
94
Creating the CI Pipeline
● Then, define two stages: one for the build and one for the test execution,
as well as a BuildConfiguration variable that will be used in the scripts.
● These .NET core scripts are identical to the ones we saw in the Using Azure
Pipelines
2. Then, we will commit and push this file into the remote repository.
3. Just after pushing the code, we can see that the CI process has been
triggered.
95
Accessing the CI Pipeline Execution Details
● To access the execution details of the executed CI pipeline, follow these
steps:
● 1. In the GitLab CI menu, go to CI/CD | Pipelines, and see the list of pipeline
executions, as shown in the following screenshot:
96
Accessing the CI Pipeline Execution Details
2. To display the details of the
pipeline, click on the
desired pipeline execution:
97
Accessing the CI Pipeline Execution Details
3. See the execution
status as well as the
two stages that was
defined in the
pipeline YAML file.
To view the details
of the execution
logs for a stage, click
on the stage:
98
Thank You
99