SE03 ConfigMgmt
SE03 ConfigMgmt
Configuration Management
Object Oriented Programming
http://softeng.polito.it/courses/09CBI
Non-commercial. You may not use this work for commercial purposes.
No Derivative Works. You may not alter, transform, or build upon this
work.
For any reuse or distribution, you must make clear to others the
license terms of this work.
Any of these conditions can be waived if you get permission from the
copyright holder.
Your fair use and other rights are in no way affected by the above.
2
1
15-May-20
Learning objectives
Understand what is configuration
management
What is Version Control
What are the main concepts of VC
Know the main tools for version
control
Learn how SVN can be used for CM
Configuration Management
The discipline that applies technical and
administrative direction and surveillance
in order to:
identify and document the functional and
physical characteristics of a configuration
item,
control changes to those characteristics,
record and report change processing and
implementation status, and
verify compliance with specified
requirements
2
15-May-20
Issues
What is the history of a document?
Versioning
Who can access and change what?
Change control
What is the correct set of documents for
a specific need?
Configuration
How the delivered system is obtained?
Build management
Goals of CM
Identify and manage parts of software
Control access and changes to parts
Allow to rebuild previous version of
software
3
15-May-20
VERSIONING
Versioning
4
15-May-20
Terms
Configuration item (CI)
Configuration Management aggregate
Configuration
Version
Baseline
10
10
5
15-May-20
Version
The initial release or a re-release of a
configuration item
Instance of CI, e.g.
Req document 1.0
Req document 1.1
11
11
Version identification
Procedures for version identification
should define an unambiguous way of
identifying component versions
Basic techniques for component
identification
Version numbering
Attribute-based identification
12
12
6
15-May-20
Version numbering
Simple naming scheme uses a linear
derivation
e.g. V1, V1.1, V1.2, V2.1, V2.2 etc.
Actual derivation structure is a tree or
a network rather than a sequence
Names are not meaningful.
Hierarchical naming scheme may be
better
13
13
Configuration
Set of CIs, each in a specific version
config 2
config 3
config 1
baseline
14
14
7
15-May-20
Configuration
Snapshot of software at certain time
Various CIs, each in a specific version
Same CI may appear in different
configurations
Also configuration has version
15
15
Baseline
Configuration in stable, frozen form
Not all configurations are baselines
Any further change / development will
produce new version(s) of CI(s), will not
modify baseline
Types of baselines
Development – for internal use
Product – for delivery
16
16
8
15-May-20
Semantic Versioning
Product numbering based on
MAJOR.MINOR.PATCH
Increment:
MAJOR: when you make large (possibly
incompatible) API changes,
MINOR: when you add functionality in a
backwards-compatible manner, and
PATCH: when you make backwards-
compatible bug fixes.
http://semver.org
17
17
CHANGE CONTROL
18
18
9
15-May-20
Repository
A collection of all software-related
artifacts belonging to a system
The location/format in which such a
collection is stored
19
19
Typical case
Team develops software
Many people need to access different
parts of software
Common repository (shared folder),
Everybody can read/write
documents/files
20
20
10
15-May-20
copy
copy
copy repository
copy
21
21
22
22
11
15-May-20
23
Check-in / check-out
Check-out
Extraction of CI from repository
– with goal of changing it or not
– After checkout next users are notified
Check-in (or commit)
Insertion of CI under control
24
24
12
15-May-20
repository
with CM tool
2 checkin doc.doc v x+1
25
25
26
26
13
15-May-20
Lock-Modify-Unlock
27
Lock-Modify-Unlock
Pro
Conflicts are impossible
Cons
No parallel work is possible, large delays
can be induced
Developers can possibly forget to unlock
so blocking the whole team
28
28
14
15-May-20
Copy-Modify-Merge
29
Copy-Modify-Merge
Pros
More flexible
Several developers can work in parallel
No developer can block others
Con
Requires care to resolve the conflicts
30
30
15
15-May-20
31
31
Branches: motivation
Branches allow working in isolation
form the main branch
Several new features or fixes can be
developed independently and
concurrently
When work is complete it can be merged
into the main branch
Branches may also represent different
configurations, e.g. by platform
32
32
16
15-May-20
Tools
Change Control+Versioning+Configuration
RCS
CVS
SCCS
PCVS
Subversion
BitKeeper
Mercurial
Git
33
33
BUILD MANAGEMENT
34
34
17
15-May-20
Build management
Prepare the environment
Gather third party components
Gather source code
Compile
Create packages
Run tests
Deploy
35
35
Tools
Build management
Make
Ant
Maven
Gradle
36
36
18
15-May-20
Continuous Integration
Maintain a single source repository
Automate the build
Make your build self-testing
Any commit build on integration machine
Keep the build fast
Test in a clone of the production
environment
Automate deployment
37
37
Continuous integration
Commit frequently
Don’t commit broken code
Don’t commit untested code
Don’t commit when the build is
broken
Don’t go home after committing until
the system builds
38
38
19
15-May-20
Tool CI
Continuous Integration
Travis CI
Jenkins
Cruise Control
39
39
40
40
20
15-May-20
What is Subversion
Free/open-source version control
system:
it manages any collection of files and
directories over time in a central
repository;
it remembers every change ever made to
your files and directories;
it can access its repository across
networks
41
41
Features
Directory versioning and true version
history
Atomic commits
Metadata versioning
Several topologies of network access
Consistent data handling
Branching and tagging
Usable by other applications and
languages
42
42
21
15-May-20
Architecture
43
43
The repository
Central store of data
It stores information in the form of a
file system
Any number of clients connect to the
repository, and then
read (update) or
write (commit) to these files.
44
44
22
15-May-20
45
45
Revisions
Each time the repository accepts a commit, it
creates a new state of the file system tree,
called a revision.
Global revision numbers: each revision is
assigned a progressive unique natural
number (previous revision + 1)
An freshly created repository has revision 0
(zero)
The whole repo gets a new revision number
Revision N represents the state of the repository
after the N th commit.
46
46
23
15-May-20
A A A’ A’
B B B’ B’
47
47
Mixed revisions
Suppose you have a working copy entirely at revision 10. You
edit the file foo.html and then perform an svn commit, which
creates revision 15 in the repository.
Therefore the only safe thing the Subversion client can do is
mark the one file—foo.html—as being at revision 15. The rest
of the working copy remains at revision 10. This is a mixed
revision.
Only by running svn update can the latest changes be
downloaded, and the whole working copy be marked as
revision 15.
Memento:
Every time you run svn commit, your working copy ends up
with some mixture of revisions: the things you just committed
are marked as having larger working revisions than everything
else.
48
48
24
15-May-20
Basic Procedure
Create working copy from a repository
svn checkout <repository>
When ready…
Synchronize contents of WC with repo
svn update
Work on WC
Possibly add new files
svn add <file list>
Push work to repository
svn commit –m ”<Log message>"
49
49
50
25
15-May-20
Conflicts
A conflict arise, upon commit, if the file
has been updated in the meanwhile
N: the revision (BASE) that was modified
– the repo revision at the time of last update
M: the current revision (HEAD) in the
repository (≥N)
A conflict occurs if:
M > N and
Contents of revisions M and N differ
51
51
Conflicts
Subversion places three extra unversioned files in
the working copy:
filename.mine : the local file as it existed in the
working copy before the update
– This file has only the latest local changes in it.
filename.rOLDREV : the file that was the BASE
revision before the update.
– The file checked out before any local edit.
filename.rNEWREV : the file that Subversion client
just received from the server upon update.
– The HEAD revision of the repository.
The original file contains a mix version of HEAD
(.rNEW) and BASE (.mine) with change markers
52
52
26
15-May-20
Conflict example
You and Sally both edit file sandwich.txt at
the same time. Sally commits her changes,
and when you go to update your working
copy, you get a conflict
$ svn update
Conflict discovered in 'sandwich.txt'.
Select: (p)postpone,(df)diff-full,(e)edit,
(h)elp for more options : p
C sandwich.txt
Updated to revision 2.
53
53
Conflict example
In your working copy you get
$ ls
sandwich.txt
sandwich.txt.mine
sandwich.txt.r1
sandwich.txt.r2
54
54
27
15-May-20
Conflict example
The contents of the file sandwich.txt is
Top piece of bread
Mayonnaise
Lettuce Changes your made in
<<<<<<< .mine the conflicting area
Salami
Mortadella
Prosciutto Changes Sally previously
======= committed in the area
Sauerkraut
Grilled Chicken
>>>>>>> .r2
Creole Mustard
Bottom piece of bread
55
55
Conflict example
The updated file sandwich.txt you
create and saved is
56
56
28
15-May-20
Conflict example
Once the conflict has been composed
you ought to signal it has been
resolved
57
57
58
58
29
15-May-20
Branches in Subversion
Branches in subversion
exist as normal filesystem directories in the
repository
– carry some extra historical information
– Do not exist in some “extra dimension”
Subversion has no internal concept of a
branch—only copies.
A directory becomes a branch because that is
how we interpret it
Any copy brings also the previous history
59
59
Branches in Subversion
You create a branche with svn copy:
Memento:
Use svn switch to receive updates
of the trunk in your branch
60
60
30
15-May-20
61
61
Merge
When work is done in a branch, it must be
brought back into the trunk.
This is done by svn merge command.
Similar to svn diff command, instead of
printing the differences to your terminal, it
applies them directly to the local working copy.
Svn diff command ignores ancestry, svn merge
does not.
Two repository trees are compared, and the
differences are applied to a working copy.
Conflicts may be produced by svn merge:
They are solved in the usual way
62
62
31
15-May-20
Wrap-up session
Configuration management deals with
several issues:
1. Versioning
2. Configuration
3. Change control
4. Build management
Subversion is an open-source platform
supporting 1, 2, 3
63
63
64
64
32