This tutorial continues on from the previous tutorials Part 1: Create your First ProjectPart 2: Create your First ConfigurationPart 3: Create your First Repository and Part 4: Create your First Action and it is recommended that these are completed before reading this tutorial.

In our previous tutorials we setup our build environment and we are now ready to successfully run our first build.

Running our Configuration

From the homepage, click on the configuration name to navigate to the Configuration Activity page, as shown below. If you attempted to run a build before we created our action workflow then you should see that our Fail Streak is 1 and 1 failed build has run.

So lets run our build by clicking the Quick Build Button (Fast Forward) in the top right hand corner of the screen. When a build begins executing it is added to the build queue while it searches for a compatible agent that can run all actions in the build's first stage. By default, Continua installs a local agent on the server, however additional agent licences can be purchased to enable distributed builds. Once a suitable agent has been found, the build will be removed from the queue and become a Running Build, as shown below.

Completed Builds

Once a build has completed, it will be displayed as either a green or red build, signifying whether the build finished successfully or failed. Regardless of the result, the Configuration Activity Page will provide an overview of the last 10 builds that were run. More details can be found by clicking on the build number, which will take you to the Build Detail page. So lets click on the last successful build and have a closer look at what happened.

Build Activity

The Build Activity page provides an overview for a specific build. Along the top of the page you should notice several tabs that provide additional information regarding the current build. More information regarding these pages can be found in the Viewing Build Results Section. Feel free to poke around the builds section and check what information is available to you.

Accessing your Build Source

Remember how in Part 4: Create your First Action we set the output path of the MSBuild action to $Workspace$/output? By setting this as our output directory, Continua passed our compiled project back to the Continua Server. When an agent passes source back to the server, it is stored in the server's ContinuaShare, which you specified during the Continua install. Your source can be accessed through the ContinuaShare, however this is not the easiest way to access your project. Instead, lets create another stage in our build process and send our source to a more accessible location.

So lets navigate back to the Workflow editor in the Configuration Wizard and add another stage by clicking the Add Stage button. This stage will be responsible for the sole task of moving our completed project, so lets call our stage Move Project.

Once the new stage has been created, it will be added to the Stage Editor after our existing Build Stage, as shown below. These stages can be dragged around to change their execution order and clicking on the stage will select it, which will show all the actions that will be executed in that stage. With our Move Project stage selected, our MSBuild action will not be shown in the Action Workflow Editor as that action is executed in the Build stage.

Create Directory Action

So with our Move Project stage selected, we will need to add two actions, a Create Directory Action and a Copy Action. Basically we are copying the files over to a more accessible location, but by running the Create directory action first, we are guaranteeing that our directory exists. For this example I want to copy all my project files to C:\ContinuaTutorial on my Continua Server. So find the Create Directory action under the File Operations action category and set the Path to \\$Server.Hostname$\c$$\ContinuaTutorial, as shown below. When specifying file locations, always remember that this stage could run on ANY Agent. If I pointed my Create Directory action to C:\ContinuaTutorial then this folder would be created on the Agent machine rather than the Continua Server. If this stage was run on the local agent then the folder would be created on the Continua server correctly, however this would be incorrect if a distributed agent was running this stage.

So lets break this path down.

  • You can see that we are getting the Server's hostname from a Continua Dynamic Object by calling $Server.Hostname$.
  • We need to specify the C:/ local drive, however the dollar ($) sign is a reserved character in any fields that accept Query Expressions. In Continua you can escape reserved characters by doubling them up. ie. $$. So instead of calling c$ for the local drive, we need to call c$$.
  • The actual directory that we want to create, ContinuaTutorial, is then specified. At runtime this path would then be read as \\<server_name\c$\ContinuaTutorial

When saving this Create Directory action, make sure it is enabled and Fail if directory exists is NOT checked, as we want the project to copy over the existing project every time we run a build.

Copy Action

Once we have added a Create Directory action, we need to create a copy action. Basically we want to copy our project files from the Agent workspace to our ContinuaTutorial folder. So lets add a Copy Action which is also under the File Operations action category. Set the source directory to $Workspace$\Output and similarly to the Create Directory action, lets set the Destination Directory to \\$Server.Hostname$\c$$\ContinuaTutorial. Before we save the action we should also make sure it is enabled, that File Names / Patterns is set to **.** (This tells the action copy everything) and that Overwrite existing files IS checked.

Once both the Create Directory action and the Copy Action have been created, your action workflow should look something like the screenshot below. So lets hit Save & Complete Wizard and then run our build again.

Running Our Configuration - Again

If your build finished successfully then open up Windows explorer and navigate to ContinuaTutorial folder we created in the Action Workflow. If your project failed then double check the properties you set on your actions against the examples provided above.

If everything went according to plan then you should see the built Fluent NHibernate project in your Continua Tutorial folder, as shown below!

As the proverbial saying goes, there is more than one way to skin a cat, and this tutorial only demonstrates one method of accessing your built projects. All of your projects can be accessed directly through the Continua Share, moved around with Workspace Rules or accessed using a different action. The choice is really yours. While it may not make sense to copy your built projects back onto the Continua Server, this tutorial provides a guide for how you can move your project around. For example you may want to copy the project onto your production server once Continua has built your project.

We are now almost at the finish line. Currently running a build manually isn't really that useful as you still need to hit the run button but this is all about to change.

Continue on to the final segment of this tutorial, Part 6: Automate your Builds.

Part 6: Automate your Builds

  • No labels