// TODO -- end to end tests on this monster -- including failure cases public void Deploy(DeploymentOptions options) { // need to log inside of reader var plan = BuildPlan(options); plan.AssertAllRequiredValuesAreFilled(); try { var runners = _factory.BuildRunners(plan); int totalCount = runners.Sum(x => x.InitializerCount + x.DeployerCount + x.FinalizerCount); StartSteps(totalCount, "Running all directives"); //LOG: running initializers runners.Each(x => x.InitializeDeployment()); //LOG: running deployers runners.Each(x => x.Deploy()); //LOG: running finalizer runners.Each(x => x.FinalizeDeployment()); } finally { _reporter.WriteReport(options, plan); _system.DeleteDirectory(plan.Settings.StagingDirectory); } }
// TESTING CTOR ONLY!!!!!!!! private DeploymentPlan(DeploymentSettings settings, DeploymentOptions options, IEnumerable<Recipe> recipes, IEnumerable<HostManifest> hosts) { _recipes = recipes; settings.Plan = this; _hosts = hosts; _options = options; _rootData = new SettingsData(); }
public DeploymentPlan BuildPlan(DeploymentOptions options) { var plan = _reader.Read(options); plan.WriteToConsole(); _bottles.AssertAllBottlesExist(plan.BottleNames()); return plan; }
public void SetUp() { theInput = new DeployInput() { ProfileFlag = "milkman" }; theInput.OverrideFlag = "a:1;b:2;c:3"; theOptions = theInput.CreateDeploymentOptions(); }
public void WriteReport(DeploymentOptions options, DeploymentPlan plan) { var report = new DeploymentReport("Deployment Report"); report.WriteDeploymentPlan(plan); report.WriteLoggingSession(_diagnostics.Session); ConsoleWriter.Line(); ConsoleWriter.PrintHorizontalLine(); ConsoleWriter.Write("Writing deployment report to " + options.ReportName.ToFullPath()); report.Document.WriteToFile(options.ReportName); }
public DeploymentGraph Read(DeploymentOptions options) { _settings.AddImportedFolders(options.ImportedFolders); var allRecipes = _settings.Directories.Select(x => x.AppendPath(ProfileFiles.RecipesDirectory)).SelectMany(RecipeReader.ReadRecipes); return new DeploymentGraph{ Environment = EnvironmentSettings.ReadFrom(_settings.EnvironmentFile()), Profile = Profile.ReadFrom(_settings, options.ProfileName), Recipes = allRecipes, Settings = _settings }; }
public DeploymentGraph Read(DeploymentOptions options) { _settings.AddImportedFolders(options.ImportedFolders); var allRecipes = _settings.AllRecipies(); var env = EnvironmentSettings.ReadFrom(_settings.EnvironmentFile); var profile = Profile.ReadFrom(_settings, options.ProfileName, options.SettingProfileName); return new DeploymentGraph { Environment = env, Profile = profile, Recipes = allRecipes, Settings = _settings }; }
public DeploymentOptions CreateDeploymentOptions() { var options = new DeploymentOptions(GetProfile()){ ReportName = ReportFlag }; enhanceDeploymentOptions(options); if(RecipeFlag != null) { options.RecipeNames.Fill(RecipeFlag); } if (SettingsProfileFlag != null) { options.SettingProfileName = SettingsProfileFlag; } return options; }
public DeploymentOptions CreateDeploymentOptions() { var options = new DeploymentOptions(GetProfile()){ ReportName = ReportFlag }; enhanceDeploymentOptions(options); if(RecipeFlag != null) { options.RecipeNames.Fill(RecipeFlag); } if (ImportedFolders != null) { options.ImportedFolders.AddRange(ImportedFolders); } return options; }
public void puts_any_overrides_onto_profile() { var options = new DeploymentOptions(); options.Overrides["Shared"] = "override-val"; options.Overrides["Profile1"] = "override-profile1-val"; var plan = new DeploymentPlan(options, new DeploymentGraph() { Environment = theEnvironment, Profile = theProfile, Recipes = theRecipes, Settings = new DeploymentSettings() { TargetDirectory = "target" } }); plan.GetSubstitutionDiagnosticReport().Single(x => x.Key == "Shared") .Value.ShouldEqual("override-val"); plan.GetSubstitutionDiagnosticReport().Single(x => x.Key == "Profile1") .Value.ShouldEqual("override-profile1-val"); }
public DeploymentPlan(DeploymentOptions options, DeploymentGraph graph) { _options = options; _graph = graph; _recipes = readRecipes(); _hosts = collateHosts(_recipes); addProfileSettings(); addEnvironmentSettings(); readRoot(); graph.Settings.Plan = this; graph.Settings.Environment = _graph.Environment; graph.Settings.Profile = _graph.Profile; options.Overrides.Each((key, value) => { _graph.Profile.Data[key] = value; }); }
public void WriteReport(DeploymentOptions options, DeploymentPlan plan) { Console.WriteLine("Environment"); plan.Settings.Environment.Data.AllKeys.Each(key => { var value = plan.Settings.Environment.Data[key]; //province data? //resolve substitutions Console.WriteLine("{0}={1}",key, value); }); plan.Hosts.Each(host => { host.AllSettingsData().Each(s => { s.AllKeys.Each(key => { Console.WriteLine("{0}:{1}:{2}:{3}", s.Category, s.Provenance, key, s[key]); }); }); }); }
protected virtual void enhanceDeploymentOptions(DeploymentOptions options) { }
public void CreateBundle(string destination, DeploymentOptions options) { var plan = _controller.BuildPlan(options); CreateBundle(destination, plan); }
public DeploymentPlan Read(DeploymentOptions options) { var graph = _reader.Read(options); return new DeploymentPlan(options, graph); }
public void SetUp() { var writer = new DeploymentWriter("clonewars"); var recipeDefinition = writer.RecipeFor("r1"); var host = recipeDefinition.HostFor("h1"); host.AddDirective(new SimpleSettings { One = "one", Two = "two" }); host.AddDirective(new OneSettings() { Name = "Jeremy", Age = 37 }); host.AddReference(new BottleReference() { Name = "bottle1" }); host.AddReference(new BottleReference() { Name = "bottle2" }); recipeDefinition.HostFor("h2").AddProperty<ThreeSettings>(x => x.Direction, "North"); recipeDefinition.HostFor("h3").AddProperty<TwoSettings>(x => x.City, "Austin"); writer.RecipeFor("r2").HostFor("h3").AddProperty<SimpleSettings>(x => x.One, "one"); writer.RecipeFor("r3").HostFor("h3").AddProperty<SimpleSettings>(x => x.Two, "two"); writer.RecipeFor("r4").HostFor("h4").AddProperty<SimpleSettings>(x => x.Two, "ten"); writer.RecipeFor("r4").HostFor("h5").AddProperty<SimpleSettings>(x => x.Two, "ten"); writer.RecipeFor("r4").HostFor("h5").AddProperty<SimpleSettings>(x => x.One, "*{dbName}*"); writer.AddEnvironmentSetting<SimpleSettings>(x => x.Two, "h4", "env-value"); writer.AddEnvironmentSetting("dbName", "blue"); writer.ProfileFor("default").AddRecipe("r1"); writer.ProfileFor("default").AddRecipe("r2"); writer.ProfileFor("default").AddRecipe("r3"); writer.ProfileFor("default").AddRecipe("r4"); writer.Flush(FlushOptions.Wipeout); var settings = new DeploymentSettings("clonewars"); var reader = new DeploymentGraphReader(settings); var options = new DeploymentOptions("default"); var graph = reader.Read(options); thePlan = new DeploymentPlan(options, graph); theHosts = thePlan.Hosts; }
public override void SetUp(ITestContext context) { _options = new DeploymentOptions(); context.Store(_options); }
public override void SetUp(ITestContext context) { _deploymentSettings = context.Retrieve<DeploymentSettings>(); _deploymentOptions = context.Retrieve<DeploymentOptions>(); var reader = new DeploymentGraphReader(_deploymentSettings); var graph = reader.Read(_deploymentOptions); _plan = new DeploymentPlan(_deploymentOptions, graph); }