anchore / anchore-engine

A service that analyzes docker images and scans for vulnerabilities
Apache License 2.0
1.58k stars 273 forks source link

failed to get anchor-reports/ directory on github runner after analysis is done #573

Open farooqdevops opened 4 years ago

farooqdevops commented 4 years ago

Is this a request for help?: yes

What happened: i am using anchor/scan-action with my github repo. when i run the workflows, it scans the image but then i am unable to get anchor-reports as that fails to be copied on github runner (logs attached). Can some one check why this happens. I have attached github workflow file for reference:

**relevant log output from github runner:

Logs for step: Scan the built image

`+ echo 'Copying scan reports from 2166-inline-anchore-engine to /home/runner/work/test-backend/test-backend/anchore-reports/' Copying scan reports from 2166-inline-anchore-engine to /home/runner/work/test-backend/test-backend/anchore-reports/ + docker cp 2166-inline-anchore-engine:/anchore-engine/anchore-reports/ ./ Error: No such container:path: 2166-inline-anchore-engine:/anchore-engine/anchore-reports/

Cleaning up docker container: 7eeb995deecd938f8cc5c0d1c7e9c13913f4be3a117812f61f952bff9a06e23f

anchore inline scan JSON results0s ls: cannot access './anchore-reports/*.json': No such file or directory Run for j inls ./anchore-reports/.json`; do echo "---- ${j} ----"; cat ${j}; echo; done ls: cannot access './anchore-reports/.json': No such file or directory`

Github workflow file `steps:

nurmi commented 4 years ago

hi @farooqdevops - we need to clean up some of that output, but the specific error you're referencing is not something that should prevent the scan action from working correctly, since for the scan action itself the anchore-reports is created and populated outside the invocation of the inline_scan container itself.

If you're not seeing any anchore-reports after the scan action executes, there is something going wrong but it isn't related to that particular log snippet. some additional output and debugging commands ('ls -al' before and after the scan action, etc) could help narrow down the investigation! On a successful run, you should have an anchore-reports/ directory with JSON files in it, that can be inspected/used for review of the scan action output.

farooqdevops commented 4 years ago

@nurmi Thanks for your response. It failed due to executing command on wrong directory (inside where Dockerfile resides). so executing outside that dir now runs it correctly. However "upload Anchore scan SARIF report" step fails with 403 permission denied as it requires to enable "Code scanning alerts" and for that first i have to sign-up for beta.