Skip to content

Commit

Permalink
chore: add debugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jdew89 authored and alexjurkiewicz committed Mar 26, 2024
1 parent c520ae3 commit 32848ee
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 32848ee

Please sign in to comment.