Run using external secret provider to speed up input
							parent
							
								
									99f9a7179b
								
							
						
					
					
						commit
						14c9af3592
					
				|  | @ -755,11 +755,13 @@ exports.CloudRunnerSystem = void 0; | |||
| const child_process_1 = __nccwpck_require__(32081); | ||||
| const remote_client_logger_1 = __nccwpck_require__(28082); | ||||
| class CloudRunnerSystem { | ||||
|     static Run(command, suppressError = false) { | ||||
|     static Run(command, suppressError = false, suppressLogs = false) { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             for (const element of command.split(`\n`)) { | ||||
|                 if (!suppressLogs) { | ||||
|                     remote_client_logger_1.RemoteClientLogger.log(element); | ||||
|                 } | ||||
|             } | ||||
|             return yield new Promise((promise) => { | ||||
|                 let output = ''; | ||||
|                 const child = child_process_1.exec(command, (error, stdout, stderr) => { | ||||
|  | @ -768,7 +770,9 @@ class CloudRunnerSystem { | |||
|                     } | ||||
|                     if (stderr) { | ||||
|                         const diagnosticOutput = `${stderr.toString()}`; | ||||
|                         if (!suppressLogs) { | ||||
|                             remote_client_logger_1.RemoteClientLogger.logCliDiagnostic(diagnosticOutput); | ||||
|                         } | ||||
|                         output += diagnosticOutput; | ||||
|                         return; | ||||
|                     } | ||||
|  | @ -782,8 +786,10 @@ class CloudRunnerSystem { | |||
|                     } | ||||
|                     const outputLines = output.split(`\n`); | ||||
|                     for (const element of outputLines) { | ||||
|                         if (!suppressLogs) { | ||||
|                             remote_client_logger_1.RemoteClientLogger.log(element); | ||||
|                         } | ||||
|                     } | ||||
|                     promise(output); | ||||
|                 }); | ||||
|             }); | ||||
|  | @ -3848,7 +3854,7 @@ const cloud_runner_system_1 = __nccwpck_require__(66879); | |||
| class GenericInputReader { | ||||
|     static Run(command) { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             return yield cloud_runner_system_1.CloudRunnerSystem.Run(command); | ||||
|             return yield cloud_runner_system_1.CloudRunnerSystem.Run(command, false, true); | ||||
|         }); | ||||
|     } | ||||
| } | ||||
|  | @ -4012,6 +4018,13 @@ const generic_input_reader_1 = __nccwpck_require__(2263); | |||
| const git_repo_1 = __nccwpck_require__(24271); | ||||
| const github_cli_1 = __nccwpck_require__(44990); | ||||
| const platform_1 = __importDefault(__nccwpck_require__(9707)); | ||||
| const formatFunction = (value, arguments_) => { | ||||
|     let formatted = value; | ||||
|     for (const argument in arguments_) { | ||||
|         formatted = formatted.replace(`{${arguments_[argument].key}}`, arguments_[argument].value); | ||||
|     } | ||||
|     return formatted; | ||||
| }; | ||||
| const core = __nccwpck_require__(42186); | ||||
| /** | ||||
|  * Input variables specified in workflows using "with" prop. | ||||
|  | @ -4026,7 +4039,7 @@ class Input { | |||
|     static shouldUseOverride(query) { | ||||
|         if (Input.readInputOverrideCommand() !== '') { | ||||
|             if (Input.readInputFromOverrideList() !== '') { | ||||
|                 return Input.readInputFromOverrideList().split(', ').includes(query) ? true : false; | ||||
|                 return Input.readInputFromOverrideList().split(',').includes(query) ? true : false; | ||||
|             } | ||||
|             else { | ||||
|                 return true; | ||||
|  | @ -4038,23 +4051,16 @@ class Input { | |||
|             if (!this.shouldUseOverride(query)) { | ||||
|                 throw new Error(`Should not be trying to run override query on ${query}`); | ||||
|             } | ||||
|             // eslint-disable-next-line func-style
 | ||||
|             const formatFunction = function (format) { | ||||
|                 const arguments_ = Array.prototype.slice.call([query], 1); | ||||
|                 return format.replace(/{(\d+)}/g, function (match, number) { | ||||
|                     return typeof arguments_[number] != 'undefined' ? arguments_[number] : match; | ||||
|                 }); | ||||
|             }; | ||||
|             return yield generic_input_reader_1.GenericInputReader.Run(formatFunction(Input.readInputOverrideCommand())); | ||||
|             return yield generic_input_reader_1.GenericInputReader.Run(formatFunction(Input.readInputOverrideCommand(), [{ key: 0, value: query }])); | ||||
|         }); | ||||
|     } | ||||
|     static PopulateQueryOverrideInput() { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             const queries = Input.readInputFromOverrideList().split(', '); | ||||
|             const queries = Input.readInputFromOverrideList().split(','); | ||||
|             Input.queryOverrides = new Array(); | ||||
|             for (const element of queries) { | ||||
|                 if (Input.shouldUseOverride(element)) { | ||||
|                     Input.queryOverrides.Push(yield Input.queryOverride(element)); | ||||
|                     Input.queryOverrides.push(yield Input.queryOverride(element)); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|  |  | |||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -13,7 +13,7 @@ | |||
|     "format": "prettier --write \"src/**/*.{js,ts}\"", | ||||
|     "prepare": "husky install", | ||||
|     "cli": "yarn ts-node src/index.ts -m cli", | ||||
|     "gcp-secrets-cli": "cross-env readInputOverrideCommand=\"gcloud secrets versions access 0 --secret=\"{0}\"\" yarn ts-node src/index.ts -m cli", | ||||
|     "gcp-secrets-cli": "cross-env readInputOverrideCommand=\"gcloud secrets versions access 1 --secret=\"{0}\"\" yarn ts-node src/index.ts -m cli --readInputFromOverrideList UNITY_EMAIL,UNITY_SERIAL,UNITY_PASSWORD", | ||||
|     "cli-aws": "cross-env cloudRunnerCluster=aws yarn run test-cli", | ||||
|     "cli-k8s": "cross-env cloudRunnerCluster=k8s yarn run test-cli", | ||||
|     "test-cli": "cross-env cloudRunnerTests=true yarn ts-node src/index.ts -m cli --projectPath test-project", | ||||
|  |  | |||
|  | @ -2,10 +2,12 @@ import { exec } from 'child_process'; | |||
| import { RemoteClientLogger } from './remote-client-logger'; | ||||
| 
 | ||||
| export class CloudRunnerSystem { | ||||
|   public static async Run(command: string, suppressError = false) { | ||||
|   public static async Run(command: string, suppressError = false, suppressLogs = false) { | ||||
|     for (const element of command.split(`\n`)) { | ||||
|       if (!suppressLogs) { | ||||
|         RemoteClientLogger.log(element); | ||||
|       } | ||||
|     } | ||||
|     return await new Promise<string>((promise) => { | ||||
|       let output = ''; | ||||
|       const child = exec(command, (error, stdout, stderr) => { | ||||
|  | @ -14,7 +16,9 @@ export class CloudRunnerSystem { | |||
|         } | ||||
|         if (stderr) { | ||||
|           const diagnosticOutput = `${stderr.toString()}`; | ||||
|           if (!suppressLogs) { | ||||
|             RemoteClientLogger.logCliDiagnostic(diagnosticOutput); | ||||
|           } | ||||
|           output += diagnosticOutput; | ||||
|           return; | ||||
|         } | ||||
|  | @ -28,8 +32,10 @@ export class CloudRunnerSystem { | |||
|         } | ||||
|         const outputLines = output.split(`\n`); | ||||
|         for (const element of outputLines) { | ||||
|           if (!suppressLogs) { | ||||
|             RemoteClientLogger.log(element); | ||||
|           } | ||||
|         } | ||||
|         promise(output); | ||||
|       }); | ||||
|     }); | ||||
|  |  | |||
|  | @ -2,6 +2,6 @@ import { CloudRunnerSystem } from '../cli/remote-client/remote-client-services/c | |||
| 
 | ||||
| export class GenericInputReader { | ||||
|   public static async Run(command) { | ||||
|     return await CloudRunnerSystem.Run(command); | ||||
|     return await CloudRunnerSystem.Run(command, false, true); | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -5,6 +5,14 @@ import { GitRepoReader } from './input-readers/git-repo'; | |||
| import { GithubCliReader } from './input-readers/github-cli'; | ||||
| import Platform from './platform'; | ||||
| 
 | ||||
| const formatFunction = (value, arguments_) => { | ||||
|   let formatted = value; | ||||
|   for (const argument in arguments_) { | ||||
|     formatted = formatted.replace(`{${arguments_[argument].key}}`, arguments_[argument].value); | ||||
|   } | ||||
|   return formatted; | ||||
| }; | ||||
| 
 | ||||
| const core = require('@actions/core'); | ||||
| 
 | ||||
| /** | ||||
|  | @ -24,7 +32,7 @@ class Input { | |||
|   private static shouldUseOverride(query) { | ||||
|     if (Input.readInputOverrideCommand() !== '') { | ||||
|       if (Input.readInputFromOverrideList() !== '') { | ||||
|         return Input.readInputFromOverrideList().split(', ').includes(query) ? true : false; | ||||
|         return Input.readInputFromOverrideList().split(',').includes(query) ? true : false; | ||||
|       } else { | ||||
|         return true; | ||||
|       } | ||||
|  | @ -35,22 +43,16 @@ class Input { | |||
|     if (!this.shouldUseOverride(query)) { | ||||
|       throw new Error(`Should not be trying to run override query on ${query}`); | ||||
|     } | ||||
|     // eslint-disable-next-line func-style
 | ||||
|     const formatFunction = function (format: string) { | ||||
|       const arguments_ = Array.prototype.slice.call([query], 1); | ||||
|       return format.replace(/{(\d+)}/g, function (match, number) { | ||||
|         return typeof arguments_[number] != 'undefined' ? arguments_[number] : match; | ||||
|       }); | ||||
|     }; | ||||
|     return await GenericInputReader.Run(formatFunction(Input.readInputOverrideCommand())); | ||||
| 
 | ||||
|     return await GenericInputReader.Run(formatFunction(Input.readInputOverrideCommand(), [{ key: 0, value: query }])); | ||||
|   } | ||||
| 
 | ||||
|   public static async PopulateQueryOverrideInput() { | ||||
|     const queries = Input.readInputFromOverrideList().split(', '); | ||||
|     const queries = Input.readInputFromOverrideList().split(','); | ||||
|     Input.queryOverrides = new Array(); | ||||
|     for (const element of queries) { | ||||
|       if (Input.shouldUseOverride(element)) { | ||||
|         Input.queryOverrides.Push(await Input.queryOverride(element)); | ||||
|         Input.queryOverrides.push(await Input.queryOverride(element)); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue