private async Task <ProjectResource> BuildClientProject(ProjectGroupResource projectGroup, LifecycleResource normalLifecycle, LibraryVariableSetResource[] libraryVariableSets, Func <string, TagResource> getTag) { Log.Information("Setting up client project..."); var clientProjectEditor = await Repository.Projects.CreateOrModify("Truck Tracker Client", projectGroup, normalLifecycle); await clientProjectEditor.SetLogo(SampleImageCache.DownloadImage("http://b2bimg.bridgat.com/files/GPS_Camera_TrackerGPS_Camera_Tracking.jpg", "GPS_Camera_TrackerGPS_Camera_Tracking.jpg")); clientProjectEditor.IncludingLibraryVariableSets(libraryVariableSets) .Customize(p => p.TenantedDeploymentMode = TenantedDeploymentMode.Tenanted); var channel = await clientProjectEditor.Channels.CreateOrModify("1.x Normal", "The channel for stable releases that will be deployed to our production trucks."); channel.SetAsDefaultChannel() .AddOrUpdateTenantTags(getTag("Canary"), getTag("Stable")); await clientProjectEditor.Channels.Delete("Default"); var deploymentProcess = await clientProjectEditor.DeploymentProcess; deploymentProcess.AddOrUpdateStep("Deploy Application") .TargetingRoles("truck") .AddOrUpdateScriptAction("Deploy Application", new InlineScriptActionFromFileInAssembly("TrucksSample.Client.Deploy.fsx"), ScriptTarget.Target); var machineFilter = new MachineFilterResource(); machineFilter.EventGroups.Add("MachineAvailableForDeployment"); await clientProjectEditor.Triggers.CreateOrModify("Auto-Deploy to trucks when available", machineFilter, new AutoDeployActionResource()); await clientProjectEditor.Save(); return(clientProjectEditor.Instance); }
private async Task BuildClientProject(ProjectGroupResource projectGroup, LifecycleResource normalLifecycle) { var clientProjectEditor = await Repository.Projects.CreateOrModify("Truck Tracker Client", projectGroup, normalLifecycle); await clientProjectEditor.SetLogo(SampleImageCache.DownloadImage("http://b2bimg.bridgat.com/files/GPS_Camera_TrackerGPS_Camera_Tracking.jpg", "GPS_Camera_TrackerGPS_Camera_Tracking.jpg")); var variables = await clientProjectEditor.Variables; variables.AddOrUpdateVariableValue("TrackerUrl", "https://trucktracker.com/trucks/#{Octopus.Machine.Name}"); var channel = await clientProjectEditor.Channels.CreateOrModify("1.x Normal", "The channel for stable releases that will be deployed to our production trucks."); channel.SetAsDefaultChannel(); await clientProjectEditor.Channels.Delete("Default"); var deploymentProcess = await clientProjectEditor.DeploymentProcess; deploymentProcess.AddOrUpdateStep("Deploy Application") .TargetingRoles("truck") .AddOrUpdateScriptAction("Deploy Application", new InlineScriptActionFromFileInAssembly("TrucksSample.Client.Deploy.fsx"), ScriptTarget.Target); var machineFilter = new MachineFilterResource(); machineFilter.EventGroups.Add("MachineAvailableForDeployment"); await clientProjectEditor.Triggers.CreateOrModify("Auto-Deploy to trucks when available", machineFilter, new AutoDeployActionResource()); await clientProjectEditor.Save(); }