Example #1
0
        void Extract(PathToPackage pathToPackage, string targetPath, IPackageExtractor customPackageExtractor)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(pathToPackage))
                {
                    log.Verbose("No package path defined. Skipping package extraction.");
                    return;
                }

                log.Verbose("Extracting package to: " + targetPath);

                var extractorToUse = customPackageExtractor ?? combinedPackageExtractor;
                var filesExtracted = extractorToUse.Extract(pathToPackage, targetPath);

                log.Verbose("Extracted " + filesExtracted + " files");

                variables.Set(KnownVariables.OriginalPackageDirectoryPath, targetPath);
                log.SetOutputVariable(PackageVariables.Output.InstallationDirectoryPath, targetPath, variables);
                log.SetOutputVariable(PackageVariables.Output.DeprecatedInstallationDirectoryPath, targetPath, variables);
                log.SetOutputVariable(PackageVariables.Output.ExtractedFileCount, filesExtracted.ToString(), variables);
            }
            catch (UnauthorizedAccessException)
            {
                LogAccessDenied();
                throw;
            }
            catch (Exception ex) when(ex.Message.ContainsIgnoreCase("Access is denied"))
            {
                LogAccessDenied();
                throw;
            }
        }
Example #2
0
        public void ExtractToApplicationDirectory(PathToPackage pathToPackage, IPackageExtractor customPackageExtractor = null)
        {
            var metadata   = PackageName.FromFile(pathToPackage);
            var targetPath = ApplicationDirectory.GetApplicationDirectory(metadata, variables, fileSystem);

            Extract(pathToPackage, targetPath, customPackageExtractor);
        }
Example #3
0
        public void ExtractToStagingDirectory(PathToPackage pathToPackage, IPackageExtractor customPackageExtractor = null)
        {
            var targetPath = Path.Combine(Environment.CurrentDirectory, "staging");

            fileSystem.EnsureDirectoryExists(targetPath);
            Extract(pathToPackage, targetPath, customPackageExtractor);
        }
Example #4
0
 public ExtractToStagingCommand(IExtractPackage extractPackage)
 {
     this.extractPackage = extractPackage;
     Options.Add(
         "package=",
         "Path to the package to extract.",
         v => pathToPackage = new PathToPackage(Path.GetFullPath(v)));
 }
Example #5
0
        public RunningDeployment(string?packageFilePath, IVariables variables)
        {
            if (!string.IsNullOrEmpty(packageFilePath))
            {
                PackageFilePath = new PathToPackage(packageFilePath);
            }

            Variables = variables;
        }
Example #6
0
 public DeployCloudFormationCommand(ILog log, IVariables variables, ICalamariFileSystem fileSystem, IExtractPackage extractPackage)
 {
     this.log            = log;
     this.variables      = variables;
     this.fileSystem     = fileSystem;
     this.extractPackage = extractPackage;
     Options.Add("package=", "Path to the NuGet package to install.", v => pathToPackage = new PathToPackage(Path.GetFullPath(v)));
     Options.Add("template=", "Path to the JSON template file.", v => templateFile       = v);
     Options.Add("templateParameters=", "Path to the JSON template parameters file.", v => templateParameterFile = v);
     Options.Add("waitForCompletion=", "True if the deployment process should wait for the stack to complete, and False otherwise.",
                 v => waitForComplete = !bool.FalseString.Equals(v, StringComparison.OrdinalIgnoreCase)); //True by default
     Options.Add("stackName=", "The name of the CloudFormation stack.", v => stackName = v);
     Options.Add("disableRollback=", "True to disable the CloudFormation stack rollback on failure, and False otherwise.",
                 v => disableRollback = bool.TrueString.Equals(v, StringComparison.OrdinalIgnoreCase)); //False by default
 }
Example #7
0
        public DeployAzureCloudServiceCommand(
            ILog log,
            IScriptEngine scriptEngine,
            IVariables variables,
            ICommandLineRunner commandLineRunner,
            ISubstituteInFiles substituteInFiles,
            IExtractPackage extractPackage
            )
        {
            Options.Add("package=", "Path to the NuGet package to install.", v => pathToPackage = new PathToPackage(Path.GetFullPath(v)));

            this.log               = log;
            this.scriptEngine      = scriptEngine;
            this.variables         = variables;
            this.commandLineRunner = commandLineRunner;
            this.substituteInFiles = substituteInFiles;
            this.extractPackage    = extractPackage;
        }
        public DeployJavaArchiveCommand(
            ILog log,
            IScriptEngine scriptEngine,
            IVariables variables,
            ICalamariFileSystem fileSystem,
            ICommandLineRunner commandLineRunner,
            ISubstituteInFiles substituteInFiles,
            IExtractPackage extractPackage
            )
        {
            Options.Add("archive=", "Path to the Java archive to deploy.", v => archiveFile = new PathToPackage(Path.GetFullPath(v)));

            this.log               = log;
            this.scriptEngine      = scriptEngine;
            this.variables         = variables;
            this.fileSystem        = fileSystem;
            this.commandLineRunner = commandLineRunner;
            this.substituteInFiles = substituteInFiles;
            this.extractPackage    = extractPackage;
        }
Example #9
0
 public HelmUpgradeCommand(
     ILog log,
     IScriptEngine scriptEngine,
     IDeploymentJournalWriter deploymentJournalWriter,
     IVariables variables,
     ICommandLineRunner commandLineRunner,
     ICalamariFileSystem fileSystem,
     ISubstituteInFiles substituteInFiles,
     IExtractPackage extractPackage
     )
 {
     Options.Add("package=", "Path to the NuGet package to install.", v => pathToPackage = new PathToPackage(Path.GetFullPath(v)));
     this.log                     = log;
     this.scriptEngine            = scriptEngine;
     this.deploymentJournalWriter = deploymentJournalWriter;
     this.variables               = variables;
     this.fileSystem              = fileSystem;
     this.substituteInFiles       = substituteInFiles;
     this.extractPackage          = extractPackage;
     this.commandLineRunner       = commandLineRunner;
 }
Example #10
0
 public UploadAwsS3Command(
     ILog log,
     IVariables variables,
     ICalamariFileSystem fileSystem,
     ISubstituteInFiles substituteInFiles,
     IExtractPackage extractPackage
     )
 {
     this.log               = log;
     this.variables         = variables;
     this.fileSystem        = fileSystem;
     this.substituteInFiles = substituteInFiles;
     this.extractPackage    = extractPackage;
     Options.Add("package=", "Path to the package to extract that contains the package.", v => pathToPackage = new PathToPackage(Path.GetFullPath(v)));
     Options.Add("bucket=", "The bucket to use", v => bucket = v);
     Options.Add("targetMode=", "Whether the entire package or files within the package should be uploaded to the s3 bucket", v => targetMode = v);
 }
Example #11
0
 public DeployAzureResourceGroupCommand(
     ILog log,
     IScriptEngine scriptEngine,
     IVariables variables,
     ICommandLineRunner commandLineRunner,
     IExtractPackage extractPackage
     )
 {
     this.log               = log;
     this.scriptEngine      = scriptEngine;
     this.variables         = variables;
     this.commandLineRunner = commandLineRunner;
     this.extractPackage    = extractPackage;
     Options.Add("package=", "Path to the deployment package to install.", v => pathToPackage = new PathToPackage(Path.GetFullPath(v)));
     Options.Add("template=", "Path to the JSON template file.", v => templateFile            = v);
     Options.Add("templateParameters=", "Path to the JSON template parameters file.", v => templateParameterFile = v);
 }
Example #12
0
        public ExtractPackageCommand(IVariables variables, IExtractPackage extractPackage, ICalamariFileSystem fileSystem)
        {
            this.extractPackage = extractPackage;

            pathToPrimaryPackage = variables.GetPathToPrimaryPackage(fileSystem, true);
        }
Example #13
0
        public DeployPackageCommand(
            ILog log,
            IScriptEngine scriptEngine,
            IVariables variables,
            ICalamariFileSystem fileSystem,
            ICommandLineRunner commandLineRunner,
            ISubstituteInFiles substituteInFiles,
            IExtractPackage extractPackage,
            IStructuredConfigVariablesService structuredConfigVariablesService
            )
        {
            Options.Add("package=", "Path to the deployment package to install.", v => pathToPackage = new PathToPackage(Path.GetFullPath(v)));

            this.log               = log;
            this.scriptEngine      = scriptEngine;
            this.variables         = variables;
            this.fileSystem        = fileSystem;
            this.commandLineRunner = commandLineRunner;
            this.substituteInFiles = substituteInFiles;
            this.extractPackage    = extractPackage;
            this.structuredConfigVariablesService = structuredConfigVariablesService;
        }
Example #14
0
        public void ExtractToEnvironmentCurrentDirectory(PathToPackage pathToPackage)
        {
            var targetPath = Environment.CurrentDirectory;

            Extract(pathToPackage, targetPath, null);
        }
Example #15
0
        public void ExtractToEnvironmentCurrentDirectory(PathToPackage pathToPackage)
        {
            var targetPath = Environment.CurrentDirectory;

            Extract(pathToPackage, targetPath, PackageVariables.Output.InstallationDirectoryPath, null);
        }