protected override int ExecuteInternal(NodeInstructions instructions, params string[] args) { var pathToNode = variables.Get(instructions.NodePathVariable); var pathToStepPackage = variables.Get(instructions.TargetPathVariable); var pathToBootstrapper = variables.Get(instructions.BootstrapperPathVariable); var runningDeployment = new RunningDeployment(variables); using (var variableFile = new TemporaryFile(Path.GetTempFileName())) { var variablesAsJson = variables.CloneAndEvaluate().SaveAsString(); File.WriteAllBytes(variableFile.FilePath, new AesEncryption(options.InputVariables.SensitiveVariablesPassword).Encrypt(variablesAsJson)); var commandLineInvocation = new CommandLineInvocation(BuildNodePath(pathToNode), BuildArgs(Path.Combine(pathToBootstrapper, "bootstrapper.js"), Path.Combine(pathToStepPackage, instructions.TargetEntryPoint), variableFile.FilePath, options.InputVariables.SensitiveVariablesPassword)) { WorkingDirectory = runningDeployment.CurrentDirectory, OutputToLog = true, }; var commandResult = commandLineRunner.Execute(commandLineInvocation); return(commandResult.ExitCode); } }
protected override int ExecuteInternal(NodeInstructions instructions) { using (var variableFile = new TemporaryFile(Path.GetTempFileName())) { var jsonInputs = variables.GetRaw(instructions.InputsVariable) ?? string.Empty; variables.Set(instructions.InputsVariable, InputSubstitution.SubstituteAndEscapeAllVariablesInJson(jsonInputs, variables, log)); var variablesAsJson = variables.CloneAndEvaluate().SaveAsString(); File.WriteAllBytes(variableFile.FilePath, new AesEncryption(options.InputVariables.SensitiveVariablesPassword).Encrypt(variablesAsJson)); var pathToNode = variables.Get(instructions.NodePathVariable); var nodeExecutablePath = BuildNodePath(pathToNode); var parameters = BuildParams(instructions, variableFile.FilePath); var runningDeployment = new RunningDeployment(variables); var commandLineInvocation = new CommandLineInvocation(nodeExecutablePath, parameters) { WorkingDirectory = runningDeployment.CurrentDirectory, OutputToLog = true, EnvironmentVars = ProxyEnvironmentVariablesGenerator.GenerateProxyEnvironmentVariables().ToDictionary(e => e.Key, e => e.Value) }; var commandResult = commandLineRunner.Execute(commandLineInvocation); return(commandResult.ExitCode); } }