This is post 5 in an ongoing series titled Automatic packages from TFS
Having looked at all the pipeline components for package generation last week, now it's time for a wrap up for this series.
As I mentioned in one of the earlier posts, as I worked through the code for this prototype, I changed my mind a bit on some of the basic architecture for the core program from the first post. I ended up re-working the configuration from the original idea and making the source control input and package saving output into configurable options.
The model class for the command line options became this:
public class CommandLineParameters { [Argument(ArgumentType.Required | ArgumentType.AtMostOnce, HelpText="The xml configuration file", ShortName = "c", LongName = "config")] public string ConfigFile; [Argument(ArgumentType.Required | ArgumentType.AtMostOnce, HelpText = "Starting changeset number", ShortName = "s", LongName = "start")] public int StartChangeSet; [Argument(ArgumentType.AtMostOnce, HelpText = "Ending changeset number", ShortName = "e", LongName = "end", DefaultValue = -1)] public int EndChangeSet; [Argument(ArgumentType.AtMostOnce, HelpText = "The file name for the generated package", ShortName = "p", LongName = "package", DefaultValue = "GeneratedPackage.xml")] public string PackageFileName; }
First of all, the XML configuration file is a required parameter, as if this file cannot be loaded the tool cannot proceed. The starting and ending changeset numbers and the package file name stay the same. And the package name itself has moved to the config file.
The configuration for the input and output in the XML file rely on finding types that inherit from two new interfaces:
public interface IInput { void Initialise(ProjectConfiguration config); IDictionary<string, SourceControlActions> ProcessWorkItems(string workingFolder, int firstChange, int lastChange); } public interface IOutput { void Initialise(ProjectConfiguration config); void Store(XElement data, string filename); }
For the moment, all I've done is add the initialise method to pass in the configuration and extract the pre-existing processing behaviour into the interfaces. But I'm thinking about how these might be refactored to make them more generic in future work. Maybe allowing fetching source changes from GIT, or using a web service call out to a Sitecore instance to generate the actual package file rather than just generating the definition.
If you're interested in looking at the source in more detail, and running this prototype yourself, then you can download the source here. But remember, it's just a prototype, so best not to rely on it for critical stuff until you're satisfied it does what you need. |
My next goal for this tool is to use it as my primary means of generating deployments for an upcoming project. Testing it against a real-world project should do two things: Firstly it will validate whether the overall approach of the software meets the requirements of the development projects I'm running. And secondly, it should help find any issues with the prototype code itself.
Other things I'm thinking about that could be done to improve the tool include:
So chances are I'll drag the odd further blog post out of this bit of work...
↑ Back to top