Skip to content

fix: when running in a docker container, save monitor command output in a file#384

Merged
adrukh merged 1 commit intomasterfrom
fix/monitor-result-in-docker
Feb 27, 2019
Merged

fix: when running in a docker container, save monitor command output in a file#384
adrukh merged 1 commit intomasterfrom
fix/monitor-result-in-docker

Conversation

@adrukh
Copy link
Contributor

@adrukh adrukh commented Feb 27, 2019

  • Ready for review
  • Follows CONTRIBUTING rules
  • Reviewed by Snyk internal team

What does this PR do?

Currently, only the regular result is output
However, the monitor result has some useful info such as the scan URL

This merges #381 as an internal contribution to overcome CI.

…in a file

Currently, only the regular result is output
However, the monitor result has some useful info such as the scan URL
@adrukh adrukh force-pushed the fix/monitor-result-in-docker branch from 385757d to 9d5cd3c Compare February 27, 2019 15:08
runCmdAsDockerUser "PATH=${PATH} snyk monitor --json ${SNYK_PARAMS} \
${ADDITIONAL_ENV} | jq -r \".uri\" | awk '{print \"<center><a target=\\\"_blank\\\" href=\\\"\" \$0 \"\\\">View On Snyk.io</a></center>\"}' > \"${PROJECT_PATH}/${PROJECT_FOLDER}/${HTML_FILE}\" 2>\"${ERROR_FILE}\""
runCmdAsDockerUser "PATH=$PATH snyk monitor --json ${SNYK_PARAMS} ${ADDITIONAL_ENV} > ${MONITOR_OUTPUT_FILE} 2>$ERROR_FILE"
runCmdAsDockerUser "cat ${MONITOR_OUTPUT_FILE} | jq -r \".uri\" | awk '{print \"<center><a target=\\\"_blank\\\" href=\\\"\" \$0 \"\\\">View On Snyk.io</a></center>\"}' > \"${PROJECT_PATH}/${PROJECT_FOLDER}/${HTML_FILE}\" 2>>\"${ERROR_FILE}\""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julienduchesne notice the extra > in ... 2>>\"${ERROR_FILE}\"" - I added it so that in case of a failure on the second command, stderr is appended to the file instead of overwriting it.

@adrukh adrukh self-assigned this Feb 27, 2019
@adrukh adrukh merged commit d96f17b into master Feb 27, 2019
@adrukh adrukh deleted the fix/monitor-result-in-docker branch February 27, 2019 15:24
@adrukh
Copy link
Contributor Author

adrukh commented Feb 27, 2019

@julienduchesne this is now merged and will be released with snyk@1.135.1. Please give dockerhub a few minutes hours to build the new images.

Thanks again for this contribution!

@snyksec
Copy link

snyksec commented Feb 27, 2019

🎉 This PR is included in version 1.135.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@julienduchesne
Copy link
Contributor

Thanks @adrukh !

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants