Enhancing Version Control for Efficient Code Migration Processes
430 likes | 517 Vues
Explore a comprehensive guide on integrating version control and code migration, with tips on using CVS, tags, and scripts in real-world scenarios to enhance the code migration process. Learn about the significance of Ant for smoother workflow. Discover how this approach can benefit your development projects.
Enhancing Version Control for Efficient Code Migration Processes
E N D
Presentation Transcript
Integration of Version Control and Code Migration ProcessesChapter 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
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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) JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
The road to production • Files migrate thru 5 environments • Development • Test • QA • Production • Demo • 3,000+ files in each environment JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
Some CVS tags JA-SIG 12/5/2005
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) JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
Files flow JA-SIG 12/5/2005
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? JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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) JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
More CVS Tags JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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) JA-SIG 12/5/2005
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! JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 … JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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 JA-SIG 12/5/2005
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? JA-SIG 12/5/2005
Getting our ducks in a row • Yep, that duck is tagged • Indeed, this duck is on a branch JA-SIG 12/5/2005
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? JA-SIG 12/5/2005
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! JA-SIG 12/5/2005
Questions ??? https://mywebspace.wisc.edu/jfthomps/vc “Prediction is difficult, especially about the future.” – Yogi Berra JA-SIG 12/5/2005