mirror of
				https://github.com/gradle/gradle-build-action.git
				synced 2025-11-04 09:58:56 +08:00 
			
		
		
		
	Build outputs
This commit is contained in:
		
							
								
								
									
										33
									
								
								dist/main/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								dist/main/index.js
									
									
									
									
										vendored
									
									
								
							@@ -700,6 +700,7 @@ const util = __importStar(__nccwpck_require__(3837));
 | 
			
		||||
const utils = __importStar(__nccwpck_require__(1518));
 | 
			
		||||
const constants_1 = __nccwpck_require__(8840);
 | 
			
		||||
const requestUtils_1 = __nccwpck_require__(3981);
 | 
			
		||||
const abort_controller_1 = __nccwpck_require__(2557);
 | 
			
		||||
/**
 | 
			
		||||
 * Pipes the body of a HTTP response to a stream
 | 
			
		||||
 *
 | 
			
		||||
@@ -883,15 +884,24 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
 | 
			
		||||
            const fd = fs.openSync(archivePath, 'w');
 | 
			
		||||
            try {
 | 
			
		||||
                downloadProgress.startDisplayTimer();
 | 
			
		||||
                const controller = new abort_controller_1.AbortController();
 | 
			
		||||
                const abortSignal = controller.signal;
 | 
			
		||||
                while (!downloadProgress.isDone()) {
 | 
			
		||||
                    const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
 | 
			
		||||
                    const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
 | 
			
		||||
                    downloadProgress.nextSegment(segmentSize);
 | 
			
		||||
                    const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
 | 
			
		||||
                    const result = yield promiseWithTimeout(options.segmentTimeoutInMs || 3600000, client.downloadToBuffer(segmentStart, segmentSize, {
 | 
			
		||||
                        abortSignal,
 | 
			
		||||
                        concurrency: options.downloadConcurrency,
 | 
			
		||||
                        onProgress: downloadProgress.onProgress()
 | 
			
		||||
                    });
 | 
			
		||||
                    fs.writeFileSync(fd, result);
 | 
			
		||||
                    }));
 | 
			
		||||
                    if (result === 'timeout') {
 | 
			
		||||
                        controller.abort();
 | 
			
		||||
                        throw new Error('Aborting cache download as the download time exceeded the timeout.');
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (Buffer.isBuffer(result)) {
 | 
			
		||||
                        fs.writeFileSync(fd, result);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            finally {
 | 
			
		||||
@@ -902,6 +912,16 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
exports.downloadCacheStorageSDK = downloadCacheStorageSDK;
 | 
			
		||||
const promiseWithTimeout = (timeoutMs, promise) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    let timeoutHandle;
 | 
			
		||||
    const timeoutPromise = new Promise(resolve => {
 | 
			
		||||
        timeoutHandle = setTimeout(() => resolve('timeout'), timeoutMs);
 | 
			
		||||
    });
 | 
			
		||||
    return Promise.race([promise, timeoutPromise]).then(result => {
 | 
			
		||||
        clearTimeout(timeoutHandle);
 | 
			
		||||
        return result;
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
//# sourceMappingURL=downloadUtils.js.map
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
@@ -1252,7 +1272,8 @@ function getDownloadOptions(copy) {
 | 
			
		||||
    const result = {
 | 
			
		||||
        useAzureSdk: true,
 | 
			
		||||
        downloadConcurrency: 8,
 | 
			
		||||
        timeoutInMs: 30000
 | 
			
		||||
        timeoutInMs: 30000,
 | 
			
		||||
        segmentTimeoutInMs: 3600000
 | 
			
		||||
    };
 | 
			
		||||
    if (copy) {
 | 
			
		||||
        if (typeof copy.useAzureSdk === 'boolean') {
 | 
			
		||||
@@ -1264,10 +1285,14 @@ function getDownloadOptions(copy) {
 | 
			
		||||
        if (typeof copy.timeoutInMs === 'number') {
 | 
			
		||||
            result.timeoutInMs = copy.timeoutInMs;
 | 
			
		||||
        }
 | 
			
		||||
        if (typeof copy.segmentTimeoutInMs === 'number') {
 | 
			
		||||
            result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
 | 
			
		||||
    core.debug(`Download concurrency: ${result.downloadConcurrency}`);
 | 
			
		||||
    core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
 | 
			
		||||
    core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
exports.getDownloadOptions = getDownloadOptions;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								dist/main/index.js.map
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/main/index.js.map
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user