Caching cleanup
							parent
							
								
									a7a8661484
								
							
						
					
					
						commit
						d3d0b12901
					
				|  | @ -545,8 +545,8 @@ class Caching { | ||||||
|                 if (__1.Input.cloudRunnerTests) { |                 if (__1.Input.cloudRunnerTests) { | ||||||
|                     cloud_runner_logger_1.default.log(`Hashed cache folder ${yield lfs_hashing_1.LFSHashing.hashAllFiles(sourceFolder)}`); |                     cloud_runner_logger_1.default.log(`Hashed cache folder ${yield lfs_hashing_1.LFSHashing.hashAllFiles(sourceFolder)}`); | ||||||
|                 } |                 } | ||||||
|                 yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`zip -q -r ${cacheKey}.zip ${path_1.default.basename(sourceFolder)}`); |                 yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`zip ${__1.Input.cloudRunnerTests ? '' : '-q'} -r ${cacheKey} ${path_1.default.basename(sourceFolder)}`); | ||||||
|                 console_1.assert(fs_1.default.existsSync(`${cacheKey}`)); |                 console_1.assert(fs_1.default.existsSync(`${cacheKey}.zip`)); | ||||||
|                 console_1.assert(fs_1.default.existsSync(`${cacheFolder}`)); |                 console_1.assert(fs_1.default.existsSync(`${cacheFolder}`)); | ||||||
|                 console_1.assert(fs_1.default.existsSync(`${sourceFolder}`)); |                 console_1.assert(fs_1.default.existsSync(`${sourceFolder}`)); | ||||||
|                 console_1.assert(fs_1.default.existsSync(`${path_1.default.basename(sourceFolder)}`)); |                 console_1.assert(fs_1.default.existsSync(`${path_1.default.basename(sourceFolder)}`)); | ||||||
|  | @ -576,15 +576,15 @@ class Caching { | ||||||
|                     .replace(/\n/g, ``) |                     .replace(/\n/g, ``) | ||||||
|                     .replace('.zip', ''); |                     .replace('.zip', ''); | ||||||
|                 process.chdir(cacheFolder); |                 process.chdir(cacheFolder); | ||||||
|                 const cacheSelection = cacheKey !== `` && fs_1.default.existsSync(cacheKey) ? cacheKey : latestInBranch; |                 const cacheSelection = cacheKey !== `` && fs_1.default.existsSync(`${cacheKey}.zip`) ? cacheKey : latestInBranch; | ||||||
|                 yield cloud_runner_logger_1.default.log(`cache key ${cacheKey} selection ${cacheSelection}`); |                 yield cloud_runner_logger_1.default.log(`cache key ${cacheKey} selection ${cacheSelection}`); | ||||||
|                 if (fs_1.default.existsSync(cacheSelection)) { |                 if (fs_1.default.existsSync(`${cacheSelection}.zip`)) { | ||||||
|                     if (__1.Input.cloudRunnerTests) { |                     if (__1.Input.cloudRunnerTests) { | ||||||
|                         yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`tree ${destinationFolder}`); |                         yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`tree ${destinationFolder}`); | ||||||
|                     } |                     } | ||||||
|                     remote_client_logger_1.RemoteClientLogger.log(`cache item exists`); |                     remote_client_logger_1.RemoteClientLogger.log(`cache item exists`); | ||||||
|                     console_1.assert(fs_1.default.existsSync(destinationFolder)); |                     console_1.assert(fs_1.default.existsSync(destinationFolder)); | ||||||
|                     yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`unzip -q ${cacheSelection}.zip -d ${path_1.default.basename(destinationFolder)}`); |                     yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`unzip -q ${cacheSelection} -d ${path_1.default.basename(destinationFolder)}`); | ||||||
|                     yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mv ${path_1.default.basename(destinationFolder)}/* ${destinationFolder}`); |                     yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mv ${path_1.default.basename(destinationFolder)}/* ${destinationFolder}`); | ||||||
|                     console_1.assert(fs_1.default.existsSync(`${path_1.default.join(destinationFolder, `${cacheSelection}.zip`)}`)); |                     console_1.assert(fs_1.default.existsSync(`${path_1.default.join(destinationFolder, `${cacheSelection}.zip`)}`)); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -20,8 +20,10 @@ export class Caching { | ||||||
|         CloudRunnerLogger.log(`Hashed cache folder ${await LFSHashing.hashAllFiles(sourceFolder)}`); |         CloudRunnerLogger.log(`Hashed cache folder ${await LFSHashing.hashAllFiles(sourceFolder)}`); | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       await CloudRunnerAgentSystem.Run(`zip -q -r ${cacheKey}.zip ${path.basename(sourceFolder)}`); |       await CloudRunnerAgentSystem.Run( | ||||||
|       assert(fs.existsSync(`${cacheKey}`)); |         `zip ${Input.cloudRunnerTests ? '' : '-q'} -r ${cacheKey} ${path.basename(sourceFolder)}`, | ||||||
|  |       ); | ||||||
|  |       assert(fs.existsSync(`${cacheKey}.zip`)); | ||||||
|       assert(fs.existsSync(`${cacheFolder}`)); |       assert(fs.existsSync(`${cacheFolder}`)); | ||||||
|       assert(fs.existsSync(`${sourceFolder}`)); |       assert(fs.existsSync(`${sourceFolder}`)); | ||||||
|       assert(fs.existsSync(`${path.basename(sourceFolder)}`)); |       assert(fs.existsSync(`${path.basename(sourceFolder)}`)); | ||||||
|  | @ -53,16 +55,16 @@ export class Caching { | ||||||
| 
 | 
 | ||||||
|       process.chdir(cacheFolder); |       process.chdir(cacheFolder); | ||||||
| 
 | 
 | ||||||
|       const cacheSelection = cacheKey !== `` && fs.existsSync(cacheKey) ? cacheKey : latestInBranch; |       const cacheSelection = cacheKey !== `` && fs.existsSync(`${cacheKey}.zip`) ? cacheKey : latestInBranch; | ||||||
|       await CloudRunnerLogger.log(`cache key ${cacheKey} selection ${cacheSelection}`); |       await CloudRunnerLogger.log(`cache key ${cacheKey} selection ${cacheSelection}`); | ||||||
| 
 | 
 | ||||||
|       if (fs.existsSync(cacheSelection)) { |       if (fs.existsSync(`${cacheSelection}.zip`)) { | ||||||
|         if (Input.cloudRunnerTests) { |         if (Input.cloudRunnerTests) { | ||||||
|           await CloudRunnerAgentSystem.Run(`tree ${destinationFolder}`); |           await CloudRunnerAgentSystem.Run(`tree ${destinationFolder}`); | ||||||
|         } |         } | ||||||
|         RemoteClientLogger.log(`cache item exists`); |         RemoteClientLogger.log(`cache item exists`); | ||||||
|         assert(fs.existsSync(destinationFolder)); |         assert(fs.existsSync(destinationFolder)); | ||||||
|         await CloudRunnerAgentSystem.Run(`unzip -q ${cacheSelection}.zip -d ${path.basename(destinationFolder)}`); |         await CloudRunnerAgentSystem.Run(`unzip -q ${cacheSelection} -d ${path.basename(destinationFolder)}`); | ||||||
|         await CloudRunnerAgentSystem.Run(`mv ${path.basename(destinationFolder)}/* ${destinationFolder}`); |         await CloudRunnerAgentSystem.Run(`mv ${path.basename(destinationFolder)}/* ${destinationFolder}`); | ||||||
|         assert(fs.existsSync(`${path.join(destinationFolder, `${cacheSelection}.zip`)}`)); |         assert(fs.existsSync(`${path.join(destinationFolder, `${cacheSelection}.zip`)}`)); | ||||||
|       } else { |       } else { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue