Example #1
0
        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 CalamariVariableDictionary();

            variables.EnrichWithEnvironmentVariables();

            var fileSystem        = CalamariPhysicalFileSystem.GetPhysicalFileSystem();
            var deploymentJournal = new DeploymentJournal(fileSystem, SemaphoreFactory.Get(), variables);
            var clock             = new SystemClock();

            var retentionPolicy = new RetentionPolicy(fileSystem, deploymentJournal, clock);

            retentionPolicy.ApplyRetentionPolicy(retentionPolicySet, days, releases);

            return(0);
        }
Example #2
0
        public override int Execute(string[] commandLineArguments)
        {
            Options.Parse(commandLineArguments);

            var variables = new CalamariVariableDictionary(variablesFile, sensitiveVariablesFile, sensitiveVariablesPassword);

            variables.EnrichWithEnvironmentVariables();
            variables.LogVariables();

            return(InvokeScript(variables));
        }
        public override int Execute(string[] commandLineArguments)
        {
            Options.Parse(commandLineArguments);

            var variables = new CalamariVariableDictionary(variablesFile, sensitiveVariablesFile, sensitiveVariablesPassword);

            variables.EnrichWithEnvironmentVariables();
            variables.LogVariables();

            var filesystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem();
            var semaphore  = SemaphoreFactory.Get();

            journal = new DeploymentJournal(filesystem, semaphore, variables);

            ExtractPackage(variables);
            SubstituteVariablesInScript(variables);
            return(InvokeScript(variables));
        }
Example #4
0
        public override int Execute(string[] commandLineArguments)
        {
            Options.Parse(commandLineArguments);

            variables.EnrichWithEnvironmentVariables();
            variables.LogVariables();

            var runner = new CommandLineRunner(new ConsoleCommandOutput());

            Log.VerboseFormat("Executing '{0}'", scriptFile);
            var result = scriptEngine.Execute(new Script(scriptFile, ""), variables, runner);

            if (result.ExitCode == 0 && result.HasErrors && variables.GetFlag(SpecialVariables.Action.FailScriptOnErrorOutput, false))
            {
                return(-1);
            }

            return(result.ExitCode);
        }