From 678f278caaca8797ea292b621c4b0bc33b757d7f Mon Sep 17 00:00:00 2001 From: Dave Hadka Date: Tue, 3 Nov 2020 09:53:44 -0600 Subject: [PATCH 1/2] Handle non-successful responses from uploadChunk --- packages/cache/src/internal/cacheHttpClient.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/cache/src/internal/cacheHttpClient.ts b/packages/cache/src/internal/cacheHttpClient.ts index 77954e94..dab39115 100644 --- a/packages/cache/src/internal/cacheHttpClient.ts +++ b/packages/cache/src/internal/cacheHttpClient.ts @@ -194,7 +194,7 @@ async function uploadChunk( 'Content-Range': getContentRange(start, end) } - await retryHttpClientResponse( + const uploadChunkResponse = await retryHttpClientResponse( `uploadChunk (start: ${start}, end: ${end})`, async () => httpClient.sendStream( @@ -204,6 +204,12 @@ async function uploadChunk( additionalHeaders ) ) + + if (!isSuccessStatusCode(uploadChunkResponse.message.statusCode)) { + throw new Error( + `Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.` + ) + } } async function uploadFile( From 5e8657cf12c34044e4676ce31446be682d2630de Mon Sep 17 00:00:00 2001 From: Dave Hadka Date: Tue, 3 Nov 2020 13:12:34 -0600 Subject: [PATCH 2/2] Bump @actions/cache to 1.0.4 --- packages/cache/RELEASES.md | 4 ++++ packages/cache/package-lock.json | 8 ++++---- packages/cache/package.json | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/cache/RELEASES.md b/packages/cache/RELEASES.md index 1bd0fb7e..97825762 100644 --- a/packages/cache/RELEASES.md +++ b/packages/cache/RELEASES.md @@ -26,3 +26,7 @@ - Use http-client v1.0.9 - Fixes error handling so retries are not attempted on non-retryable errors (409 Conflict, for example) - Adds 5 second delay between retry attempts + +### 1.0.4 +- Use @actions/core v1.2.6 +- Fixes uploadChunk to throw an error if any unsuccessful response code is received diff --git a/packages/cache/package-lock.json b/packages/cache/package-lock.json index f92f9af7..b928bcd4 100644 --- a/packages/cache/package-lock.json +++ b/packages/cache/package-lock.json @@ -1,13 +1,13 @@ { "name": "@actions/cache", - "version": "1.0.3", + "version": "1.0.4", "lockfileVersion": 1, "requires": true, "dependencies": { "@actions/core": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz", - "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", + "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" }, "@actions/exec": { "version": "1.0.4", diff --git a/packages/cache/package.json b/packages/cache/package.json index 8184056d..6848c230 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "1.0.3", + "version": "1.0.4", "preview": true, "description": "Actions cache lib", "keywords": [ @@ -37,7 +37,7 @@ "url": "https://github.com/actions/toolkit/issues" }, "dependencies": { - "@actions/core": "^1.2.4", + "@actions/core": "^1.2.6", "@actions/exec": "^1.0.1", "@actions/glob": "^0.1.0", "@actions/http-client": "^1.0.9",