SlideShare a Scribd company logo
1 of 42
Download to read offline
1
Git & Jenkins Introduction
2
Agenda
1. Git
1. Core concepts
2. Installation
3. Basic usage
2. Jenkins
1. What’s it? Why do we need it?
2. Terminologies
3. Jenkins architecture
3. Demo (integrate Jenkins with Git)
3
1 What’s Git?
 The most commonly used version control
system (VCS) today.
 Distributed VCS, meaning your local copy of
code is a complete version control
repository.
 These fully-functional local repositories
make it is easy to work offline or remotely.
4
1.1 Core concepts
 Repository
● Collection of files and their history organized in folders, branches, tags
● Is stored in a normal file system somewhere
● Can be on a local machine or a remote machine
● To work with GIT you will need a repo somewhere
● When creating a new one… it’s empty
5
1.1 Core concepts (cont.)
 Index (Staging area)
● Snapshot of files in the workspace.
● You add to the index files you change / remove etc.
 Commit
● A snapshot of the workspace at some point
● Has unique revision number
● Knows the commit (commits) that it’s based on
6
1.1 Core concepts (cont.)
7
1.2 Installation
 Download installation at: https://git-scm.com/download
● Windows: Run installation file.
● Ubuntu:
sudo apt install git
● RedHat/CentOS:
sudo yum install git
 Verify installation:
git --version
8
1.3 Basic usage - Configuration
 3 config files:
/etc/gitconfig -> all users, repositories (--system)
~/.gitconfig - > one user, all repositories (--global)
[repo]/.git/config -> specific to repository (default)
 Your identity – information for each commit:
git config --global user.name “An Nguyen”
git config –global user.email nthienan@tma.com.vn
 List all config values:
git config --list
9
1.3 Basic usage - Configuration (cont.)
 Merge tool:
git config --global --add merge.tool kdiff3
git config --global --add mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global --add mergetool.kdiff3.trustExitCode false
 Diff tool:
git config --global --add diff.guitool kdiff3
git config --global --add difftool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global --add difftool.kdiff3.trustExitCode false
10
1.3 Basic usage - Create repository
 Initialized a repo:
git init
 Clone – creates a local repository by copying another (remote) repository
git clone <repo_url>
 Clone existing repo into directory
git clone <repo_url> <directory_name>
11
1.3 Basic usage - Working with files
• Add changes to index (staging area):
git add <file_path>
git add –A
• Unstage files:
git reset HEAD <file_path>
• Reset all changes:
git reset --hard
• Discard unstaged changes in a file:
git checkout <file_path>
• Commit:
• git commit –m “message”
• git commit –am “message”
12
1.3 Basic usage - View changes
 Show status of files:
git status
 Show unstage changes:
git diff
git difftool
 Show staged changes:
git diff --cached
git difftool --cached
13
1.3 Basic usage - View history
 Show log:
git log [-n] [--pretty] [--graph]
-n <number_of_commit>: show n commit
--pretty=<format>: display format. See pretty format here
--graph: show history in diagram
Ex: git log -n 10 --pretty=short—graph
 There’re many GUI tools: SourceTree, GitHub Desktop, Git Extensions
14
1.3 Basic usage - Branches
 Branch is a pointer to a commit
 A branch can point at other commits – it can move
 A branch is a way to organize working histories
 The default branch name in Git is master
 There is 2 types of branch: local and remote.
 Remote branches represent the state of a branch on the repository it is fetched
from
 You cannot checkout a remote branch. You create a local pointer to it
15
1.3 Basic usage - Branches
 When doing a “commit” the current “branch” moves to point at the new
commit
C3 C2 C1bx
C3 C2 C1bx C4
16
1.3 Basic usage - Branches
 Here is a branch
 Creating a new branch just adds another “pointer” to the same commit
C3 C2 C1bx
C3 C2 C1
bx
by
17
1.3 Basic usage - Branches
 Other branches are not affected by a commit
C3 C2 C1
bx
by
C3 C2 C1
bx
by
C4
18
1.3 Basic usage - Branches (cont.)
 List all local branches:
git branch
 List all remote branches:
git branch –r
 Create new branch:
git branch <branch_name>
 Switch branch:
git checkout <branh_name>
 Create new branch and switch to it:
git checkout -b <branch_name>
 Delete branch:
git branch –d <name>
Safe operation, prevents deleting branch
unmerged.
git branch –D <name> :
Force delete branch
 Rename branch
git branch –m <new_name>
19
1.3 Basic usage - Merging
 Merge the specified branch into
the current branch
● git merge <branch_name>
 Merge the specified branch into
the current branch, but always
generate a merge commit:
● git merge --no-ff <branch_name>
20
1.3 Basic usage - Resolving Conflicts
If the two branches you're trying to merge both changed the same part of the same
file => conflict => stop merge process
CONFLICT (content): Merge conflict in <file_paths>
Automatic merge failed; fix conflicts and then commit the result.
 Using merge tool to resolve conflicts:
git mergetool : open merge tool so that you can resolve the conflicts manually.
git commit : commit merge change and finish merge action.
21
1.3 Basic usage - Remote
 Remotes are just symbolic
names
 You can have as many as you
like
 The default name is origin if
you’ve cloned
 Remote-tracking branches are
locally immutable
My Machine The Server
C1
master
C0
cloneC1
origin/master
C0
master
22
1.3 Basic usage - Fetch
 Fetch – gets changes from a remote repository that you don’t already have.
 Fetch gets the changes to the local repository but does not touch the index or
workspace.
 After a fetch, usually a merge needs to take place
git fetch
git merge <remote>/<branch>
23
1.3 Basic usage - Fetch (cont.)
My Machine
The Server
C1
C0
master
C2
C1
origin/master
C0
master
fetch
My Machine The Server
C1
C0
master
C2
C1
origin/master
C0
masterC2
24
1.3 Basic usage - Pull
 Pull is just a shortcut command to do:
1. Fetch from a remote
2. Merge changes from “remote branch” into the “remote tracking branch”
 Sometimes the tool would also allow to “commit” merges for you right after the
pull (not part of pull, but a helper)
git pull
25
1.3 Basic usage - Push
 Will take local objects (commits, tags) which are required to make a remote
branch complete – and send them.
 Will merge those local changes into the remote branch
 Will only do a “fast-forward” merge (other merge type, if required, will fail the
push)
 Push to existing branch
git push
 Push new branch
git push –u <remote> <branch>
26
1.3 Basic usage - Push (cont.)
My Machine The Server
C1
C0
master
C2
C1
origin/master
C0
master
C2
C3
My Machine The Server
C1
C0
master
C2
C1
origin/master
C0
master
C2
C3 C3
27
1.3 Basic usage - Push (cont.)
 If cannot do a fast-forward – will fail. Then, a fetch + merge (or pull) is required to
allow the push.
 Once remote changes merged locally again a fast forward is possible and the push
would work
28
1.3 Basic usage - Push (cont.)
My Machine The Server
C1
C0
master
C2
C1
origin/master
C0
master
C2
C3 C4
push
My Machine The Server
C1
C0
master
C2
C1
origin/master
C0
master
C2
C3
C4
C4
C5
29
1.3 Basic usage - Push (cont.)
My Machine The Server
C1
C0
master
C2
C1
origin/master
C0
master
C2
C3
C4
C4
C5
push
My Machine The Server
C1
origin/master
C0
master
C2
C3
C4
C5
C1
C0
master
C2
C3
C4
C5
30
2.1 What’s Jenkins?
 Continuous integration server - detects changes
in Subversion, performs tasks, repeatedly (build,
test, deploy, package, etc.)
 An open source continuous integration tool
written in Java.
 It is a server-based system running in a servlet
container such as Apache Tomcat
31
2.1 Why do we need?
 To integrate more frequently, detect errors quicker, improve quality and reduce
cost
 Co-ordinate the running of tasks as part of workflows.
 Compile, test and package, deploy, script, verify
32
2.2 Terminology
 Job - a unit of work for a project
 View - user defined collection of jobs or a workflow
 Master - the central Jenkins master, does job scheduling
 Slave - executes one or more jobs within slots (executors)
 Workspace - the working area where a job is carried out
33
2.3 Architecture
34
2.3 Architecture (cont.)
35
2.3 Jenkins Features
 Trigger a build
 Get source code from repository
 Automatically build and test
 Generate report & notify
 Deploy
 Distributed build
36
2.3 Jenkins Plugins
 Build triggers
 Source code management
 Build tools
 Build wrappers
 Build notifiers
 Build reports
 Artifact uploaders
 UI plugins
 Authentication and user management
37
2.3 Build Trigger
 Manually click build button
 Build periodically
 Poll SCM
 Build after other projects are built
38
2.3 Security Management
 Security Realm
● LDAP
● Jenkins's own user database
 Authorization
● Anyone can do anything
● Logged-in users can do anything
● Matrix-based security
● Project-based Matrix Authorization Strategy
39
2.3 Jenkins Pipeline
40
2.3 Test Code Coverage
Ref: http://cobertura.sourceforge.net/sample/
41
2.3 How does Jenkins fit into your work?
42
3. Demo

More Related Content

What's hot

Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Edureka!
 
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | EdurekaWhat is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | EdurekaEdureka!
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkinsAbe Diaz
 
Gitlab CI : Integration et Déploiement Continue
Gitlab CI : Integration et Déploiement ContinueGitlab CI : Integration et Déploiement Continue
Gitlab CI : Integration et Déploiement ContinueVincent Composieux
 
Jenkins for java world
Jenkins for java worldJenkins for java world
Jenkins for java worldAshok Kumar
 
Jenkins Introduction
Jenkins IntroductionJenkins Introduction
Jenkins IntroductionPavan Gupta
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...Simplilearn
 
DevOps Overview
DevOps OverviewDevOps Overview
DevOps OverviewSagar Mody
 
CI/CD Overview
CI/CD OverviewCI/CD Overview
CI/CD OverviewAn Nguyen
 
Jenkins 101: Getting Started
Jenkins 101: Getting StartedJenkins 101: Getting Started
Jenkins 101: Getting StartedR Geoffrey Avery
 
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...Simplilearn
 
Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)Mindfire Solutions
 
Continuous Delivery with Jenkins
Continuous Delivery with JenkinsContinuous Delivery with Jenkins
Continuous Delivery with JenkinsJadson Santos
 
Cucumber presentation
Cucumber presentationCucumber presentation
Cucumber presentationAkhila B
 

What's hot (20)

Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
 
Jenkins
JenkinsJenkins
Jenkins
 
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | EdurekaWhat is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
 
CI/CD
CI/CDCI/CD
CI/CD
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
Gitlab CI : Integration et Déploiement Continue
Gitlab CI : Integration et Déploiement ContinueGitlab CI : Integration et Déploiement Continue
Gitlab CI : Integration et Déploiement Continue
 
Jenkins for java world
Jenkins for java worldJenkins for java world
Jenkins for java world
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
Jenkins Introduction
Jenkins IntroductionJenkins Introduction
Jenkins Introduction
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
 
DevOps Overview
DevOps OverviewDevOps Overview
DevOps Overview
 
Jenkins with SonarQube
Jenkins with SonarQubeJenkins with SonarQube
Jenkins with SonarQube
 
CI/CD Overview
CI/CD OverviewCI/CD Overview
CI/CD Overview
 
Jenkins Overview
Jenkins OverviewJenkins Overview
Jenkins Overview
 
Jenkins 101: Getting Started
Jenkins 101: Getting StartedJenkins 101: Getting Started
Jenkins 101: Getting Started
 
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
 
Devops | CICD Pipeline
Devops | CICD PipelineDevops | CICD Pipeline
Devops | CICD Pipeline
 
Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)
 
Continuous Delivery with Jenkins
Continuous Delivery with JenkinsContinuous Delivery with Jenkins
Continuous Delivery with Jenkins
 
Cucumber presentation
Cucumber presentationCucumber presentation
Cucumber presentation
 

Similar to Introduce to Git and Jenkins

Similar to Introduce to Git and Jenkins (20)

Git workshop
Git workshopGit workshop
Git workshop
 
Git
GitGit
Git
 
Git for developers
Git for developersGit for developers
Git for developers
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git Together
 
Git training
Git trainingGit training
Git training
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-it
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best Practices
 
Switching to Git
Switching to GitSwitching to Git
Switching to Git
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developers
 
Git Branch
Git BranchGit Branch
Git Branch
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git
GitGit
Git
 
SVN Information
SVN Information  SVN Information
SVN Information
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
Git github
Git githubGit github
Git github
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
 
Git introduction
Git introductionGit introduction
Git introduction
 

More from An Nguyen

Introduce to Credstash
Introduce to CredstashIntroduce to Credstash
Introduce to CredstashAn Nguyen
 
Introduction To AWS & AWS Lambda
Introduction To AWS & AWS LambdaIntroduction To AWS & AWS Lambda
Introduction To AWS & AWS LambdaAn Nguyen
 
Introduction To Docker, Docker Compose, Docker Swarm
Introduction To Docker, Docker Compose, Docker SwarmIntroduction To Docker, Docker Compose, Docker Swarm
Introduction To Docker, Docker Compose, Docker SwarmAn Nguyen
 
Secret Management with Hashicorp Vault and Consul on Kubernetes
Secret Management with Hashicorp Vault and Consul on KubernetesSecret Management with Hashicorp Vault and Consul on Kubernetes
Secret Management with Hashicorp Vault and Consul on KubernetesAn Nguyen
 
Spring framework
Spring frameworkSpring framework
Spring frameworkAn Nguyen
 
Luận văn tìm hiểu Spring
Luận văn tìm hiểu SpringLuận văn tìm hiểu Spring
Luận văn tìm hiểu SpringAn Nguyen
 
Terminal Services and VPN
Terminal Services and VPNTerminal Services and VPN
Terminal Services and VPNAn Nguyen
 
Tân sinh viên TECH - AGU 2014
Tân sinh viên TECH - AGU 2014Tân sinh viên TECH - AGU 2014
Tân sinh viên TECH - AGU 2014An Nguyen
 
Quy tắc thiết kế giao diện và viết code C#
Quy tắc thiết kế giao diện và viết code C#Quy tắc thiết kế giao diện và viết code C#
Quy tắc thiết kế giao diện và viết code C#An Nguyen
 
Nêu cao tinh thần trách nhiệm, chống chủ nghĩa cá nhân, nói đi đôi với làm
Nêu cao tinh thần trách nhiệm, chống chủ nghĩa cá nhân, nói đi đôi với làmNêu cao tinh thần trách nhiệm, chống chủ nghĩa cá nhân, nói đi đôi với làm
Nêu cao tinh thần trách nhiệm, chống chủ nghĩa cá nhân, nói đi đôi với làmAn Nguyen
 
Hướng dẫn lập trình quản lý c#
Hướng dẫn lập trình quản lý c#Hướng dẫn lập trình quản lý c#
Hướng dẫn lập trình quản lý c#An Nguyen
 
Quản lý quan hệ khách hàng
Quản lý quan hệ khách hàngQuản lý quan hệ khách hàng
Quản lý quan hệ khách hàngAn Nguyen
 
Quản lý quan hệ khách hàng
Quản lý quan hệ khách hàngQuản lý quan hệ khách hàng
Quản lý quan hệ khách hàngAn Nguyen
 
RichTetxtBox control
RichTetxtBox controlRichTetxtBox control
RichTetxtBox controlAn Nguyen
 
Hội nghị học tốt CNTT 2013 - An Giang University
Hội nghị học tốt CNTT 2013 - An Giang UniversityHội nghị học tốt CNTT 2013 - An Giang University
Hội nghị học tốt CNTT 2013 - An Giang UniversityAn Nguyen
 

More from An Nguyen (16)

Terraform
TerraformTerraform
Terraform
 
Introduce to Credstash
Introduce to CredstashIntroduce to Credstash
Introduce to Credstash
 
Introduction To AWS & AWS Lambda
Introduction To AWS & AWS LambdaIntroduction To AWS & AWS Lambda
Introduction To AWS & AWS Lambda
 
Introduction To Docker, Docker Compose, Docker Swarm
Introduction To Docker, Docker Compose, Docker SwarmIntroduction To Docker, Docker Compose, Docker Swarm
Introduction To Docker, Docker Compose, Docker Swarm
 
Secret Management with Hashicorp Vault and Consul on Kubernetes
Secret Management with Hashicorp Vault and Consul on KubernetesSecret Management with Hashicorp Vault and Consul on Kubernetes
Secret Management with Hashicorp Vault and Consul on Kubernetes
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Luận văn tìm hiểu Spring
Luận văn tìm hiểu SpringLuận văn tìm hiểu Spring
Luận văn tìm hiểu Spring
 
Terminal Services and VPN
Terminal Services and VPNTerminal Services and VPN
Terminal Services and VPN
 
Tân sinh viên TECH - AGU 2014
Tân sinh viên TECH - AGU 2014Tân sinh viên TECH - AGU 2014
Tân sinh viên TECH - AGU 2014
 
Quy tắc thiết kế giao diện và viết code C#
Quy tắc thiết kế giao diện và viết code C#Quy tắc thiết kế giao diện và viết code C#
Quy tắc thiết kế giao diện và viết code C#
 
Nêu cao tinh thần trách nhiệm, chống chủ nghĩa cá nhân, nói đi đôi với làm
Nêu cao tinh thần trách nhiệm, chống chủ nghĩa cá nhân, nói đi đôi với làmNêu cao tinh thần trách nhiệm, chống chủ nghĩa cá nhân, nói đi đôi với làm
Nêu cao tinh thần trách nhiệm, chống chủ nghĩa cá nhân, nói đi đôi với làm
 
Hướng dẫn lập trình quản lý c#
Hướng dẫn lập trình quản lý c#Hướng dẫn lập trình quản lý c#
Hướng dẫn lập trình quản lý c#
 
Quản lý quan hệ khách hàng
Quản lý quan hệ khách hàngQuản lý quan hệ khách hàng
Quản lý quan hệ khách hàng
 
Quản lý quan hệ khách hàng
Quản lý quan hệ khách hàngQuản lý quan hệ khách hàng
Quản lý quan hệ khách hàng
 
RichTetxtBox control
RichTetxtBox controlRichTetxtBox control
RichTetxtBox control
 
Hội nghị học tốt CNTT 2013 - An Giang University
Hội nghị học tốt CNTT 2013 - An Giang UniversityHội nghị học tốt CNTT 2013 - An Giang University
Hội nghị học tốt CNTT 2013 - An Giang University
 

Recently uploaded

SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainAbdul Ahad
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 

Recently uploaded (20)

SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software Domain
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 

Introduce to Git and Jenkins

  • 1. 1 Git & Jenkins Introduction
  • 2. 2 Agenda 1. Git 1. Core concepts 2. Installation 3. Basic usage 2. Jenkins 1. What’s it? Why do we need it? 2. Terminologies 3. Jenkins architecture 3. Demo (integrate Jenkins with Git)
  • 3. 3 1 What’s Git?  The most commonly used version control system (VCS) today.  Distributed VCS, meaning your local copy of code is a complete version control repository.  These fully-functional local repositories make it is easy to work offline or remotely.
  • 4. 4 1.1 Core concepts  Repository ● Collection of files and their history organized in folders, branches, tags ● Is stored in a normal file system somewhere ● Can be on a local machine or a remote machine ● To work with GIT you will need a repo somewhere ● When creating a new one… it’s empty
  • 5. 5 1.1 Core concepts (cont.)  Index (Staging area) ● Snapshot of files in the workspace. ● You add to the index files you change / remove etc.  Commit ● A snapshot of the workspace at some point ● Has unique revision number ● Knows the commit (commits) that it’s based on
  • 7. 7 1.2 Installation  Download installation at: https://git-scm.com/download ● Windows: Run installation file. ● Ubuntu: sudo apt install git ● RedHat/CentOS: sudo yum install git  Verify installation: git --version
  • 8. 8 1.3 Basic usage - Configuration  3 config files: /etc/gitconfig -> all users, repositories (--system) ~/.gitconfig - > one user, all repositories (--global) [repo]/.git/config -> specific to repository (default)  Your identity – information for each commit: git config --global user.name “An Nguyen” git config –global user.email nthienan@tma.com.vn  List all config values: git config --list
  • 9. 9 1.3 Basic usage - Configuration (cont.)  Merge tool: git config --global --add merge.tool kdiff3 git config --global --add mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe" git config --global --add mergetool.kdiff3.trustExitCode false  Diff tool: git config --global --add diff.guitool kdiff3 git config --global --add difftool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe" git config --global --add difftool.kdiff3.trustExitCode false
  • 10. 10 1.3 Basic usage - Create repository  Initialized a repo: git init  Clone – creates a local repository by copying another (remote) repository git clone <repo_url>  Clone existing repo into directory git clone <repo_url> <directory_name>
  • 11. 11 1.3 Basic usage - Working with files • Add changes to index (staging area): git add <file_path> git add –A • Unstage files: git reset HEAD <file_path> • Reset all changes: git reset --hard • Discard unstaged changes in a file: git checkout <file_path> • Commit: • git commit –m “message” • git commit –am “message”
  • 12. 12 1.3 Basic usage - View changes  Show status of files: git status  Show unstage changes: git diff git difftool  Show staged changes: git diff --cached git difftool --cached
  • 13. 13 1.3 Basic usage - View history  Show log: git log [-n] [--pretty] [--graph] -n <number_of_commit>: show n commit --pretty=<format>: display format. See pretty format here --graph: show history in diagram Ex: git log -n 10 --pretty=short—graph  There’re many GUI tools: SourceTree, GitHub Desktop, Git Extensions
  • 14. 14 1.3 Basic usage - Branches  Branch is a pointer to a commit  A branch can point at other commits – it can move  A branch is a way to organize working histories  The default branch name in Git is master  There is 2 types of branch: local and remote.  Remote branches represent the state of a branch on the repository it is fetched from  You cannot checkout a remote branch. You create a local pointer to it
  • 15. 15 1.3 Basic usage - Branches  When doing a “commit” the current “branch” moves to point at the new commit C3 C2 C1bx C3 C2 C1bx C4
  • 16. 16 1.3 Basic usage - Branches  Here is a branch  Creating a new branch just adds another “pointer” to the same commit C3 C2 C1bx C3 C2 C1 bx by
  • 17. 17 1.3 Basic usage - Branches  Other branches are not affected by a commit C3 C2 C1 bx by C3 C2 C1 bx by C4
  • 18. 18 1.3 Basic usage - Branches (cont.)  List all local branches: git branch  List all remote branches: git branch –r  Create new branch: git branch <branch_name>  Switch branch: git checkout <branh_name>  Create new branch and switch to it: git checkout -b <branch_name>  Delete branch: git branch –d <name> Safe operation, prevents deleting branch unmerged. git branch –D <name> : Force delete branch  Rename branch git branch –m <new_name>
  • 19. 19 1.3 Basic usage - Merging  Merge the specified branch into the current branch ● git merge <branch_name>  Merge the specified branch into the current branch, but always generate a merge commit: ● git merge --no-ff <branch_name>
  • 20. 20 1.3 Basic usage - Resolving Conflicts If the two branches you're trying to merge both changed the same part of the same file => conflict => stop merge process CONFLICT (content): Merge conflict in <file_paths> Automatic merge failed; fix conflicts and then commit the result.  Using merge tool to resolve conflicts: git mergetool : open merge tool so that you can resolve the conflicts manually. git commit : commit merge change and finish merge action.
  • 21. 21 1.3 Basic usage - Remote  Remotes are just symbolic names  You can have as many as you like  The default name is origin if you’ve cloned  Remote-tracking branches are locally immutable My Machine The Server C1 master C0 cloneC1 origin/master C0 master
  • 22. 22 1.3 Basic usage - Fetch  Fetch – gets changes from a remote repository that you don’t already have.  Fetch gets the changes to the local repository but does not touch the index or workspace.  After a fetch, usually a merge needs to take place git fetch git merge <remote>/<branch>
  • 23. 23 1.3 Basic usage - Fetch (cont.) My Machine The Server C1 C0 master C2 C1 origin/master C0 master fetch My Machine The Server C1 C0 master C2 C1 origin/master C0 masterC2
  • 24. 24 1.3 Basic usage - Pull  Pull is just a shortcut command to do: 1. Fetch from a remote 2. Merge changes from “remote branch” into the “remote tracking branch”  Sometimes the tool would also allow to “commit” merges for you right after the pull (not part of pull, but a helper) git pull
  • 25. 25 1.3 Basic usage - Push  Will take local objects (commits, tags) which are required to make a remote branch complete – and send them.  Will merge those local changes into the remote branch  Will only do a “fast-forward” merge (other merge type, if required, will fail the push)  Push to existing branch git push  Push new branch git push –u <remote> <branch>
  • 26. 26 1.3 Basic usage - Push (cont.) My Machine The Server C1 C0 master C2 C1 origin/master C0 master C2 C3 My Machine The Server C1 C0 master C2 C1 origin/master C0 master C2 C3 C3
  • 27. 27 1.3 Basic usage - Push (cont.)  If cannot do a fast-forward – will fail. Then, a fetch + merge (or pull) is required to allow the push.  Once remote changes merged locally again a fast forward is possible and the push would work
  • 28. 28 1.3 Basic usage - Push (cont.) My Machine The Server C1 C0 master C2 C1 origin/master C0 master C2 C3 C4 push My Machine The Server C1 C0 master C2 C1 origin/master C0 master C2 C3 C4 C4 C5
  • 29. 29 1.3 Basic usage - Push (cont.) My Machine The Server C1 C0 master C2 C1 origin/master C0 master C2 C3 C4 C4 C5 push My Machine The Server C1 origin/master C0 master C2 C3 C4 C5 C1 C0 master C2 C3 C4 C5
  • 30. 30 2.1 What’s Jenkins?  Continuous integration server - detects changes in Subversion, performs tasks, repeatedly (build, test, deploy, package, etc.)  An open source continuous integration tool written in Java.  It is a server-based system running in a servlet container such as Apache Tomcat
  • 31. 31 2.1 Why do we need?  To integrate more frequently, detect errors quicker, improve quality and reduce cost  Co-ordinate the running of tasks as part of workflows.  Compile, test and package, deploy, script, verify
  • 32. 32 2.2 Terminology  Job - a unit of work for a project  View - user defined collection of jobs or a workflow  Master - the central Jenkins master, does job scheduling  Slave - executes one or more jobs within slots (executors)  Workspace - the working area where a job is carried out
  • 35. 35 2.3 Jenkins Features  Trigger a build  Get source code from repository  Automatically build and test  Generate report & notify  Deploy  Distributed build
  • 36. 36 2.3 Jenkins Plugins  Build triggers  Source code management  Build tools  Build wrappers  Build notifiers  Build reports  Artifact uploaders  UI plugins  Authentication and user management
  • 37. 37 2.3 Build Trigger  Manually click build button  Build periodically  Poll SCM  Build after other projects are built
  • 38. 38 2.3 Security Management  Security Realm ● LDAP ● Jenkins's own user database  Authorization ● Anyone can do anything ● Logged-in users can do anything ● Matrix-based security ● Project-based Matrix Authorization Strategy
  • 40. 40 2.3 Test Code Coverage Ref: http://cobertura.sourceforge.net/sample/
  • 41. 41 2.3 How does Jenkins fit into your work?

Editor's Notes

  1. Quickly becoming the standard for version control You commit your work locally, and then sync your copy of the repository with the copy on the server. This paradigm differs from centralized version control where clients must synchronize code with a server before creating new versions of code.
  2. Git views untracked and modified files similarly. Untracked means that the file is new to your Git project. Modified means that the file has been seen before, but has been changed, so is not ready to be snapshotted by Git. Modification of a file occurs in your working directory When a file becomes staged, it's taken into the staging area. This is where Git is able to take a snapshot of it and store its current state to your local repository. This area is also known as the Index Committed means that Git has officially taken a snapshot of the files in the staging area, and stored a unique index in the Git directory. The terms snapshotted and committed are very similar
  3. Note that all of the commands presented below merge into the current branch. The current branch will be updated to reflect the merge, but the target branch will be completely unaffected