build: improve logging on http errors during release process (#43756)

This commit is contained in:
Samuel Attard 2024-09-17 14:30:51 -07:00 committed by GitHub
parent 233724fe00
commit 10ba87a85e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 6 deletions

View file

@ -397,9 +397,15 @@ async function verifyDraftGitHubReleaseAssets (release) {
const response = await got(url, {
followRedirect: false,
method: 'HEAD',
headers
headers,
throwHttpErrors: false
});
if (response.status !== 200) {
console.error('Failed to HEAD github asset: ' + url);
throw new Error('Unexpected status HEAD\'ing github asset: ' + response.status);
}
return { url: response.headers.location, file: asset.name };
})).catch(err => {
console.error(`${fail} Error downloading files from GitHub`, err);
@ -410,7 +416,16 @@ async function verifyDraftGitHubReleaseAssets (release) {
}
async function getShaSumMappingFromUrl (shaSumFileUrl, fileNamePrefix) {
const response = await got(shaSumFileUrl);
const response = await got(shaSumFileUrl, {
throwHttpErrors: false
});
if (response.status !== 200) {
console.error('Failed to fetch SHASUM mapping: ' + shaSumFileUrl);
console.error('Bad SHASUM mapping response: ' + response.body.trim());
throw new Error('Unexpected status fetching SHASUM mapping: ' + response.status);
}
const raw = response.body;
return raw.split('\n').map(line => line.trim()).filter(Boolean).reduce((map, line) => {
const [sha, file] = line.replace(' ', ' ').split(' ');