include status code is error message
This commit is contained in:
parent
0c4fc16b49
commit
a23cb1d61a
2 changed files with 8 additions and 8 deletions
8
lib/upload-lib.js
generated
8
lib/upload-lib.js
generated
|
|
@ -78,15 +78,15 @@ async function uploadPayload(payload) {
|
||||||
const requestID = res.message.headers["x-github-request-id"];
|
const requestID = res.message.headers["x-github-request-id"];
|
||||||
// On any other status code that's not 5xx mark the upload as failed
|
// On any other status code that's not 5xx mark the upload as failed
|
||||||
if (!statusCode || statusCode < 500 || statusCode >= 600) {
|
if (!statusCode || statusCode < 500 || statusCode >= 600) {
|
||||||
core.setFailed('Upload failed (' + requestID + '): ' + await res.readBody());
|
core.setFailed('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// On a 5xx status code we may retry the request
|
// On a 5xx status code we may retry the request
|
||||||
if (attempt < backoffPeriods.length) {
|
if (attempt < backoffPeriods.length) {
|
||||||
// Log the failure as a warning but don't mark the action as failed yet
|
// Log the failure as a warning but don't mark the action as failed yet
|
||||||
core.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) +
|
core.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) +
|
||||||
') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] + ' seconds: ' +
|
') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] +
|
||||||
await res.readBody());
|
' seconds: (' + statusCode + ') ' + await res.readBody());
|
||||||
// Sleep for the backoff period
|
// Sleep for the backoff period
|
||||||
await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000));
|
await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000));
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -95,7 +95,7 @@ async function uploadPayload(payload) {
|
||||||
// If the upload fails with 5xx then we assume it is a temporary problem
|
// If the upload fails with 5xx then we assume it is a temporary problem
|
||||||
// with turbo-scan and not an error that the user has caused or can fix.
|
// with turbo-scan and not an error that the user has caused or can fix.
|
||||||
// We avoid marking the job as failed to avoid breaking CI workflows.
|
// We avoid marking the job as failed to avoid breaking CI workflows.
|
||||||
core.error('Upload failed (' + requestID + '): ' + await res.readBody());
|
core.error('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ async function uploadPayload(payload) {
|
||||||
|
|
||||||
// On any other status code that's not 5xx mark the upload as failed
|
// On any other status code that's not 5xx mark the upload as failed
|
||||||
if (!statusCode || statusCode < 500 || statusCode >= 600) {
|
if (!statusCode || statusCode < 500 || statusCode >= 600) {
|
||||||
core.setFailed('Upload failed (' + requestID + '): ' + await res.readBody());
|
core.setFailed('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,8 +86,8 @@ async function uploadPayload(payload) {
|
||||||
if (attempt < backoffPeriods.length) {
|
if (attempt < backoffPeriods.length) {
|
||||||
// Log the failure as a warning but don't mark the action as failed yet
|
// Log the failure as a warning but don't mark the action as failed yet
|
||||||
core.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) +
|
core.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) +
|
||||||
') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] + ' seconds: ' +
|
') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] +
|
||||||
await res.readBody());
|
' seconds: (' + statusCode + ') ' + await res.readBody());
|
||||||
// Sleep for the backoff period
|
// Sleep for the backoff period
|
||||||
await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000));
|
await new Promise(r => setTimeout(r, backoffPeriods[attempt] * 1000));
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -96,7 +96,7 @@ async function uploadPayload(payload) {
|
||||||
// If the upload fails with 5xx then we assume it is a temporary problem
|
// If the upload fails with 5xx then we assume it is a temporary problem
|
||||||
// with turbo-scan and not an error that the user has caused or can fix.
|
// with turbo-scan and not an error that the user has caused or can fix.
|
||||||
// We avoid marking the job as failed to avoid breaking CI workflows.
|
// We avoid marking the job as failed to avoid breaking CI workflows.
|
||||||
core.error('Upload failed (' + requestID + '): ' + await res.readBody());
|
core.error('Upload failed (' + requestID + '): (' + statusCode + ') ' + await res.readBody());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue