Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker error on monitoring multiple projects #1100

Merged
merged 1 commit into from
May 1, 2020

Conversation

joeholdcroft
Copy link

@joeholdcroft joeholdcroft commented May 1, 2020

What does this PR do?

Fixes an error thrown by jq when using our Docker images to monitor multiple projects (i.e. using --all-projects.

The error thrown by jq is:

jq: error (at <stdin>:737): Cannot index array with string "uri"

How should this be manually tested?

  • Pull down branch
  • Build local docker image (cd docker && docker build -f Dockerfile.docker . -t snyk/snyk-cli:local
  • Monitor a single project via this docker image
    • docker run --rm -e 'SNYK_TOKEN=***-**-**' -e 'MONITOR=true' -v <full-path-to-repo>:/project snyk/snyk-cli:local test -d
  • Monitor a multi project directory via this docker image
    • docker run --rm -e 'SNYK_TOKEN=***-**-**' -e 'MONITOR=true' -v <full-path-to-repo>:/project snyk/snyk-cli:local test --all-projects '--detection-depth=3' -d
  • Confirm that no errors occur and the HTML file for both single and multi projects includes link(s) to view the project on Snyk at the top

Any background context you want to provide?

This error occurs because the following line expects the results JSON to be an object with uri key, but in the case of multiple projects it's an array of objects with uri keys:

https://github.com/snyk/snyk/blob/d282b35e62874350f818a0bd6726e5994c3be700/docker/docker-entrypoint.sh#L106

Screenshots

Screenshot 2020-05-01 at 14 42 42

@joeholdcroft joeholdcroft requested a review from a team May 1, 2020 12:24
@joeholdcroft joeholdcroft self-assigned this May 1, 2020
@ghost ghost requested review from anthogez and aviadhahami May 1, 2020 12:24
@joeholdcroft joeholdcroft merged commit 3d773ca into master May 1, 2020
@joeholdcroft joeholdcroft deleted the fix/docker-monitor-all-projects branch May 1, 2020 13:47
@snyksec
Copy link

snyksec commented May 1, 2020

🎉 This PR is included in version 1.316.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants