public void SetUp() { tempDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); firstSensitiveVariablesFileName = Path.Combine(tempDirectory, "firstVariableSet.secret"); secondSensitiveVariablesFileName = Path.Combine(tempDirectory, "secondVariableSet.secret"); firstInsensitiveVariablesFileName = Path.ChangeExtension(firstSensitiveVariablesFileName, "json"); fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem(); fileSystem.EnsureDirectoryExists(tempDirectory); CreateSensitiveVariableFile(); CreateInSensitiveVariableFile(); options = CommonOptions.Parse(new[] { "Test", "--variables", firstInsensitiveVariablesFileName, "--sensitiveVariables", firstSensitiveVariablesFileName, "--sensitiveVariables", secondSensitiveVariablesFileName, "--sensitiveVariablesPassword", encryptionPassword }); }
private CommonOptions BuildOptions() => CommonOptions.Parse(new[] { "Test", "--variables", "firstInsensitiveVariablesFileName", "--sensitiveVariables", "firstSensitiveVariablesFileName", "--sensitiveVariables", "secondSensitiveVariablesFileName", "--sensitiveVariablesPassword", "encryptionPassword" });
protected virtual int Run(string[] args) { try { SecurityProtocols.EnableAllSecurityProtocols(); var options = CommonOptions.Parse(args); Log.Verbose($"Calamari Version: {GetType().Assembly.GetInformationalVersion()}"); if (options.Command.Equals("version", StringComparison.OrdinalIgnoreCase)) { return(0); } var envInfo = string.Join($"{Environment.NewLine} ", EnvironmentHelper.SafelyGetEnvironmentInformation()); Log.Verbose($"Environment Information: {Environment.NewLine} {envInfo}"); EnvironmentHelper.SetEnvironmentVariable("OctopusCalamariWorkingDirectory", Environment.CurrentDirectory); ProxyInitializer.InitializeDefaultProxy(); var builder = new ContainerBuilder(); ConfigureContainer(builder, options); using var container = builder.Build(); container.Resolve <VariableLogger>().LogVariables(); #if DEBUG var waitForDebugger = container.Resolve <IVariables>().Get(KnownVariables.Calamari.WaitForDebugger); if (string.Equals(waitForDebugger, "true", StringComparison.CurrentCultureIgnoreCase)) { using var proc = Process.GetCurrentProcess(); Log.Info($"Waiting for debugger to attach... (PID: {proc.Id})"); while (!Debugger.IsAttached) { Thread.Sleep(1000); } } #endif return(ResolveAndExecuteCommand(container, options)); } catch (Exception ex) { return(ConsoleFormatter.PrintError(ConsoleLog.Instance, ex)); } }
protected async Task <int> Run(string[] args) { try { SecurityProtocols.EnableAllSecurityProtocols(); var options = CommonOptions.Parse(args); log.Verbose($"Calamari Version: {GetType().Assembly.GetInformationalVersion()}"); if (options.Command.Equals("version", StringComparison.OrdinalIgnoreCase)) { return(0); } var envInfo = string.Join($"{Environment.NewLine} ", EnvironmentHelper.SafelyGetEnvironmentInformation()); log.Verbose($"Environment Information: {Environment.NewLine} {envInfo}"); EnvironmentHelper.SetEnvironmentVariable("OctopusCalamariWorkingDirectory", Environment.CurrentDirectory); ProxyInitializer.InitializeDefaultProxy(); var builder = new ContainerBuilder(); ConfigureContainer(builder, options); using (var container = builder.Build()) { container.Resolve <VariableLogger>().LogVariables(); await ResolveAndExecuteCommand(container, options); return(0); } } catch (Exception ex) { return(ConsoleFormatter.PrintError(ConsoleLog.Instance, ex)); } }
public int Run(string[] args) { var options = CommonOptions.Parse(args); return(Run(options)); }
private string[] ProcessCommonOptions() { _log.Trace("Processing command line options"); return(CommonOptions.Parse(_commandLineArguments).ToArray()); }