public void SetUp() { FileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); // Ensure staging directory exists and is empty StagingDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestStaging"); FileSystem.EnsureDirectoryExists(StagingDirectory); FileSystem.PurgeDirectory(StagingDirectory, FailureOptions.ThrowOnFailure); Environment.SetEnvironmentVariable("TentacleJournal", Path.Combine(StagingDirectory, "DeploymentJournal.xml")); Variables = new VariableDictionary(); Variables.EnrichWithEnvironmentVariables(); Variables.Set(SpecialVariables.Tentacle.Agent.ApplicationDirectoryPath, StagingDirectory); //Chart Pckage Variables.Set(SpecialVariables.Package.NuGetPackageId, "mychart"); Variables.Set(SpecialVariables.Package.NuGetPackageVersion, "0.3.7"); Variables.Set(SpecialVariables.Packages.PackageId(""), $"#{{{SpecialVariables.Package.NuGetPackageId}}}"); Variables.Set(SpecialVariables.Packages.PackageVersion(""), $"#{{{SpecialVariables.Package.NuGetPackageVersion}}}"); //Helm Options Variables.Set(Kubernetes.SpecialVariables.Helm.ReleaseName, ReleaseName); //K8S Auth Variables.Set(Kubernetes.SpecialVariables.ClusterUrl, ServerUrl); Variables.Set(Kubernetes.SpecialVariables.SkipTlsVerification, "True"); Variables.Set(Kubernetes.SpecialVariables.Namespace, Namespace); Variables.Set(SpecialVariables.Account.AccountType, "Token"); Variables.Set(SpecialVariables.Account.Token, ClusterToken); AddPostDeployMessageCheckAndCleanup(); }
public void SetUp() { fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); // Ensure tenticle directory exists tentacleDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestTentacle"); var tentacleHiddenDirectory = Path.Combine(tentacleDirectory, ".tentacle"); fileSystem.EnsureDirectoryExists(tentacleDirectory); fileSystem.EnsureDirectoryExists(tentacleHiddenDirectory); fileSystem.PurgeDirectory(tentacleHiddenDirectory, FailureOptions.ThrowOnFailure); Environment.SetEnvironmentVariable("TentacleJournal", Path.Combine(tentacleHiddenDirectory, "DeploymentJournal.xml" )); variables = new VariableDictionary(); variables.EnrichWithEnvironmentVariables(); deploymentJournal = new DeploymentJournal(fileSystem, new SystemSemaphore(), variables); packagesDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestPackages"); fileSystem.EnsureDirectoryExists(packagesDirectory); stagingDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestStaging"); fileSystem.EnsureDirectoryExists(stagingDirectory); // Create some artificats const string retentionPolicySet1 = "retentionPolicySet1"; CreateDeployment(Path.Combine(packagesDirectory, "Acme.1.0.0.nupkg"), Path.Combine(stagingDirectory, "Acme.1.0.0"), new DateTimeOffset(new DateTime(2015, 01, 26), new TimeSpan(10, 0,0)), retentionPolicySet1); CreateDeployment(Path.Combine(packagesDirectory, "Acme.1.1.0.nupkg"), Path.Combine(stagingDirectory, "Acme.1.1.0"), new DateTimeOffset(new DateTime(2015, 02, 01), new TimeSpan(10, 0,0)), retentionPolicySet1); CreateDeployment(Path.Combine(packagesDirectory, "Acme.1.2.0.nupkg"), Path.Combine(stagingDirectory, "Acme.1.2.0"), new DateTimeOffset(new DateTime(2015, 02, 10), new TimeSpan(10, 0,0)), retentionPolicySet1); }
public override int Execute(string[] commandLineArguments) { Options.Parse(commandLineArguments); Guard.NotNullOrWhiteSpace(retentionPolicySet, "No retention-policy-set was specified. Please pass --retentionPolicySet \"Environments-2/projects-161/Step-Package B/machines-65/<default>\""); if (days <= 0 && releases <= 0) { throw new CommandException("A value must be provided for either --days or --releases"); } var variables = new VariableDictionary(); variables.EnrichWithEnvironmentVariables(); var fileSystem = new CalamariPhysicalFileSystem(); var deploymentJournal = new DeploymentJournal(fileSystem, new SystemSemaphore(), variables); var clock = new SystemClock(); var retentionPolicy = new RetentionPolicy(fileSystem, deploymentJournal, clock); retentionPolicy.ApplyRetentionPolicy(retentionPolicySet, days, releases); return(0); }
public virtual void SetUp() { FileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); ProxyLog = new ProxyLog(); // Ensure staging directory exists and is empty ApplicationDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestStaging"); FileSystem.EnsureDirectoryExists(ApplicationDirectory); FileSystem.PurgeDirectory(ApplicationDirectory, FailureOptions.ThrowOnFailure); Environment.SetEnvironmentVariable("TentacleJournal", Path.Combine(ApplicationDirectory, "DeploymentJournal.xml")); Variables = new VariableDictionary(); Variables.EnrichWithEnvironmentVariables(); Variables.Set(SpecialVariables.Tentacle.Agent.ApplicationDirectoryPath, ApplicationDirectory); }
public void SetUp() { fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); // Ensure staging directory exists and is empty stagingDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestStaging"); customDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestCustom"); fileSystem.EnsureDirectoryExists(stagingDirectory); fileSystem.PurgeDirectory(stagingDirectory, FailureOptions.ThrowOnFailure); Environment.SetEnvironmentVariable("TentacleJournal", Path.Combine(stagingDirectory, "DeploymentJournal.xml")); variables = new VariableDictionary(); variables.EnrichWithEnvironmentVariables(); variables.Set(SpecialVariables.Tentacle.Agent.ApplicationDirectoryPath, stagingDirectory); variables.Set("PreDeployGreeting", "Bonjour"); }
public void SetUp() { fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); // Ensure staging directory exists and is empty stagingDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestStaging"); customDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestCustom"); fileSystem.EnsureDirectoryExists(stagingDirectory); fileSystem.PurgeDirectory(stagingDirectory, FailureOptions.ThrowOnFailure); Environment.SetEnvironmentVariable("TentacleJournal", Path.Combine(stagingDirectory, "DeploymentJournal.xml" )); variables = new VariableDictionary(); variables.EnrichWithEnvironmentVariables(); variables.Set(SpecialVariables.Tentacle.Agent.ApplicationDirectoryPath, stagingDirectory); variables.Set("PreDeployGreeting", "Bonjour"); }
public override int Execute(string[] commandLineArguments) { Options.Parse(commandLineArguments); Guard.NotNullOrWhiteSpace(retentionPolicySet, "No retention-policy-set was specified. Please pass --retentionPolicySet \"Environments-2/projects-161/Step-Package B/machines-65/<default>\""); if (days <=0 && releases <= 0) throw new CommandException("A value must be provided for either --days or --releases"); var variables = new VariableDictionary(); variables.EnrichWithEnvironmentVariables(); var fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); var deploymentJournal = new DeploymentJournal(fileSystem, new SystemSemaphore(), variables); var clock = new SystemClock(); var retentionPolicy = new RetentionPolicy(fileSystem, deploymentJournal, clock); retentionPolicy.ApplyRetentionPolicy(retentionPolicySet, days, releases); return 0; }
public void SetUp() { fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); // Ensure tenticle directory exists tentacleDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestTentacle"); var tentacleHiddenDirectory = Path.Combine(tentacleDirectory, ".tentacle"); fileSystem.EnsureDirectoryExists(tentacleDirectory); fileSystem.EnsureDirectoryExists(tentacleHiddenDirectory); fileSystem.PurgeDirectory(tentacleHiddenDirectory, FailureOptions.ThrowOnFailure); Environment.SetEnvironmentVariable("TentacleJournal", Path.Combine(tentacleHiddenDirectory, "DeploymentJournal.xml")); Environment.SetEnvironmentVariable("TentacleHome", tentacleHiddenDirectory); variables = new VariableDictionary(); variables.EnrichWithEnvironmentVariables(); deploymentJournal = new DeploymentJournal(fileSystem, SemaphoreFactory.Get(), variables); packagesDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestPackages"); fileSystem.EnsureDirectoryExists(packagesDirectory); stagingDirectory = Path.Combine(Path.GetTempPath(), "CalamariTestStaging"); fileSystem.EnsureDirectoryExists(stagingDirectory); // Create some artificats const string retentionPolicySet1 = "retentionPolicySet1"; CreateDeployment(Path.Combine(packagesDirectory, "Acme.1.0.0.nupkg"), Path.Combine(stagingDirectory, "Acme.1.0.0"), new DateTimeOffset(new DateTime(2015, 01, 26), new TimeSpan(10, 0, 0)), retentionPolicySet1); CreateDeployment(Path.Combine(packagesDirectory, "Acme.1.1.0.nupkg"), Path.Combine(stagingDirectory, "Acme.1.1.0"), new DateTimeOffset(new DateTime(2015, 02, 01), new TimeSpan(10, 0, 0)), retentionPolicySet1); CreateDeployment(Path.Combine(packagesDirectory, "Acme.1.2.0.nupkg"), Path.Combine(stagingDirectory, "Acme.1.2.0"), new DateTimeOffset(new DateTime(2015, 02, 10), new TimeSpan(10, 0, 0)), retentionPolicySet1); }