ET0735 - DevOps for AIoT
SOFTWARE CONFIGURATION MANAGEMENT
1
Official (Open), Non-sensitive 4/13/2022
Software Configuration Management
Overview
Software Development is an iterative process where the code base will be constantly
modified during the Software Development Life Cycle
Software Configuration Management (SCM) is the process to systematically manage the
source code files versions
To manage the different versions of all the source files, Configuration Management (CM)
Tools such as CVS, SVN and more recently Git and Github are popularly used
In this chapter, discuss the main features of Configuration Management Tools and focus on
Git and Github for practical examples
2
Official (Open), Non-sensitive 4/13/2022
Software Configuration Management
Without using a CM tool, a common approach is to simply rename a file to add a suffix
at the end of the file name describing the file’s “version”
For example for a file HelloWorld.c, if we modify this file, the next version is renamed as
HelloWorld_ver1.c, HelloWorl_ver2.c, etc as in the example below
This simple CM system works for a few files, for large projects with many files and
developers simply renaming files for version control will not be scalable.
HelloWorld_ver1.c HelloWorld_ver2.c
3
Official (Open), Non-sensitive 4/13/2022
Git – Source Control Management (SCM) Tool
Git was originally developed by Linus Torvalds as a CM tool to manage the Linux Kernel
project in 2005
It is an open source software tool and is freely available under the GPL 2.0 license
Main function of Git is as a Source Control Management (SCM) tool that operates on a
local Client machine as well as with a remote machine running a server
Used in conjunction with other Cloud based tools such as Github, Gitlab, etc, Git can
then be used in a distributed environment supporting multiple developers across
different locations
4
Official (Open), Non-sensitive 4/13/2022
Git – Source Control Management (SCM) Tool
A Git repository is basically a collection of files and each file has several versions
The different files and their associated versions are tracked in an internal database in
the Git repository to manage the file differences, branches, etc
Git Repository
File1
File2 FileN
Ver 1.0
Ver 1.0 Ver 1.0
File1
File2 FileN
Ver 1.x
Ver 1.x Ver 1.x
5
Official (Open), Non-sensitive 4/13/2022
Basic Git Operations
To support the Source Control Management Git supports several operations below and
we will discuss each of these main operations in further detail
Commit
Push
Branch
Merge
Tag
6
Official (Open), Non-sensitive 4/13/2022
Git – Source Control Management (SCM) Tool
To support the Source Control Management Git supports several operations below and
we will cover each of these main operations in detail
Commit
Adds a new version of a file to the Git repository
Push
Adds the committed files in the local repository to the remote repository
Branch
Creates a new “branch” in the local Git repository containing a set of files
Merge
Combine and Merge 2 Git branches into a new branch in the Git repository
Tag
Create a label marking a set of files and their associated revisions which can be 7
Official (Open), Non-sensitive 4/13/2022
used to indicate a Software Release
Git – Configuration Files
Git maintains the commit and revision history of all files and directories within the locally
defined Git repository
There are several configuration files but we will just cover the following files
“gitignore” file
Used to specify which files and directories should not be tracked by Git
This is very useful to avoid storing files that are generated by the build
environment and that are not required to be tracked in the Git repository
For example in Java, generated JAR and .class files should not be traced by Git
Similarly for Android Studio, intermediate files such as JAR files, APK files, etc are
always generated by the Build environment and do not need to be tracked in
the Git repository
More info here https://git-scm.com/docs/gitignore
8
Official (Open), Non-sensitive 4/13/2022
Git – Configuration Files
“Readme” file
This is a text file where you can describe the contents of the Git repository
When used with GitHub, the README file can be used to generate a HTML page
based on a GitHub markup syntax which can be used to format the page to add
text headers, images, hyperlinks, etc.
More info here https://github.com/adam-p/markdown-here/wiki/Markdown-
Cheatsheet
9
Official (Open), Non-sensitive 4/13/2022
Basic Git Operations - Initialize
The first step to using Git for Source Control is to create the initial Git repository
Using the command line, this is the “git init” command
After running “git init” command, a new folder “.git” will be created
“.git” folder contains a database of all the files that are managed in the local Git
Repository
10
Official (Open), Non-sensitive 4/13/2022
Basic Git Operations - Commit
After the initial local Git repository is created, any files in the local directory that we
want to add to the Git Repository needs to be “Committed”
Local Machine
Git Repository
File1.py
L
File1.py
git commit –m “Initial Revision”
Ver 1.0
For each Git “Commit”, an associated textual description can also be added to
describe the changes made in the commit
It’s good practice to write meaningful comments for each commit which could help
other developers to better understand the changes you have done.
Official (Open), Non-sensitive
If the commit changes are done based on a Change Management ticket, adding 11
the ticket ID (eg: JIRA ticket number, etc) is also a good way to keep track of the 4/13/2022
changes
Basic Git Operations - Branch
By default when files are committed, these files are first added to the local repository’s
main branch
In Git and most Configuration Management tools, a branch is defined a collection of
files, folders
After creating a new repository in Git using the “git init” command, a single default
branch named “master” is also created by default
If no new Git branches are created, then all files are by default committed to this initial
“master” branch
Official (Open), Non-sensitive
12
4/13/2022
Basic Git Operations – Branch and Tags
A branch basically represents a collection of files and their respective versions
The lines in the diagram below shows an example of how the initial “master” branch
can branched into a separate “bug-fix-branch” and later merged back to the
“master” branch
Circles in the diagram represent Git Tags that are used to mark specific points in a
branch and are normally used to mark points in the development for Software Releases
bug-fix-branch
master Tag: “ver1.0.1” Tag: “ver1.0.2”
Official (Open), Non-sensitive
Tag: “ver1.0” Tag: “ver1.1” 13
4/13/2022
Basic Git Operations – Branch and Tags
In Git, Tags are basically used to mark a group of files and their associated versions with
a text string know as a “Tag”
For example in a Git repository branch “bug-fix-branch”, assume there are 3 files,
main.py, sensor.py and actuator.py
Assume that on 15th June 2021 we fixed a bug in the reading of the temperature sensor
To solve the bug we modified only sensor.py and main.py
After all the code changes have been completed, we commit all the files to the
branch “bug-fix-branch” and then
Official (Open), Non-sensitive
14
4/13/2022
Basic Git Operations - Branch
Git also supports the creation of multiple branches which is extremely useful for the
following
Software Releases
Bug Fixes
Product Variants
Official (Open), Non-sensitive
15
4/13/2022
Remote Git Server
So far we have covered the basic Git operations that are confined to a local machine
In this section we will cover the using Git on a Remote Server
Committing changes locally to a Git repository on our local machine is fast and allows
us to track all our code changes
However, a remote Git Server allows us to also backup our local Git repository to 1 or
more remote servers
Remote Git servers also allow more possibilities for working with other software
developers that are geographically distributed
Official (Open), Non-sensitive
16
4/13/2022
GitHub as a Remote Git server
Below are 2 common solutions for hosting a Git Remote Server
GitHub
Free subscription with limitations
Closed Source
Supports creating Software releases, Code Review, CI/CD Integration, etc
GitLab
Free subscription for cloud services
Open Source
Possible to run on a local server based on VM or Docker images
Supports creating Software releases, Code Review, CI/CD Integration, etc
Official (Open), Non-sensitive
17
4/13/2022
Git – GitHub Workflow
https://medium.com/analytics-vidhya/git-most-frequently-used-commands-9df9f200c235
18
4/13/2022
Official (Open), Non-sensitive
GitHub operations - Push
The Git command “Push” is used to upload any local Git commits done on the local
repository to the remote GitHub repository
Local Machine
File1.py Git Repository
git commit –m “Initial Revision” L
File1.py
Ver 1.0
Remote Server git push
GitHub Repository
L
File1.py
Ver 1.0 19
4/13/2022
Official (Open), Non-sensitive
GitHub on Cloud
GitHub runs as a Cloud based service for hosting Git repositories and provides features
such as the ones listed below and several others
Collaborate Coding
Automation & CI/CD
Security
Client Applications
Project Management
Team Administration
Practical usage of GitHub and Git will be covered in the Lab exercises
20
4/13/2022
Official (Open), Non-sensitive
GitHub – Creating Software Releases
We discussed earlier that Git Tags can be used to create checkpoints within a Git
branch that can also be used as a label to mark a set of files and their associated
revisions to indicate a Software Release
GitHub extends this feature using Git tags to also create GitHub specific releases that
are paired to specific Git Tags
21
4/13/2022
Official (Open), Non-sensitive