From 32848ee7eb6f8cc56de04053015fcd444bf948cb Mon Sep 17 00:00:00 2001 From: Jeff DeWitt Date: Mon, 12 Feb 2024 15:20:55 -0500 Subject: [PATCH] chore: add debugs --- index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c24af73..70c3f09 100644 --- a/index.js +++ b/index.js @@ -61,6 +61,7 @@ const getFindings = async (ECR, repository, tag) => { * @returns {AWS.ECR.ImageScanFinding[]|AWS.AWSError|null} Results, Error or `null`. */ const getAllFindings = async (ECR, repository, tag) => { + core.debug('getAllFindings'); return await getPaginatedResults(async (NextMarker) => { const findings = await ECR.describeImageScanFindings({ imageId: { @@ -71,9 +72,13 @@ const getAllFindings = async (ECR, repository, tag) => { nextToken: NextMarker }).promise().catch( (err) => { + core.debug(`Error: ${err}`); if (err.code === 'ScanNotFoundException') { return null } throw err - }) + }); + + core.debug('getAllFindings returning'); + core.debug(`findings.nextToken: ${findings.nextToken}`); return { marker: findings.nextToken, @@ -217,8 +222,9 @@ const main = async () => { if (status !== 'COMPLETE' && status !== 'ACTIVE') { throw new Error(`Unhandled scan status "${status}". API response: ${JSON.stringify(findings)}`) } - + core.debug(`findings: ${JSON.stringify(findings)}`) const findingsList = !!ignoreList.length ? await getAllFindings(ECR, repository, tag) : [] // only fetch all findings if we have an ignore list + core.debug(`findingsList: ${JSON.stringify(findingsList)}`) const ignoredFindings = findingsList.filter(({ name }) => ignoreList.includes(name)) if (ignoreList.length !== ignoredFindings.length) {