From 18d8df80ca5176c0a2629e5f91cfe04609125c3c Mon Sep 17 00:00:00 2001 From: Aditya Samantaray Date: Tue, 8 Oct 2024 18:03:36 +0530 Subject: [PATCH 1/3] chore: add usage logging for build artifacts failures --- bin/helpers/buildArtifacts.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/helpers/buildArtifacts.js b/bin/helpers/buildArtifacts.js index 6f361af9..844ad3b6 100644 --- a/bin/helpers/buildArtifacts.js +++ b/bin/helpers/buildArtifacts.js @@ -35,6 +35,9 @@ const parseAndDownloadArtifacts = async (buildId, data, bsConfig, args, rawArgs, utils.sendUsageReport(bsConfig, args, warningMessage, Constants.messageTypes.ERROR, 'build_artifacts_not_found', buildReportData, rawArgs); } else { BUILD_ARTIFACTS_FAIL_COUNT += 1; + const errorMsg = `Error downloading build artifacts for ${sessionId} with error: ${error}`; + logger.debug(errorMsg); + utils.sendUsageReport(bsConfig, args, errorMsg, Constants.messageTypes.ERROR, 'build_artifacts_parse_error', buildReportData, rawArgs); } // delete malformed zip if present let tmpFilePath = path.join(filePath, fileName); @@ -102,6 +105,7 @@ const downloadAndUnzip = async (filePath, fileName, url) => { let tmpFilePath = path.join(filePath, fileName); const writer = fs.createWriteStream(tmpFilePath); + logger.debug(`Downloading build artifact for: ${filePath}`) return new Promise(async (resolve, reject) => { request.get(url).on('response', function(response) { @@ -109,7 +113,8 @@ const downloadAndUnzip = async (filePath, fileName, url) => { if (response.statusCode === 404) { reject(Constants.userMessages.DOWNLOAD_BUILD_ARTIFACTS_NOT_FOUND); } - reject(); + const errorMsg = `Non 200 status code, got status code: ${response.statusCode}`; + reject(errorMsg); } else { //ensure that the user can call `then()` only when the file has //been downloaded entirely. From 5a5faf1ac90cf1ca21a447d0e42e3602a18915c0 Mon Sep 17 00:00:00 2001 From: Aditya Samantaray Date: Tue, 8 Oct 2024 18:10:38 +0530 Subject: [PATCH 2/3] chore: add logging for response message --- bin/helpers/buildArtifacts.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/helpers/buildArtifacts.js b/bin/helpers/buildArtifacts.js index 844ad3b6..6c0be3b9 100644 --- a/bin/helpers/buildArtifacts.js +++ b/bin/helpers/buildArtifacts.js @@ -114,6 +114,7 @@ const downloadAndUnzip = async (filePath, fileName, url) => { reject(Constants.userMessages.DOWNLOAD_BUILD_ARTIFACTS_NOT_FOUND); } const errorMsg = `Non 200 status code, got status code: ${response.statusCode}`; + logger.debug(`${errorMsg} with response: ${response.message}`); reject(errorMsg); } else { //ensure that the user can call `then()` only when the file has From 6a6bb5533333482ff13bcc9551238ba0d7e6fb73 Mon Sep 17 00:00:00 2001 From: Aditya Samantaray Date: Tue, 8 Oct 2024 18:20:13 +0530 Subject: [PATCH 3/3] chore: remove logging for response message --- bin/helpers/buildArtifacts.js | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/helpers/buildArtifacts.js b/bin/helpers/buildArtifacts.js index 6c0be3b9..844ad3b6 100644 --- a/bin/helpers/buildArtifacts.js +++ b/bin/helpers/buildArtifacts.js @@ -114,7 +114,6 @@ const downloadAndUnzip = async (filePath, fileName, url) => { reject(Constants.userMessages.DOWNLOAD_BUILD_ARTIFACTS_NOT_FOUND); } const errorMsg = `Non 200 status code, got status code: ${response.statusCode}`; - logger.debug(`${errorMsg} with response: ${response.message}`); reject(errorMsg); } else { //ensure that the user can call `then()` only when the file has