Posts Tagged ‘reparenting’

Pattern for Continuous Builds

March 5th, 2008 by admin

Continuous integration (CI) is all the rage these days because merging, building, and testing (shared) configurations early-and-often is a good thing. Actually, it’s a great thing! After all, finding problems sooner rather than later benefits everyone. For some, CI means simply testing compilation. (Phew… it works. Ship it! haha). For those investing time in a full test harness, CI may mean frequently executing a suite of tests at various levels (unit, functional, system) to validate functionality and identify regressions. I’ve even seen other levels of CI to include lab testing, flight testing, or even customer acceptance testing for even the smallest of changes. Regardless of how you ‘do’ CI, I’ll show how I use AccuRev for continuous integration. [Keep in mind that this is one interpretation of the subject matter]

The Pattern. The stream-based nature of AccuRev makes it very natural to define separate areas for development, integration, testing, and release. Managing CI Builds with AccuRevAs seen in my example stream structure, I have an Integration stream as the first point of merging between individual project streams. This Integration stream is a great place to hook up a CI tool [Cruise Control, CC.NET, FinalBuilder, QuickBuild and perform nightly or per-promote builds. I prefer to create a snapshot before doing the build mainly because snapshot creation is atomic and their immutable configurations guarantee reproducibility. After creating the snapshot, I will pull the build from the snapshot name. You could build from the Integration stream directly (similar to the concept of a moving label), but creating snapshots makes it easy to visually identify with the build process and compare good builds from bad builds with simple stream diffs.  [Note: integrating any of the above mentioned CI tools is as simple as telling the build tool to pull code from a stream (by name) and then configure the build tool to execute at some frequency and notify people of the build status]

What about all those snapshots? At first, you may think, “Isn’t this going to create a gazillion snapshots? Won’t that take up a ton of (disk) space and totally clutter the stream browser view?” Well… No.

  • Snapshots are cheap. Snapshots are extremely cheap server-side entities consuming ~100bytes regardless of the number of elements they label… so go nuts! Snapshots mark transaction numbers, not elements! I say, always do what you need to solve important problems and answer tough questions even if that means creating a gazillion snapshots; just be sure to organize them.
  • Clean up as you go. Your CI build script (build.xml, Makefile, or doBuild.sh) can easily be instructed to remove a snapshot for every snapshot created. I’d recommend keeping around enough snapshots (say 3 to 10) to do valuable work such as comparing builds or serving as temporary baselines for developers who want to reparent. As you can see in the stream structure, AccuRev stores both active and inactive snapshots and it is easy to reactivate any snapshot if necessary (I’ve enabled the stream browser to show both; lower left corner option).
  • Group snapshots. I prefer to tuck logically related sets of snapshots behind a locked pass-through stream. The pass-through stream lets me collapse them all as a group and the lock prevents the pass-through stream from being accidentally being reparented.

Tip for very-long build/test cycles. Over the past few years I’ve encountered a few shops with single build/test cycles ranging from hours to days to complete. In this case, the concept of CI is slightly challenging because the notion of frequent builds is constrained. In this case, I’d recommend setting up two distinct test phases; quick and full. The “quick phase” is a quick pass sanity test only performing tasks such as compilation and unit testing — enough to let developers know they can continue on forward progress with little concern. The “full phase” is the full blown cycle, taking hours/days to complete, that completes all levels of testing such as compilation, unit testing, functional testing, system testing, etc. I would execute the quick phase early and often while the full phase may be once per week. As an additional step, I would mark the snapshot used for the full phase with a pass-through stream for the purpose of reporting configuration diffs or letting developers reparent their project streams/workspaces on the latest known good “certified” build.

Interested in continuous integration? Perhaps you’d also be interested in multistage continuous integration

/happy building/ – dave

QCon’07 San Francisco – Agile Conference

November 9th, 2007 by dave

For those tracking the movement of luminaries such as Martin Fowler and Kent Beck or looking for scalability advice from the architects at companies like Orbitz, Ebay, and Linked-In… QCon ’07 in downtown San Francisco is the place to be!

The conference is packed with senior architects, software engineers, and open-source contributors galore — over 400 were rumoredDamon Poole / Cliff Utstein - AccuRev - QCon’07 to be in attendance. With speaker topics ranging from enterprise scalability to Agile practices, the audience was nothing short of being at the top of their game. Huddled together at the entrance to the conference rooms were a David Thomas - AccuRev - QCon’07number of vendors showing off new warez including AccuRev. Here’s a shot of Damon Poole & Cliff Utstein (top-right), Dave Thomas (left), and John Wall (bottom-right). The AccuRev booth had a John Wall - AccuRev - QCon'07constant flow of folks amazed at how the stream-based architecture brings a refreshing approach to managing software configurations and supporting agile practices. We also had some cameo appearances from existing customers like Authorize.Net and Orbitz.com.

Agile development methodologies is a major theme of the conference. For someone looking for advice on agile, just standing in the middle of the exhibit hall is all it takes — everyone is talking about best practices, success stories, and failed attempts.

We had a constant stream of people intrigued by our stream-based architecture and inherent support for agile practices. Here’s a list of common discussion points:

private workspaces: commit-early, commit-often

stream inheritance: merge-early, merge-often and sharing iterations early and automatically with parallel development efforts

issue tracking integration: assign, deliver and track development activity to stories/issues/features

continuous integration: integrations with cruise control, finalbuilder, electric-cloud, and others

refactoring: IDE integrations with eclipse, Intelli-J, Visual Studio support application-wide refactoring with version control

staged workflows: organize distributed teams and isolate integration areas from testing areas for explicit and repeatable access to known configurations.

snapshots: guaranteed reproducibility of labeled configurations for builds known to be ‘good’

reparenting: retarget active development to known good configurations for testing or stable development

If you didn’t have a chance to attend this years QCon, be sure to put next years event on your calendar!

/happy conferencing/ – dave

Reparenting Workspaces – What’s the hype?

September 21st, 2007 by dave

By now you’ve probably heard about workspace reparenting in AccuRev. You know… the fancy drag-n-drop of a workspace from one stream to another. But what’s all the hype? Ultimately, workspace reparenting means that a workspace, on disk, can ‘morph’ into the configuration of it’s parent stream (See video) . So one day you are working on a mainline feature and the next day, with a single command, you can instantly have the configuration from a buggy release 2 months ago on disk, in the same location, with the exact configuration of files at that point in time. Poof! Reparenting VideoWell… first off, reparenting isn’t magic. You see, each and every stream in AccuRev knows at least two things – (1) its parent stream and (2) any active changes to its own relative configuration. Knowledge of the parent stream is by way of reference, in the same way that an OO subclass knows of its parent class. So if you change the parent reference, you instantly have visibility into the new parent configuration, in combination with any active changes that come along for the ride (as needed, most likely). Remember, workspaces are streams too!

Fun Toy or Power Tool?

The only “fun toy” you’ll find in AccuRev is the easter egg hidden in Help–>About where if you press CapsLock-Pause with your left hand you can play a tetris clone… ok, kidding. Workspace reparenting is a wickedly powerful feature that, when used properly, can save time, energy, and disk space and be a great powertool. So when is reparenting useful?

Retargeting a Delivery – Remember the time when you spent Saturday night cranking out a hot-fix… only for it to be reclassified to a lower priority on Monday and scheduled for next weeks build? No problem! Simply reparent your workspace from the release hotfix stream to the mainline area and promote the changes. done. go home.

Large Code Footprints – Lets say you have a 400Gb footprint of source code for any given release. On a particular day, you just finished committing 174 source files to mainline for a new feature. You then get tasked to the bug squad to tackle 9 high-priority bugs found in the recent production release. Rather than creating a brand new workspace from the old release snapshot, you can simply reparent your ‘mainline’ workspace and run update. You’ll most likely get the old versions of 174 files and probably a few dozen or hundred other files that changed… but the point is, you just get the delta. And waiting for 2G of changes over the wire compared to 400G is a significant time savings for you and others sharing the pipe.

Tracing Defects - You know those bugs that crop up and someone asks, “how long has that runtime defect been around?” Take a single workspace, create a unit test that forces the failure, then reparent to each and every release snapshot in question. Each time you do an update, you’ll get a corresponding configuration of code on disk -and- the tweaked unit test (active changes come along for the ride, remember!). Run the test, verify the failure. Bingo – a recipe to quickly test how far back a defect went. Just keep reparenting and running the test(s) until you find a configuration that works.

Rapid Application Development – Are you responsible for cranking out a few features all at once? Need to hop between them frequently? Sure, you could create a separate workspace for each feature and that’s probably a better practice in most cases… but nothing stops you from using a single workspace and context-switching by reparenting. As long as you keep/promote each feature’s set of files out of the workspace, then reparenting is a breeze. This works well if you follow a stream-per-feature paradigm.

So now you might say, “But isn’t reparenting the same as updating my local work area with a different ‘branch’?” Nope. Don’t forget about the most significant architectural difference between streams and branches… inheritance. We’ll save that for another thread.

One of the great things about workspaces is that they are a super tiny meta-data record in the AccuRev meta-database… just a pointer to parent stream and pointer to host machine and dir on disk. That’s it. Workspaces are cheap entities. Reparenting simply changes the single parent reference reference and updating only retrieves the deltas. Make reparenting part of your routine and the benefits will follow.

/happy reparenting/ – dave