mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 11:48:38 +08:00 
			
		
		
		
	Add support for S3 endpoints
This commit is contained in:
		
							parent
							
								
									1def6032df
								
							
						
					
					
						commit
						7994cabd39
					
				|  | @ -42,6 +42,7 @@ Be aware of S3 transfer costs if your runners are not in the same AWS region as | ||||||
| ## Special environment variables | ## Special environment variables | ||||||
| 
 | 
 | ||||||
| * `RUNS_ON_S3_BUCKET_CACHE`: if set, the action will use this bucket to store the cache. | * `RUNS_ON_S3_BUCKET_CACHE`: if set, the action will use this bucket to store the cache. | ||||||
|  | * `RUNS_ON_S3_BUCKET_ENDPOINT`: if set, the action will use this endpoint to connect to the bucket. This is useful if you are using AWS's S3 transfer acceleration or a non-AWS S3-compatible service. | ||||||
| * `RUNS_ON_RUNNER_NAME`: when running on RunsOn, where this environment variable is non-empty, existing AWS credentials from the environment will be discarded. If you want to preserve existing environment variables, set this to the empty string `""`. | * `RUNS_ON_RUNNER_NAME`: when running on RunsOn, where this environment variable is non-empty, existing AWS credentials from the environment will be discarded. If you want to preserve existing environment variables, set this to the empty string `""`. | ||||||
| * `RUNS_ON_S3_FORCE_PATH_STYLE` or `AWS_S3_FORCE_PATH_STYLE`: if one of those environment variables equals the string `"true"`, then the S3 client will be configured to force the path style. | * `RUNS_ON_S3_FORCE_PATH_STYLE` or `AWS_S3_FORCE_PATH_STYLE`: if one of those environment variables equals the string `"true"`, then the S3 client will be configured to force the path style. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							|  | @ -93784,6 +93784,7 @@ if (process.env.RUNS_ON_RUNNER_NAME && process.env.RUNS_ON_RUNNER_NAME !== "") { | ||||||
| } | } | ||||||
| const versionSalt = "1.0"; | const versionSalt = "1.0"; | ||||||
| const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | ||||||
|  | const endpoint = process.env.RUNS_ON_S3_BUCKET_ENDPOINT; | ||||||
| const region = process.env.RUNS_ON_AWS_REGION || | const region = process.env.RUNS_ON_AWS_REGION || | ||||||
|     process.env.AWS_REGION || |     process.env.AWS_REGION || | ||||||
|     process.env.AWS_DEFAULT_REGION; |     process.env.AWS_DEFAULT_REGION; | ||||||
|  | @ -93793,7 +93794,7 @@ const uploadQueueSize = Number(process.env.UPLOAD_QUEUE_SIZE || "4"); | ||||||
| const uploadPartSize = Number(process.env.UPLOAD_PART_SIZE || "32") * 1024 * 1024; | const uploadPartSize = Number(process.env.UPLOAD_PART_SIZE || "32") * 1024 * 1024; | ||||||
| const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | ||||||
| const downloadPartSize = Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | const downloadPartSize = Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | ||||||
| const s3Client = new client_s3_1.S3Client({ region, forcePathStyle }); | const s3Client = new client_s3_1.S3Client({ region, forcePathStyle, endpoint }); | ||||||
| function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | ||||||
|     // don't pass changes upstream
 |     // don't pass changes upstream
 | ||||||
|     const components = paths.slice(); |     const components = paths.slice(); | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							|  | @ -93784,6 +93784,7 @@ if (process.env.RUNS_ON_RUNNER_NAME && process.env.RUNS_ON_RUNNER_NAME !== "") { | ||||||
| } | } | ||||||
| const versionSalt = "1.0"; | const versionSalt = "1.0"; | ||||||
| const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | ||||||
|  | const endpoint = process.env.RUNS_ON_S3_BUCKET_ENDPOINT; | ||||||
| const region = process.env.RUNS_ON_AWS_REGION || | const region = process.env.RUNS_ON_AWS_REGION || | ||||||
|     process.env.AWS_REGION || |     process.env.AWS_REGION || | ||||||
|     process.env.AWS_DEFAULT_REGION; |     process.env.AWS_DEFAULT_REGION; | ||||||
|  | @ -93793,7 +93794,7 @@ const uploadQueueSize = Number(process.env.UPLOAD_QUEUE_SIZE || "4"); | ||||||
| const uploadPartSize = Number(process.env.UPLOAD_PART_SIZE || "32") * 1024 * 1024; | const uploadPartSize = Number(process.env.UPLOAD_PART_SIZE || "32") * 1024 * 1024; | ||||||
| const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | ||||||
| const downloadPartSize = Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | const downloadPartSize = Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | ||||||
| const s3Client = new client_s3_1.S3Client({ region, forcePathStyle }); | const s3Client = new client_s3_1.S3Client({ region, forcePathStyle, endpoint }); | ||||||
| function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | ||||||
|     // don't pass changes upstream
 |     // don't pass changes upstream
 | ||||||
|     const components = paths.slice(); |     const components = paths.slice(); | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							|  | @ -93784,6 +93784,7 @@ if (process.env.RUNS_ON_RUNNER_NAME && process.env.RUNS_ON_RUNNER_NAME !== "") { | ||||||
| } | } | ||||||
| const versionSalt = "1.0"; | const versionSalt = "1.0"; | ||||||
| const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | ||||||
|  | const endpoint = process.env.RUNS_ON_S3_BUCKET_ENDPOINT; | ||||||
| const region = process.env.RUNS_ON_AWS_REGION || | const region = process.env.RUNS_ON_AWS_REGION || | ||||||
|     process.env.AWS_REGION || |     process.env.AWS_REGION || | ||||||
|     process.env.AWS_DEFAULT_REGION; |     process.env.AWS_DEFAULT_REGION; | ||||||
|  | @ -93793,7 +93794,7 @@ const uploadQueueSize = Number(process.env.UPLOAD_QUEUE_SIZE || "4"); | ||||||
| const uploadPartSize = Number(process.env.UPLOAD_PART_SIZE || "32") * 1024 * 1024; | const uploadPartSize = Number(process.env.UPLOAD_PART_SIZE || "32") * 1024 * 1024; | ||||||
| const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | ||||||
| const downloadPartSize = Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | const downloadPartSize = Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | ||||||
| const s3Client = new client_s3_1.S3Client({ region, forcePathStyle }); | const s3Client = new client_s3_1.S3Client({ region, forcePathStyle, endpoint }); | ||||||
| function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | ||||||
|     // don't pass changes upstream
 |     // don't pass changes upstream
 | ||||||
|     const components = paths.slice(); |     const components = paths.slice(); | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							|  | @ -93784,6 +93784,7 @@ if (process.env.RUNS_ON_RUNNER_NAME && process.env.RUNS_ON_RUNNER_NAME !== "") { | ||||||
| } | } | ||||||
| const versionSalt = "1.0"; | const versionSalt = "1.0"; | ||||||
| const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | ||||||
|  | const endpoint = process.env.RUNS_ON_S3_BUCKET_ENDPOINT; | ||||||
| const region = process.env.RUNS_ON_AWS_REGION || | const region = process.env.RUNS_ON_AWS_REGION || | ||||||
|     process.env.AWS_REGION || |     process.env.AWS_REGION || | ||||||
|     process.env.AWS_DEFAULT_REGION; |     process.env.AWS_DEFAULT_REGION; | ||||||
|  | @ -93793,7 +93794,7 @@ const uploadQueueSize = Number(process.env.UPLOAD_QUEUE_SIZE || "4"); | ||||||
| const uploadPartSize = Number(process.env.UPLOAD_PART_SIZE || "32") * 1024 * 1024; | const uploadPartSize = Number(process.env.UPLOAD_PART_SIZE || "32") * 1024 * 1024; | ||||||
| const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | ||||||
| const downloadPartSize = Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | const downloadPartSize = Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | ||||||
| const s3Client = new client_s3_1.S3Client({ region, forcePathStyle }); | const s3Client = new client_s3_1.S3Client({ region, forcePathStyle, endpoint }); | ||||||
| function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | ||||||
|     // don't pass changes upstream
 |     // don't pass changes upstream
 | ||||||
|     const components = paths.slice(); |     const components = paths.slice(); | ||||||
|  |  | ||||||
|  | @ -36,6 +36,7 @@ if (process.env.RUNS_ON_RUNNER_NAME && process.env.RUNS_ON_RUNNER_NAME !== "") { | ||||||
| 
 | 
 | ||||||
| const versionSalt = "1.0"; | const versionSalt = "1.0"; | ||||||
| const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; | ||||||
|  | const endpoint = process.env.RUNS_ON_S3_BUCKET_ENDPOINT; | ||||||
| const region = | const region = | ||||||
|     process.env.RUNS_ON_AWS_REGION || |     process.env.RUNS_ON_AWS_REGION || | ||||||
|     process.env.AWS_REGION || |     process.env.AWS_REGION || | ||||||
|  | @ -51,7 +52,7 @@ const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | ||||||
| const downloadPartSize = | const downloadPartSize = | ||||||
|     Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; |     Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | ||||||
| 
 | 
 | ||||||
| const s3Client = new S3Client({ region, forcePathStyle }); | const s3Client = new S3Client({ region, forcePathStyle, endpoint }); | ||||||
| 
 | 
 | ||||||
| export function getCacheVersion( | export function getCacheVersion( | ||||||
|     paths: string[], |     paths: string[], | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Brenden Matthews
						Brenden Matthews