GCP-secret run, cache key
							parent
							
								
									73149fb464
								
							
						
					
					
						commit
						e4490cd3ca
					
				
							
								
								
									
										21
									
								
								action.yml
								
								
								
								
							
							
						
						
									
										21
									
								
								action.yml
								
								
								
								
							|  | @ -154,15 +154,18 @@ inputs: | |||
|     default: '5Gi' | ||||
|     required: false | ||||
|     description: 'Amount of disc space to assign the Kubernetes Persistent Volume' | ||||
|   # To Do - enables resilience | ||||
|   # checkDependencyHealthOverride: | ||||
|   #   default: '' | ||||
|   #   required: false | ||||
|   #   description: 'Use to specify a way to check depdency services health to enable resilient self-starting jobs' | ||||
|   # startDependenciesOverride: | ||||
|   #   default: '' | ||||
|   #   required: false | ||||
|   #   description: 'Use to specify a way to start depdency services health to enable resilient self-starting jobs' | ||||
|   cacheKey: | ||||
|     default: 'branch' | ||||
|     required: false | ||||
|     description: 'Cache key to indicate bucket for cache' | ||||
|   checkDependencyHealthOverride: | ||||
|     default: '' | ||||
|     required: false | ||||
|     description: 'Use to specify a way to check depdency services health to enable resilient self-starting jobs' | ||||
|   startDependenciesOverride: | ||||
|     default: '' | ||||
|     required: false | ||||
|     description: 'Use to specify a way to start depdency services health to enable resilient self-starting jobs' | ||||
| outputs: | ||||
|   volume: | ||||
|     description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes' | ||||
|  |  | |||
|  | @ -328,6 +328,9 @@ class BuildParameters { | |||
|                 readInputOverrideCommand: input_1.default.readInputOverrideCommand(), | ||||
|                 readInputFromOverrideList: input_1.default.readInputFromOverrideList(), | ||||
|                 kubeStorageClass: input_1.default.kubeStorageClass, | ||||
|                 checkDependencyHealthOverride: input_1.default.checkDependencyHealthOverride, | ||||
|                 startDependenciesOverride: input_1.default.startDependenciesOverride, | ||||
|                 cacheKey: input_1.default.cacheKey, | ||||
|             }; | ||||
|         }); | ||||
|     } | ||||
|  | @ -2994,7 +2997,7 @@ class CloudRunnerState { | |||
|         return path_1.default.join(`/`, CloudRunnerState.buildVolumeFolder, CloudRunnerState.buildParams.buildGuid); | ||||
|     } | ||||
|     static get cacheFolderFull() { | ||||
|         return path_1.default.join('/', CloudRunnerState.buildVolumeFolder, CloudRunnerState.cacheFolder, CloudRunnerState.branchName); | ||||
|         return path_1.default.join('/', CloudRunnerState.buildVolumeFolder, CloudRunnerState.cacheFolder, CloudRunnerState.cacheKey); | ||||
|     } | ||||
|     static setup(buildParameters) { | ||||
|         CloudRunnerState.buildParams = buildParameters; | ||||
|  | @ -3002,6 +3005,9 @@ class CloudRunnerState { | |||
|     static get branchName() { | ||||
|         return CloudRunnerState.buildParams.branch; | ||||
|     } | ||||
|     static get cacheKey() { | ||||
|         return CloudRunnerState.buildParams.cacheKey || CloudRunnerState.buildParams.branch; | ||||
|     } | ||||
|     static get builderPathFull() { | ||||
|         return path_1.default.join(CloudRunnerState.buildPathFull, `builder`); | ||||
|     } | ||||
|  | @ -4240,6 +4246,9 @@ class Input { | |||
|     static get startDependenciesOverride() { | ||||
|         return Input.getInput('startDependenciesOverride') || ''; | ||||
|     } | ||||
|     static get cacheKey() { | ||||
|         return Input.getInput('cacheKey') || ''; | ||||
|     } | ||||
|     static ToEnvVarFormat(input) { | ||||
|         return input | ||||
|             .replace(/([A-Z])/g, ' $1') | ||||
|  |  | |||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -13,6 +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", | ||||
|     "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", | ||||
|  |  | |||
|  | @ -47,6 +47,9 @@ class BuildParameters { | |||
|   public cachePullOverrideCommand!: string; | ||||
|   public readInputFromOverrideList!: string; | ||||
|   public readInputOverrideCommand!: string; | ||||
|   public checkDependencyHealthOverride!: string; | ||||
|   public startDependenciesOverride!: string; | ||||
|   public cacheKey!: string; | ||||
| 
 | ||||
|   public postBuildSteps!: string; | ||||
|   public preBuildSteps!: string; | ||||
|  | @ -135,6 +138,9 @@ class BuildParameters { | |||
|       readInputOverrideCommand: Input.readInputOverrideCommand(), | ||||
|       readInputFromOverrideList: Input.readInputFromOverrideList(), | ||||
|       kubeStorageClass: Input.kubeStorageClass, | ||||
|       checkDependencyHealthOverride: Input.checkDependencyHealthOverride, | ||||
|       startDependenciesOverride: Input.startDependenciesOverride, | ||||
|       cacheKey: Input.cacheKey, | ||||
|     }; | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,6 +5,14 @@ import { CloudRunnerStatics } from './cloud-runner-statics'; | |||
| import { TaskParameterSerializer } from './services/task-parameter-serializer'; | ||||
| import UnityVersioning from '../unity-versioning'; | ||||
| 
 | ||||
| function guid() { | ||||
|   return Math.trunc((1 + Math.random()) * 0x10000) | ||||
|     .toString(16) | ||||
|     .slice(1); | ||||
| } | ||||
| function guidGenerator() { | ||||
|   return `${guid() + guid()}-${guid()}-${guid()}-${guid()}-${guid()}${guid()}${guid()}`; | ||||
| } | ||||
| describe('Cloud Runner', () => { | ||||
|   it('responds', () => {}); | ||||
| }); | ||||
|  | @ -55,6 +63,7 @@ describe('Cloud Runner', () => { | |||
|         versioning: 'None', | ||||
|         projectPath: 'test-project', | ||||
|         unityVersion: UnityVersioning.read('test-project'), | ||||
|         cacheKey: `test-case-${guidGenerator()}`, | ||||
|       }; | ||||
|       Input.githubInputEnabled = false; | ||||
|       const buildParameter = await BuildParameters.create(); | ||||
|  |  | |||
|  | @ -16,12 +16,7 @@ export class CloudRunnerState { | |||
|   } | ||||
| 
 | ||||
|   public static get cacheFolderFull(): string { | ||||
|     return path.join( | ||||
|       '/', | ||||
|       CloudRunnerState.buildVolumeFolder, | ||||
|       CloudRunnerState.cacheFolder, | ||||
|       CloudRunnerState.branchName, | ||||
|     ); | ||||
|     return path.join('/', CloudRunnerState.buildVolumeFolder, CloudRunnerState.cacheFolder, CloudRunnerState.cacheKey); | ||||
|   } | ||||
| 
 | ||||
|   static setup(buildParameters: BuildParameters) { | ||||
|  | @ -31,6 +26,10 @@ export class CloudRunnerState { | |||
|   public static get branchName(): string { | ||||
|     return CloudRunnerState.buildParams.branch; | ||||
|   } | ||||
| 
 | ||||
|   public static get cacheKey(): string { | ||||
|     return CloudRunnerState.buildParams.cacheKey || CloudRunnerState.buildParams.branch; | ||||
|   } | ||||
|   public static get builderPathFull(): string { | ||||
|     return path.join(CloudRunnerState.buildPathFull, `builder`); | ||||
|   } | ||||
|  |  | |||
|  | @ -287,6 +287,10 @@ class Input { | |||
|     return Input.getInput('startDependenciesOverride') || ''; | ||||
|   } | ||||
| 
 | ||||
|   static get cacheKey(): string { | ||||
|     return Input.getInput('cacheKey') || ''; | ||||
|   } | ||||
| 
 | ||||
|   public static ToEnvVarFormat(input: string) { | ||||
|     return input | ||||
|       .replace(/([A-Z])/g, ' $1') | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue