Esempio n. 1
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" ));

            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 void SetUp()
 {
     tempDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); 
     insensitiveVariablesFileName = Path.Combine(tempDirectory, "myVariables.json");
     sensitiveVariablesFileName = Path.ChangeExtension(insensitiveVariablesFileName, "secret");
     fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem();
 }
 public void SetUp()
 {
     variables = new CalamariVariableDictionary();
     variables.Set(SpecialVariables.OriginalPackageDirectoryPath, stagingDirectory);
     fileSystem = Substitute.For<ICalamariFileSystem>();
     deployment = new RunningDeployment(packageFilePath, variables);
 }
        public void Deploy()
        {
            OctopusTestAzureSubscription.IgnoreIfCertificateNotInstalled();

            var nugetPackageFile = PackageBuilder.BuildSamplePackage("Octopus.Sample.AzureCloudService", "1.0.0");

            var variablesFile = Path.GetTempFileName();
            var variables = new VariableDictionary();
            OctopusTestAzureSubscription.PopulateVariables(variables);
            OctopusTestCloudService.PopulateVariables(variables);
            variables.Set(SpecialVariables.Action.Azure.Slot, "Staging");
            variables.Set(SpecialVariables.Action.Azure.SwapIfPossible, false.ToString());
            variables.Set(SpecialVariables.Action.Azure.UseCurrentInstanceCount, false.ToString());

            variables.Set(SpecialVariables.Action.Name, "AzureCloudService");
            variables.Set(SpecialVariables.Release.Number, "1.0.0");

            // Disable cspkg extraction
            variables.Set(SpecialVariables.Action.Azure.CloudServicePackageExtractionDisabled, true.ToString());

            fileSystem = new WindowsPhysicalFileSystem();
            stagingDirectory = Path.GetTempPath();
            variables.Set(SpecialVariables.Action.Azure.PackageExtractionPath, stagingDirectory);

            variables.Save(variablesFile);

            result = Invoke(
                Calamari()
                    .Action("deploy-azure-cloud-service")
                    .Argument("package", nugetPackageFile)
                    .Argument("variables", variablesFile));
        }
 public PackagedScriptConvention(string scriptFilePrefix, ICalamariFileSystem fileSystem, IScriptEngine scriptEngine, ICommandLineRunner commandLineRunner)
 {
     this.scriptFilePrefix = scriptFilePrefix;
     this.fileSystem = fileSystem;
     this.scriptEngine = scriptEngine;
     this.commandLineRunner = commandLineRunner;
 }
 public UploadAzureCloudServicePackageConvention(ICalamariFileSystem fileSystem, IAzurePackageUploader azurePackageUploader,
     ISubscriptionCloudCredentialsFactory credentialsFactory)
 {
     this.fileSystem = fileSystem;
     this.azurePackageUploader = azurePackageUploader;
     this.credentialsFactory = credentialsFactory;
 }
 public ExtractPackageToStagingDirectoryConvention(
     IPackageExtractor extractor,
     ICalamariFileSystem fileSystem,
     String subDirectory = "staging")
     : base(extractor, fileSystem)
 {
     SubDirectory = subDirectory;
 }
 public DeployAzureCloudServicePackageConvention(ICalamariFileSystem fileSystem, ICalamariEmbeddedResources embeddedResources,
                                                 IScriptEngine scriptEngine, ICommandLineRunner commandLineRunner)
 {
     this.fileSystem        = fileSystem;
     this.embeddedResources = embeddedResources;
     this.scriptEngine      = scriptEngine;
     this.commandLineRunner = commandLineRunner;
 }
        public void SetUp()
        {
            fileSystem = Substitute.For <ICalamariFileSystem>();
            fileSystem.RemoveInvalidFileNameChars(Arg.Any <string>()).Returns(c => c.Arg <string>().Replace("!", ""));

            variables      = new CalamariVariables();
            extractPackage = new ExtractPackage(Substitute.For <ICombinedPackageExtractor>(), fileSystem, variables, new InMemoryLog());
        }
Esempio n. 10
0
 public ConfigurationTransformsBehaviour(ICalamariFileSystem fileSystem, IVariables variables, IConfigurationTransformer configurationTransformer, ITransformFileLocator transformFileLocator, ILog log)
 {
     this.fileSystem = fileSystem;
     this.variables  = variables;
     this.configurationTransformer = configurationTransformer;
     this.transformFileLocator     = transformFileLocator;
     this.log = log;
 }
Esempio n. 11
0
 public JavaLibraryCommand(IScriptEngine scriptEngine, ICalamariFileSystem fileSystem, IVariables variables, ICommandLineRunner commandLineRunner)
 {
     Options.Add("actionType=", "The step type being invoked.", v => actionType = v);
     this.scriptEngine      = scriptEngine;
     this.fileSystem        = fileSystem;
     this.variables         = variables;
     this.commandLineRunner = commandLineRunner;
 }
Esempio n. 12
0
 public HelmChartPackageDownloader(ICalamariFileSystem fileSystem)
 {
     this.fileSystem = fileSystem;
     client          = new HttpClient(new HttpClientHandler {
         AutomaticDecompression = DecompressionMethods.None
     });
     endpointProxy = new HelmEndpointProxy(client);
 }
Esempio n. 13
0
 public DockerImagePackageDownloader(IScriptEngine scriptEngine, ICalamariFileSystem fileSystem, ICommandLineRunner commandLineRunner, IVariables variables, ILog log)
 {
     this.scriptEngine      = scriptEngine;
     this.fileSystem        = fileSystem;
     this.commandLineRunner = commandLineRunner;
     this.variables         = variables;
     this.log = log;
 }
Esempio n. 14
0
 public RePackArchiveConvention(
     ICalamariFileSystem fileSystem,
     ICommandOutput commandOutput,
     ICommandLineRunner commandLineRunner)
 {
     this.fileSystem = fileSystem;
     this.jarTool    = new JarTool(commandLineRunner, commandOutput, fileSystem);
 }
Esempio n. 15
0
 public CleanCommand(IVariables variables, ICalamariFileSystem fileSystem)
 {
     this.variables  = variables;
     this.fileSystem = fileSystem;
     Options.Add("retentionPolicySet=", "The release-policy-set ID", x => retentionPolicySet = x);
     Options.Add("days=", "Number of days to keep artifacts", x => int.TryParse(x, out days));
     Options.Add("releases=", "Number of releases to keep artifacts for", x => int.TryParse(x, out releases));
 }
 public DeployAzureCloudServicePackageConvention(ICalamariFileSystem fileSystem, ICalamariEmbeddedResources embeddedResources, 
     IScriptEngine scriptEngine, ICommandLineRunner commandLineRunner)
 {
     this.fileSystem = fileSystem;
     this.embeddedResources = embeddedResources;
     this.scriptEngine = scriptEngine;
     this.commandLineRunner = commandLineRunner;
 }
Esempio n. 17
0
 public PackagedScriptRunner(ILog log, string scriptFilePrefix, ICalamariFileSystem fileSystem, IScriptEngine scriptEngine, ICommandLineRunner commandLineRunner)
 {
     this.log = log;
     this.scriptFilePrefix  = scriptFilePrefix;
     this.fileSystem        = fileSystem;
     this.scriptEngine      = scriptEngine;
     this.commandLineRunner = commandLineRunner;
 }
Esempio n. 18
0
 public ConfiguredScriptConvention(string deploymentStage, IScriptEngineSelector scriptEngineSelector,
                                   ICalamariFileSystem fileSystem, ICommandLineRunner commandLineRunner)
 {
     this.deploymentStage      = deploymentStage;
     this.scriptEngineSelector = scriptEngineSelector;
     this.fileSystem           = fileSystem;
     this.commandLineRunner    = commandLineRunner;
 }
 public ConfiguredScriptConvention(string deploymentStage, IScriptEngine scriptEngine,
     ICalamariFileSystem fileSystem, ICommandLineRunner commandLineRunner)
 {
     this.deploymentStage = deploymentStage;
     this.scriptEngine = scriptEngine;
     this.fileSystem = fileSystem;
     this.commandLineRunner = commandLineRunner;
 }
Esempio n. 20
0
 public FeatureScriptConvention(string deploymentStage, ICalamariFileSystem fileSystem, ICalamariEmbeddedResources embeddedResources,
                                IScriptEngine scriptEngine, ICommandLineRunner commandLineRunner)
 {
     this.deploymentStage   = deploymentStage;
     this.fileSystem        = fileSystem;
     this.embeddedResources = embeddedResources;
     this.scriptEngine      = scriptEngine;
     this.commandLineRunner = commandLineRunner;
 }
Esempio n. 21
0
 public RePackArchiveConvention(
     ILog log,
     ICalamariFileSystem fileSystem,
     JarTool jarTool)
 {
     this.log        = log;
     this.fileSystem = fileSystem;
     this.jarTool    = jarTool;
 }
        public void SetUp()
        {
            fileSystem = Substitute.For<ICalamariFileSystem>();
            variables = new VariableDictionary();
            variables.Set(SpecialVariables.OriginalPackageDirectoryPath, StagingDirectory);
            deployment = new RunningDeployment(StagingDirectory, variables);

            convention = new ChooseCloudServiceConfigurationFileConvention(fileSystem);
        }
Esempio n. 23
0
        public void SetUp()
        {
            fileSystem = Substitute.For<ICalamariFileSystem>();
            deploymentJournal = Substitute.For<IDeploymentJournal>();
            clock = Substitute.For<IClock>();
            retentionPolicy = new RetentionPolicy(fileSystem, deploymentJournal, clock);

            now = new DateTimeOffset(new DateTime(2015, 01, 15), new TimeSpan(0, 0, 0));
            clock.GetUtcTime().Returns(now);

            // Deployed 4 days prior to 'now'
            fourDayOldDeployment = new JournalEntry("fourDayOld", "blah", "blah", "blah", "blah", policySet1,
                now.AddDays(-4).LocalDateTime,
                "C:\\packages\\Acme.1.0.0.nupkg", "C:\\Applications\\Acme.1.0.0", null, true);

            // Deployed 4 days prior to 'now' but to the same location as the latest successful deployment
            fourDayOldSameLocationDeployment = new JournalEntry("twoDayOld", "blah", "blah", "blah", "blah", policySet1,
                now.AddDays(-4).LocalDateTime,
                "C:\\packages\\Acme.1.2.0.nupkg", "C:\\Applications\\Acme.1.2.0", null, true);

            // Deployed 3 days prior to 'now'
            threeDayOldDeployment = new JournalEntry("threeDayOld", "blah", "blah", "blah", "blah", policySet1,
                now.AddDays(-3).LocalDateTime,
                "C:\\packages\\Acme.1.1.0.nupkg", "C:\\Applications\\Acme.1.1.0", null, true);

            // Deployed 2 days prior to 'now'
            twoDayOldDeployment = new JournalEntry("twoDayOld", "blah", "blah", "blah", "blah", policySet1,
                now.AddDays(-2).LocalDateTime,
                "C:\\packages\\Acme.1.2.0.nupkg", "C:\\Applications\\Acme.1.2.0", null, true);

            // Deployed (unsuccessfully) 1 day prior to 'now'
            oneDayOldUnsuccessfulDeployment = new JournalEntry("oneDayOldUnsuccessful", "blah", "blah", "blah", "blah", policySet1,
                now.AddDays(-1).LocalDateTime,
                "C:\\packages\\Acme.1.3.0.nupkg", "C:\\Applications\\Acme.1.3.0", null, false);

            // Deployed 5 days prior to 'now', but has a different policy-set
            fiveDayOldNonMatchingDeployment = new JournalEntry("fiveDayOld", "blah", "blah", "blah", "blah", policySet2,
                now.AddDays(-5).LocalDateTime,
                "C:\\packages\\Beta.1.0.0.nupkg", "C:\\Applications\\Beta.1.0.0", null, true);

            var journalEntries = new List<JournalEntry>
            {
                fiveDayOldNonMatchingDeployment,
                fourDayOldDeployment,
                threeDayOldDeployment,
                twoDayOldDeployment,
                oneDayOldUnsuccessfulDeployment
            };

            deploymentJournal.GetAllJournalEntries().Returns(journalEntries);

            foreach (var journalEntry in journalEntries)
            {
                fileSystem.FileExists(journalEntry.ExtractedFrom).Returns(true);
                fileSystem.DirectoryExists(journalEntry.ExtractedTo).Returns(true);
            }
        }
        public void SetUp()
        {
            fileSystem = Substitute.For <ICalamariFileSystem>();
            variables  = new CalamariVariableDictionary();
            variables.Set(SpecialVariables.OriginalPackageDirectoryPath, StagingDirectory);
            deployment = new RunningDeployment(StagingDirectory, variables);

            convention = new ChooseCloudServiceConfigurationFileConvention(fileSystem);
        }
 public DeployAzureResourceGroupConvention(string templateFile, string templateParametersFile, bool filesInPackage,
                                           ICalamariFileSystem fileSystem, IResourceGroupTemplateNormalizer parameterNormalizer)
 {
     this.templateFile           = templateFile;
     this.templateParametersFile = templateParametersFile;
     this.filesInPackage         = filesInPackage;
     this.fileSystem             = fileSystem;
     this.parameterNormalizer    = parameterNormalizer;
 }
Esempio n. 26
0
 public FeatureScriptConvention(string deploymentStage, ICalamariFileSystem fileSystem, ICalamariEmbeddedResources embeddedResources, 
     IScriptEngine scriptEngine, ICommandLineRunner commandLineRunner)
 {
     this.deploymentStage = deploymentStage;
     this.fileSystem = fileSystem;
     this.embeddedResources = embeddedResources;
     this.scriptEngine = scriptEngine;
     this.commandLineRunner = commandLineRunner;
 }
        public void SetUp()
        {
            fileSystem        = Substitute.For <ICalamariFileSystem>();
            deploymentJournal = Substitute.For <IDeploymentJournal>();
            clock             = Substitute.For <IClock>();
            retentionPolicy   = new RetentionPolicy(fileSystem, deploymentJournal, clock);

            now = new DateTimeOffset(new DateTime(2015, 01, 15), new TimeSpan(0, 0, 0));
            clock.GetUtcTime().Returns(now);

            // Deployed 4 days prior to 'now'
            fourDayOldDeployment = new JournalEntry("fourDayOld", "blah", "blah", "blah", "blah", "blah", policySet1,
                                                    now.AddDays(-4).LocalDateTime,
                                                    "C:\\packages\\Acme.1.0.0.nupkg", "C:\\Applications\\Acme.1.0.0", null, true);

            // Deployed 4 days prior to 'now' but to the same location as the latest successful deployment
            fourDayOldSameLocationDeployment = new JournalEntry("twoDayOld", "blah", "blah", "blah", "blah", "blah", policySet1,
                                                                now.AddDays(-4).LocalDateTime,
                                                                "C:\\packages\\Acme.1.2.0.nupkg", "C:\\Applications\\Acme.1.2.0", null, true);

            // Deployed 3 days prior to 'now'
            threeDayOldDeployment = new JournalEntry("threeDayOld", "blah", "blah", "blah", "blah", "blah", policySet1,
                                                     now.AddDays(-3).LocalDateTime,
                                                     "C:\\packages\\Acme.1.1.0.nupkg", "C:\\Applications\\Acme.1.1.0", null, true);

            // Deployed 2 days prior to 'now'
            twoDayOldDeployment = new JournalEntry("twoDayOld", "blah", "blah", "blah", "blah", "blah", policySet1,
                                                   now.AddDays(-2).LocalDateTime,
                                                   "C:\\packages\\Acme.1.2.0.nupkg", "C:\\Applications\\Acme.1.2.0", null, true);

            // Deployed (unsuccessfully) 1 day prior to 'now'
            oneDayOldUnsuccessfulDeployment = new JournalEntry("oneDayOldUnsuccessful", "blah", "blah", "blah", "blah", "blah", policySet1,
                                                               now.AddDays(-1).LocalDateTime,
                                                               "C:\\packages\\Acme.1.3.0.nupkg", "C:\\Applications\\Acme.1.3.0", null, false);

            // Deployed 5 days prior to 'now', but has a different policy-set
            fiveDayOldNonMatchingDeployment = new JournalEntry("fiveDayOld", "blah", "blah", "blah", "blah", "blah", policySet2,
                                                               now.AddDays(-5).LocalDateTime,
                                                               "C:\\packages\\Beta.1.0.0.nupkg", "C:\\Applications\\Beta.1.0.0", null, true);

            var journalEntries = new List <JournalEntry>
            {
                fiveDayOldNonMatchingDeployment,
                fourDayOldDeployment,
                threeDayOldDeployment,
                twoDayOldDeployment,
                oneDayOldUnsuccessfulDeployment
            };

            deploymentJournal.GetAllJournalEntries().Returns(journalEntries);

            foreach (var journalEntry in journalEntries)
            {
                fileSystem.FileExists(journalEntry.ExtractedFrom).Returns(true);
                fileSystem.DirectoryExists(journalEntry.ExtractedTo).Returns(true);
            }
        }
 public SwapAzureDeploymentConvention(ICalamariFileSystem fileSystem,
     ICalamariEmbeddedResources embeddedResources,
     IScriptEngine scriptEngine,
     ICommandLineRunner commandLineRunner)
 {
     this.fileSystem = fileSystem;
     this.embeddedResources = embeddedResources;
     this.scriptEngine = scriptEngine;
     this.commandLineRunner = commandLineRunner;
 }
Esempio n. 29
0
 public DestroyPlanCommand(
     ILog log,
     IVariables variables,
     ICalamariFileSystem fileSystem,
     ICommandLineRunner commandLineRunner,
     ISubstituteInFiles substituteInFiles,
     IExtractPackage extractPackage)
     : base(log, variables, fileSystem, commandLineRunner, substituteInFiles, extractPackage)
 {
 }
 public void SetUp()
 {
     variables = new VariableDictionary();
     fileSystem = Substitute.For<ICalamariFileSystem>();
     iis = Substitute.For<IInternetInformationServer>();
     deployment = new RunningDeployment("C:\\packages", variables)
     {
         StagingDirectory = stagingDirectory
     };
 }
Esempio n. 31
0
 public void SetUp()
 {
     variables  = new CalamariVariableDictionary();
     fileSystem = Substitute.For <ICalamariFileSystem>();
     iis        = Substitute.For <IInternetInformationServer>();
     deployment = new RunningDeployment("C:\\packages", variables)
     {
         StagingDirectory = stagingDirectory
     };
 }
        public void SetUp()
        {
            fileSystem = Substitute.For<ICalamariFileSystem>();
            configurationTransformer = Substitute.For<IConfigurationTransformer>();

            variables = new CalamariVariableDictionary();
            variables.Set(SpecialVariables.OriginalPackageDirectoryPath, stagingDirectory);

            deployment = new RunningDeployment("C:\\packages", variables);
        }
 public GenericPackageExtractor createJavaGenericPackageExtractor(ICalamariFileSystem fileSystem)
 {
     var commandOutput = new SplitCommandOutput(new ConsoleCommandOutput(),
         new ServiceMessageCommandOutput(
             new CalamariVariableDictionary()));
     return new GenericPackageExtractor(new List<IPackageExtractor>
     {                            
         new JarExtractor(new CommandLineRunner(commandOutput), commandOutput, fileSystem)
     });
 }
        public void SetUp()
        {
            extractor = Substitute.For <IPackageExtractor>();

            fileSystem = Substitute.For <ICalamariFileSystem>();
            fileSystem.RemoveInvalidFileNameChars(Arg.Any <string>()).Returns(c => c.Arg <string>().Replace("!", ""));

            variables  = new CalamariVariableDictionary();
            convention = new ExtractPackageToApplicationDirectoryConvention(extractor, fileSystem);
        }
        public void SetUp()
        {
            var variables = new CalamariVariableDictionary();

            variables.Set(SpecialVariables.OriginalPackageDirectoryPath, TestEnvironment.ConstructRootedPath("applications", "Acme", "1.0.0"));
            deployment = new RunningDeployment(TestEnvironment.ConstructRootedPath("Packages"), variables);
            configurationVariableReplacer = Substitute.For <IJsonConfigurationVariableReplacer>();
            fileSystem = Substitute.For <ICalamariFileSystem>();
            fileSystem.DirectoryExists(Arg.Any <string>()).Returns(false);
        }
Esempio n. 36
0
 protected FeatureConventionBase(string deploymentStage, IEnumerable <IFeature> featureClasses, ICalamariFileSystem fileSystem,
                                 IScriptEngine scriptEngine, ICommandLineRunner commandLineRunner, ICalamariEmbeddedResources embeddedResources)
 {
     this.deploymentStage   = deploymentStage;
     this.fileSystem        = fileSystem;
     this.embeddedResources = embeddedResources;
     this.scriptEngine      = scriptEngine;
     this.commandLineRunner = commandLineRunner;
     this.featureClasses    = featureClasses?.ToList();
 }
Esempio n. 37
0
        private static void MockSearchableFiles(ICalamariFileSystem fileSystem, string parentDirectory, string[] files, string searchPattern)
        {
            fileSystem.EnumerateFilesRecursively(parentDirectory,
                                                 Arg.Is <string[]>(x => new List <string>(x).Contains(searchPattern))).Returns(files);

            foreach (var file in files)
            {
                fileSystem.FileExists(file).Returns(true);
            }
        }
 public SwapAzureDeploymentConvention(ICalamariFileSystem fileSystem,
                                      ICalamariEmbeddedResources embeddedResources,
                                      IScriptEngine scriptEngine,
                                      ICommandLineRunner commandLineRunner)
 {
     this.fileSystem        = fileSystem;
     this.embeddedResources = embeddedResources;
     this.scriptEngine      = scriptEngine;
     this.commandLineRunner = commandLineRunner;
 }
Esempio n. 39
0
        public void SetUp()
        {
            fileSystem = Substitute.For <ICalamariFileSystem>();
            configurationTransformer = Substitute.For <IConfigurationTransformer>();

            variables = new VariableDictionary();
            variables.Set(SpecialVariables.OriginalPackageDirectoryPath, stagingDirectory);

            deployment = new RunningDeployment("C:\\packages", variables);
        }
Esempio n. 40
0
 public static IFileFormatVariableReplacer[] BuildAllReplacers(ICalamariFileSystem fileSystem, ILog log)
 {
     return(new IFileFormatVariableReplacer[]
     {
         new JsonFormatVariableReplacer(fileSystem, log),
         new YamlFormatVariableReplacer(fileSystem, log),
         new XmlFormatVariableReplacer(fileSystem, log),
         new PropertiesFormatVariableReplacer(fileSystem, log)
     });
 }
        public void SetUp()
        {
            extractor = Substitute.For<IPackageExtractor>();
            extractor.GetMetadata(PackageLocation).Returns(new PackageMetadata { Id = "Acme.Web", Version = "1.0.0" });

            fileSystem = Substitute.For<ICalamariFileSystem>();
            fileSystem.RemoveInvalidFileNameChars(Arg.Any<string>()).Returns(c => c.Arg<string>().Replace("!", ""));

            variables = new CalamariVariableDictionary();
            convention = new ExtractPackageToApplicationDirectoryConvention(extractor, fileSystem, new SystemSemaphore());
        }
Esempio n. 42
0
        public void SetUp()
        {
            fileSystem  = Substitute.For <ICalamariFileSystem>();
            substituter = Substitute.For <IFileSubstituter>();
            variables   = new VariableDictionary();

            deployment = new RunningDeployment("C:\\packages", variables)
            {
                StagingDirectory = stagingDirectory
            };
        }
Esempio n. 43
0
 public ConfigureAzureCloudServiceConvention(AzureAccount account, ICalamariFileSystem fileSystem,
                                             ISubscriptionCloudCredentialsFactory subscriptionCloudCredentialsFactory,
                                             IAzureCloudServiceConfigurationRetriever configurationRetriever,
                                             ICertificateStore certificateStore)
 {
     this.account                = account;
     this.fileSystem             = fileSystem;
     this.credentialsFactory     = subscriptionCloudCredentialsFactory;
     this.configurationRetriever = configurationRetriever;
     this.certificateStore       = certificateStore;
 }
Esempio n. 44
0
        public void SetUp()
        {
            fileSystem  = Substitute.For <ICalamariFileSystem>();
            substituter = Substitute.For <IFileSubstituter>();
            variables   = new CalamariVariableDictionary();

            deployment = new RunningDeployment(TestEnvironment.ConstructRootedPath("packages"), variables)
            {
                StagingDirectory = StagingDirectory
            };
        }
        public void SetUp()
        {
            tempDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
            insensitiveVariablesFileName = Path.Combine(tempDirectory, "myVariables.json");
            sensitiveVariablesFileName   = Path.ChangeExtension(insensitiveVariablesFileName, "secret");
            fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem();
            fileSystem.EnsureDirectoryExists(tempDirectory);

            CreateSensitiveVariableFile();
            CreateInSensitiveVariableFile();
        }
        public void SetUp()
        {
            fileSystem = Substitute.For<ICalamariFileSystem>();
            substituter = Substitute.For<IFileSubstituter>();
            variables = new VariableDictionary();

            deployment = new RunningDeployment(TestEnvironment.ConstructRootedPath("packages"), variables)
            {
                StagingDirectory = StagingDirectory
            };
        }
        public void SetUp()
        {
            fileSystem = new WindowsPhysicalFileSystem();
            configurationTransformer = Substitute.For<IConfigurationTransformer>();

            var deployDirectory = BuildConfigPath(null);

            variables = new CalamariVariableDictionary();
            variables.Set(SpecialVariables.OriginalPackageDirectoryPath, deployDirectory);

            deployment = new RunningDeployment(deployDirectory, variables);
        }
        public void SetUp()
        {
            fileSystem = Substitute.For<ICalamariFileSystem>();
            scriptEngine = Substitute.For<IScriptEngine>();
            commandLineRunner = Substitute.For<ICommandLineRunner>();

            scriptEngine.GetSupportedExtensions().Returns(new string[] { "ps1" });

            variables = new VariableDictionary();
            variables.Set(SpecialVariables.Package.EnabledFeatures, SpecialVariables.Features.CustomScripts);

            deployment = new RunningDeployment("C:\\packages", variables) { StagingDirectory = stagingDirectory };
        }
        public void SetUp()
        {
            fileSystem = Substitute.For<ICalamariFileSystem>();
            fileSystem.EnumerateFilesRecursively(Arg.Any<string>(), Arg.Any<string[]>()).Returns(new[]
            {
                "C:\\App\\MyApp\\Web.config",
                "C:\\App\\MyApp\\Web.Release.config",
                "C:\\App\\MyApp\\Views\\Web.config"
            });

            deployment = new RunningDeployment("C:\\Packages", new CalamariVariableDictionary());
            replacer = Substitute.For<IConfigurationVariablesReplacer>();
        }
Esempio n. 50
0
        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 = Substitute.For<ICalamariFileSystem>();
            fileSystem.EnumerateFiles(Arg.Any<string>(), Arg.Any<string[]>()).Returns(new[]
            {
                TestEnvironment.ConstructRootedPath("App", "MyApp", "Hello.ps1"),
                TestEnvironment.ConstructRootedPath("App", "MyApp", "Deploy.ps1"),
                TestEnvironment.ConstructRootedPath("App", "MyApp", "Deploy.csx"),
                TestEnvironment.ConstructRootedPath("App", "MyApp", "PreDeploy.ps1")
            });

            commandResult = new CommandResult("PowerShell.exe foo bar", 0, null);
            scriptEngine = Substitute.For<IScriptEngine>();
            scriptEngine.Execute(Arg.Any<string>(), Arg.Any<CalamariVariableDictionary>(), Arg.Any<ICommandLineRunner>()).Returns(c => commandResult);
            scriptEngine.GetSupportedExtensions().Returns(new[] {"csx", "ps1"});
            runner = Substitute.For<ICommandLineRunner>();
            deployment = new RunningDeployment(TestEnvironment.ConstructRootedPath("Packages"), new CalamariVariableDictionary());
        }
        public void SetUp()
        {
            fileSystem = Substitute.For<ICalamariFileSystem>();
            packageUploader = Substitute.For<IAzurePackageUploader>();
            credentialsFactory = Substitute.For<ISubscriptionCloudCredentialsFactory>();
            credentialsFactory.GetCredentials(azureSubscriptionId, certificateThumbprint, certificateBytes)
                .Returns(new FakeSubscriptionCloudCredentials(azureSubscriptionId));

            variables = new VariableDictionary();
            variables.Set(SpecialVariables.OriginalPackageDirectoryPath, stagingDirectory);
            variables.Set(SpecialVariables.Action.Azure.SubscriptionId, azureSubscriptionId);
            variables.Set(SpecialVariables.Action.Azure.CertificateThumbprint, certificateThumbprint);
            variables.Set(SpecialVariables.Action.Azure.CertificateBytes, certificateBytes);
            variables.Set(SpecialVariables.Action.Azure.StorageAccountName, storageAccountName);
            deployment = new RunningDeployment(stagingDirectory, variables);

            convention = new UploadAzureCloudServicePackageConvention(fileSystem, packageUploader, credentialsFactory);
        }
Esempio n. 53
0
        public void Deploy()
        {
            const string webAppName = "octodemo003-dev";

            OctopusTestAzureSubscription.IgnoreIfCertificateNotInstalled();

            variables = new VariableDictionary();
            OctopusTestAzureSubscription.PopulateVariables(variables);
            variables.Set(SpecialVariables.Action.Azure.WebAppName, webAppName);

            variables.Set("foo", "bar");
            // Enable file substitution and configure the target
            variables.Set(SpecialVariables.Package.SubstituteInFilesEnabled, true.ToString());
            variables.Set(SpecialVariables.Package.SubstituteInFilesTargets, "web.config");

            fileSystem = new WindowsPhysicalFileSystem();
            stagingDirectory = Path.GetTempPath(); 
            variables.Set(SpecialVariables.Action.Azure.PackageExtractionPath, stagingDirectory);

            result = DeployPackage("Acme.Web");
        }
        public void SetUp()
        {
            result = null;

            fileSystem = Substitute.For<ICalamariFileSystem>();
            credentialsFactory = Substitute.For<ISubscriptionCloudCredentialsFactory>();
            configurationRetriever = Substitute.For<IAzureCloudServiceConfigurationRetriever>();
            variables = new VariableDictionary();
            variables.Set(SpecialVariables.OriginalPackageDirectoryPath, StagingDirectory);
            deployment = new RunningDeployment(StagingDirectory, variables);

            variables.Set(SpecialVariables.Action.Azure.SubscriptionId, AzureSubscriptionId);
            variables.Set(SpecialVariables.Action.Azure.CertificateThumbprint, CertificateThumbprint);
            variables.Set(SpecialVariables.Action.Azure.CertificateBytes, CertificateBytes);
            variables.Set(SpecialVariables.Action.Azure.CloudServiceName, CloudServiceName);
            variables.Set(SpecialVariables.Action.Azure.Slot, DeploymentSlot.ToString());

            credentialsFactory.GetCredentials(AzureSubscriptionId, CertificateThumbprint, CertificateBytes)
                .Returns(new FakeSubscriptionCloudCredentials(AzureSubscriptionId));

            convention = new ConfigureAzureCloudServiceConvention(fileSystem, credentialsFactory, configurationRetriever);
        }
 public AzurePowershellContext()
 {
     this.fileSystem = new WindowsPhysicalFileSystem();
     this.certificateStore = new CalamariCertificateStore();
     this.embeddedResources = new ExecutingAssemblyEmbeddedResources();
 }
 public ExtractPackageToApplicationDirectoryConvention(IPackageExtractor extractor, ICalamariFileSystem fileSystem, ISemaphore semaphore) : base(extractor, fileSystem)
 {
     this.semaphore = semaphore;
 }
 public ExtractAzureCloudServicePackageConvention(ICalamariFileSystem fileSystem)
 {
     this.fileSystem = fileSystem;
 }
        private static void MockSearchableFiles(ICalamariFileSystem fileSystem, string parentDirectory, string[] files, string searchPattern)
        {
            fileSystem.EnumerateFilesRecursively(parentDirectory,
                Arg.Is<string[]>(x => new List<string>(x).Contains(searchPattern))).Returns(files);

            foreach (var file in files)
            {
                fileSystem.FileExists(file).Returns(true);
                fileSystem.EnumerateFiles(Path.GetDirectoryName(files[0]), Arg.Is<string[]>(s => s.Contains(GetRelativePathToTransformFile(files[0], file)))).Returns(new[] {file});
            }
        }
 public ChooseCloudServiceConfigurationFileConvention(ICalamariFileSystem fileSystem)
 {
     this.fileSystem = fileSystem;
 }
 public RollbackScriptConvention(string scriptFilePrefix, ICalamariFileSystem fileSystem, IScriptEngine scriptEngine, ICommandLineRunner commandLineRunner) :
     base(scriptFilePrefix, fileSystem, scriptEngine, commandLineRunner)
 {            
 }