From 497d5d2eeea672aec565daaddc7082553e03bf68 Mon Sep 17 00:00:00 2001 From: Prajjwal Date: Wed, 26 Mar 2025 09:47:32 +0530 Subject: [PATCH] adds r2 support --- dist/index.js | 12 ++++++++---- package.json | 4 ++-- yarn.lock | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index fc424bda0..961727690 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2831,7 +2831,7 @@ function getContentRange(start, end) { return `bytes ${start}-${end}/*`; } function uploadChunk(resourceUrl, openStream, partNumber, start, end) { - var _a, _b; + var _a, _b, _c; return __awaiter(this, void 0, void 0, function* () { core.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`); // Manually convert the readable stream to a buffer. S3 doesn't allow stream as input @@ -2852,7 +2852,9 @@ function uploadChunk(resourceUrl, openStream, partNumber, start, end) { }; } catch (error) { - throw new Error(`Cache service responded with ${(_b = error.response) === null || _b === void 0 ? void 0 : _b.status} during upload chunk.`); + core.debug(JSON.stringify(error)); + core.debug(JSON.stringify((_b = error.response) === null || _b === void 0 ? void 0 : _b.data)); + throw new Error(`Cache service responded with ${(_c = error.response) === null || _c === void 0 ? void 0 : _c.status} during upload chunk.`); } }); } @@ -2873,7 +2875,7 @@ function uploadFileToS3(preSignedURLs, archivePath) { for (let i = 0; i < numberOfChunks; i += concurrency) { const batch = preSignedURLs .slice(i, i + concurrency) - .map((presignedURL, index) => { + .map((presignedURL, index) => __awaiter(this, void 0, void 0, function* () { const chunkIndex = i + index; const chunkSize = Math.ceil(fileSize / numberOfChunks); const start = offset; @@ -2887,9 +2889,10 @@ function uploadFileToS3(preSignedURLs, archivePath) { autoClose: false }) .on('error', error => { + core.debug(JSON.stringify(error)); throw new Error(`Cache upload failed because file read failed with ${error.message}`); }), chunkIndex + 1, start, end); - }); + })); const batchResults = yield Promise.all(batch); completedParts.push(...batchResults); } @@ -2916,6 +2919,7 @@ function multiPartUploadToGCS(storage, localArchivePath, bucketName, objectName) }); } catch (error) { + core.debug(JSON.stringify(error)); throw new Error(`Failed to upload to GCS: ${error}`); } }); diff --git a/package.json b/package.json index 146e70e23..9890f0898 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setup-ruby", - "version": "0.1.1", + "version": "0.2.1", "description": "Download a prebuilt Ruby and add it to the PATH in 5 seconds", "main": "index.js", "scripts": { @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/ruby/setup-ruby", "dependencies": { - "@actions/cache": "npm:github-actions.warp-cache@1.4.3", + "@actions/cache": "npm:github-actions.warp-cache@1.4.5", "@actions/core": "^1.10.0", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.2", diff --git a/yarn.lock b/yarn.lock index 71db376d6..af5de3c42 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@actions/cache@npm:github-actions.warp-cache@1.4.3": - version "1.4.3" - resolved "https://registry.yarnpkg.com/github-actions.warp-cache/-/github-actions.warp-cache-1.4.3.tgz#f0ebec9c0fffeaf3128f992981224157d74865f4" - integrity sha512-78PwiWEIrfsOmK2m+j1d9qffIf/WyD6rQZr1NGJWyY/EnNyK28CHXAlLqvCl6ljo+S/yLo65BElNUBoG9hJ0Rw== +"@actions/cache@npm:github-actions.warp-cache@1.4.5": + version "1.4.5" + resolved "https://registry.yarnpkg.com/github-actions.warp-cache/-/github-actions.warp-cache-1.4.5.tgz#cd876eb29f96e96ac8170f7f702109318e64813b" + integrity sha512-soTIk/9slFpK+InPtBSFFN8JAXOCKTBWQkP+gdylLCmtbZyMsaUAxUxAnsI7G4CsfAqE1IcPlyqDw0ZAtIIFrQ== dependencies: "@actions/core" "^1.10.0" "@actions/exec" "^1.0.1"