integration of version control and code migration processes chapter 2 – from make to ant ja-sig -...

43
Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of Information Technology University of Wisconsin – Madison https://mywebspace.wisc.edu/ jfthomps/vc

Post on 20-Dec-2015

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

Integration of Version Control and

Code Migration ProcessesChapter 2 – from Make to Ant

JA-SIG - December 5, 2005 - Austin, TX

Jim ThompsonDivision of Information TechnologyUniversity of Wisconsin – Madison

https://mywebspace.wisc.edu/jfthomps/vc

Page 2: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 2

University of Wisconsin - Madison

• public land-grant university (est. 1848)• home of the Badgers• Big Ten conference (11 with Penn State)• over 40,000 students• consistently among top 5 in USA for

research funds• #1 large school for Peace Corps volunteers• Madison is the capital of Wisconsin

Page 3: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 3

My work group

• part of Division of Information Technology

• we design, build, acquire, install and support Internet infrastructure applications (a.k.a. upper middleware)– E-mail– Calendar– My WebSpace (see http://www.educause.edu/apps/eq/eqm05/eqm0548.asp)

– Portal

Page 4: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 4

Today’s presentation

• Review major features from “Chapter 1” – Some background info about current portal– How we use CVS, tags and scripts– How tags and scripts work with our portal

• Enhancements for our new portal– Tags and migration of uPortal frameworks– Ant, more new tags and reports

• Maybe some of this can work for you

Page 5: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 5

My UW-Madison (our portal)• http://my.wisc.edu provides access to

– E-mail– Calendar– My WebSpace– Application status and Enrollment– Financial Aid– Classes on the web (Learn@UW)– Course Resources– Grades (entry and review)– Guest Accounts (demo Annie Student & Andi Advisor)

Page 6: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 6

Some My UW-Madison statistics• September 2003 – over 1.3 million logins• Over a million logins/month thru May 2004• September 2004 (new usage records)

– Over 1.85 million logins by 49,900+ users

• September 2, 2004 (first day of instruction)– 85,739 logins by 29,676 users– About 6,000 users during lunch hour

• September 2005 (new UW home page)– Over 1.5 million logins by 51,000+ users

Page 7: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 7

My UW–Madison - some lingo• MUM = My UW–Madison• MUMMI = module inventory• MUMMR = migration request• MUMsters = developers• mumdev = development/test box (Solaris)• mumweb1,2 = web servers (Linux)• mumapp3,4 = app servers (Solaris)• New servers are named after mummies

Page 8: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 8

MUM Service Goals

• 24x7 availability (but not all connected systems are always up)

• Handle peak traffic without slowing down

• Good response time from called servers

• Minimize outages (frequency & duration)

• Weekly updates of production

Page 9: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 9

Production Updates

• All portal code is on our servers

• Prefer weekly releases

• Prepare a staged directory (Monday PM)

• Deploy early Tuesday (between 5 & 7 AM)

• Prefer “rolling restarts” to avoid outages

Page 10: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 10

Page 11: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 11

The road to production

• Files migrate thru 5 environments– Development– Test– QA– Production– Demo

• 3,000+ files in each environment

Page 12: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 12

Overview of environments

• Development– the Wild West– CVS available, but not required

• Test– Files must flow thru CVS to get to test– Developers apply “test” tag in CVS– Updates Mon-Fri 4:15 AM and “right now”– All test migrations stop/restart test

Page 13: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 13

Overview of environments • QA

– Files flow thru CVS– Developers request migration via MUMMR– Run load tests here

• Production– Files flow thru CVS

• Demo– Files flow thru CVS– Nearly as important as production

Page 14: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 14

Files flow thru CVS• Question: How do we control the flow?

– How to mark a file for promotion?– How to know what files got promoted…

• Which version?• Where?• When?

• Answer: CVS tags– Drive the process– Indicate what’s where, since when

Page 15: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 15

Some CVS tagsRequest Status Update History (old format)

test

intest or

outatest

intest_yyyymmdd_hhmm

outatest_yyyymmdd_hhmm

qa

inqa or

outaqa

inqa_yyyymmdd_hhmm

outaqa_yyyymmdd_hhmm

prod

inprod or

outaprod

inprod_yyyymmdd_hhmm

outaprod_yyyymmdd_hhmm

demo

indemo or

outademo

indemo_yyyymmdd_hhmm

outademo_yyyymmdd_hhmm

Page 16: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 16

CVS tag maintenance• Who maintains which tags?

– Developers apply and move test tags– MUM admins apply qa, prod, demo tags– Scripts apply and move in and outa tags– Scripts create update history tags

• What’s the purpose of the outa tags?– Track deletes (like adds and changes)– Encourage developers to clean up– Avoid permanent loss of old code (in Attic)

Page 17: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 17

Page 18: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 18

Why a MUMMR?

• Reproducible instructions

• QA is where we test the MUMMR– Complete list of files?– Clear instructions?– If we find problems, fix & resubmit MUMMR– Increase odds of successful production move

• Documentation– Tell Help Desk and others what’s coming

Page 19: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 19

Files flow

Page 20: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 20

CVS tags - Who cares?

• Developers– Where’s my code?

• Project Managers– Which version was installed where and when?

• Migration Controllers– What’s scheduled to move?

• Everyone– What’s the difference between X and Y?

Page 21: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 21

How comparing tags can help• Preparing to update 100+ production files

– Apply prod tags according to MUMMR– Refresh export of files tagged prod– Compare inqa and prod

• If all files are moving, there should be no diffs• All differences should be examined• Partial migrations are opportunities for problems

• Developers can use same technique– Compare intest and inqa to get MUMMR right

Page 22: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 22

That’s the main story, but…• Environmental files

– permanently branched in CVS (never merged)– 19 branches for properties.txt– convert: Tomcat to WebSphere to WebLogic– sometimes had 8+ active environments

• Sometimes have multi-flavored regular tags– wastest, testwls, test89, qa89, etc.– always kept test tag for current– normalized tags after conversion to WebLogic

Page 23: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 23

Some environmental branches• Current

– my-dev35-wl-mumdev & my-dev89…– my-test35-wl-mumdev & my-test89…– my-qa35-wl-qa & my-qa89…– my-prod35-wl-prod– my-demo35-wl-prod

• Former– bob-marley (ran on a PC)– my-spheredev-mumdev

Page 24: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 24

Controls in CVS

• Regular application files– tag changes limited via CVS filter (taginfo)

• Environmental files– anyone can grab a branch– commits trigger e-mail notice to MUM admins

• commits on dev or test branches are OK

• commits on other branches, if not by MUM admins, may cause questions

Page 25: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 25

Using these methods elsewhere• We built a similar system for a COBOL app

– CVS repository and app on AIX

– 6 files in production app directory

• Clean A-B-C design yields easy scripts– A-B-C = separation of App, Bin, Config files

• Contents of document aimed at 3 audiences– Managers (General Overview ~ 17 pages)

– Designers (Design Decisions ~ 5 pages)

– Implementers (Details & Example Scripts ~ 30 pages)

Page 26: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 26

Samples from “old” document• Our CVS taginfo filter calls tagcheck.pl• tagcheck.pl lets admins change any tag• How do we know tagcheck.pl is working?• see S.220 for test plan• brief primer on basics of CVS - G.040• blank MUMMR – X.110

https://mywebspace.wisc.edu/jfthomps/vc/intvc

Page 27: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 27

That was most of Chapter 1• Last year’s presentation

– More focus on A-B-C design

– Pointed out some documented cautions

– Tags for tracking uPortal conversion (ignored)

– Rant about optional version control

• Moving forward– Tagging and tracking uPortal frameworks

– Going beyond A-B-C … to X-Y-Z designs

– Ant, more new tags and reports

Page 28: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 28

Moving to uPortal

• What will change and what won’t?– Good bye, Makefiles… Hello, ant – Basic CVS tags and processes will continue– Simpler shell scripts; more complex build.xml– cvs-update.xml (build.xml) calls cvs-logntag.pl – Some new tags for uPortal frameworks– New (optional) milestone tags – Reports to find and compare tags

Page 29: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 29

uPortal frameworks in CVS• Import vendor files on vendor branch• Separate vendor branch for each vendor• Keep our local modifications on trunk• CVS tags to identify and control

– Vendor releases (Vup2-5-0)– Local customization testing (Rdev2-5-0)– Releases for our environments (Rdev, Rtest…)

• https://mywebspace.wisc.edu/jfthomps/vc/CVS_up.html

Page 30: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 30

More CVS TagsRequest test qa

Status intest or outatest inqa or outaqa

Update History

intest_upd_yyyymmdd_hhmm

outatest_upd_yyyymmdd_hhmm

inqa_upd_yyyymmdd_hhmm

outaqa_upd_yyyymmdd_hhmm

Pre-milestone

intest_b4_yyyymmdd_hhmm

(almost never used)

inqa_b4_yyyymmdd_hhmm

(sometimes used)

Milestone intest_at_yyyymmdd_hhmm

(almost never used)

inqa_at_yyyymmdd_hhmm

(sometimes used)

Page 31: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 31

Families of uPortal tags• Regular (app) tags

– test, qa, prod, demo

– status (in, outa), update history and milestone tags

• Framework tags– Vup2-5-0, Rdev2-5-0, Rdev, Rtest, Rqa, Rprod, Rdemo

– Rxx status (in, outa), update history and milestone tags

• Environment branches– my-dev-tc-mumdev, my-test-tc-mumdev, etc.

– thinking about status (in, outa) and milestone tags

Page 32: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 32

Which tags are used where?• Milestone tags are optional (0, 1 or 2)• Status tags are optional• Update history tags are optional• Custom blends are feasible

– Private (e.g., desktop/laptop) development– Update with prod (or qa) code for 90% of files– Update to HEAD where you’re working– Controlled chaos

Page 33: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 33

Finding uPortal environment files

• All over the place– in uPortal framework– in portlets– in batch directories– in admin directories

• Listed in map-cvs-branched-env-files.xml (maps found in multiple locations)

Page 34: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 34

Updating environment files

• Targets within cvs-update.xml– Find all map-cvs-branched-env-files.xml– Parse each map– Using 2 XSL style sheets, build and run cvs

updates for each mapped file and directory (using supplied ENV branch)

– Thank you, Bruce!

Page 35: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 35

Our busy Ant build.xml

• Major targets of cvs-update.xml– help– status (also run by each update)– updateApp– updateFwk– updateAll

• Main parameters of cvs-update.xml– several to specify, skip or set CVS tags

Page 36: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 36

Some uPortal updates

• Predev (for framework development)– updateAll –Dfwktag=Rdev2-5-0 –Dregtag=qa …

• Dev (release new framework)– updateFwk –Dfwktag=Rdev –DmodFwkTags=y …

• Test (usual test code update)– updateApp –Dregtag=test –DmodRegTags=y …

Page 37: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 37

Typical test update• Developer (or cron) runs update script• Script tees output and e-mails scanner• Scanner (via procmail) parses output

– Puts copy of raw output (~160k) on the web

– Builds HTML copy (anchor tags each problem)

– Builds HTML summary (2k map) on the web

– Mails summary (map) of results to developers

– Thank you, Curt!

• Update creates verbose CVS status report

Page 38: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 38

How to track herds of CVS tags

• Parse the verbose CVS status reports– Can also track Epicentric/Vignette files

• cvs-show-tags.pl finds and counts tags– Defaults to not showing Update History tags– Can include branch names (or all tags)

• cvs-diff-tags.pl compares 2 tags/branches– Option to show CVS revs of updated files– Summary of all changed files

Page 39: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 39

Tracking old and new

• Moving from Epicentric/Vignette to uPortal– Old CVS repository for 8 Epicentric instances– New CVS repository for 8 uPortal instances

• Essential requirements– CVS is always the absolute source– Scripts install all (no short cuts)

• What else might we tag and monitor?– a partridge in a pear tree?

Page 40: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 40

Getting our ducks in a row

• Yep, that duck is tagged

• Indeed, this duck is on a branch

Page 41: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 41

What can we share? When?

• Older Make-based methods are documented– for an A-B-C design (separate Apps & Config)– shell scripts and some perl

• Newer Ant-based methods are evolving– maps locate environment (config) files– shell scripts, cvs-update.xml and some perl– some earlier documents may still be relevant

• Share via Clearinghouse or wiki?

Page 42: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 42

What about subversion?

• Some folks use and like it a lot

• Using our tag scheme might not be trivial

• Need to spend some time with svn

• Others with svn experience?

• Version Control BoF to follow– Scott Battaglia (Rutgers) and I will co-host– Come and join us!

Page 43: Integration of Version Control and Code Migration Processes Chapter 2 – from Make to Ant JA-SIG - December 5, 2005 - Austin, TX Jim Thompson Division of

JA-SIG 12/5/2005 43

Questions

???

https://mywebspace.wisc.edu/jfthomps/vc

“Prediction is difficult, especially about the future.”– Yogi Berra