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

Add snyk monitor (closes #52) #53

Merged
merged 1 commit into from Aug 3, 2020

Conversation

lukeindykiewicz
Copy link
Contributor

@lukeindykiewicz lukeindykiewicz commented Jun 10, 2020

This adds snyk monitor as gh action, just because it's a lot easier than configure the Travis at the moment and it should happen only on push to master I believe, so it's not needed to install snyk via npm in travis (and waste time for it on every build).

@lukeindykiewicz lukeindykiewicz requested review from a team, benjben, chuwy, dilyand and oguzhanunlu and removed request for a team June 10, 2020 18:23
@paulboocock
Copy link
Contributor

This needs updating slightly as I've noticed it doesn't pick up the project name automatically, but uses the folder name. You can fix this however:

    - name: Run Snyk to check for vulnerabilities
      uses: snyk/actions/scala@master
      with:
        command: monitor
        args: --project-name=stream-collector

Additionally, Dilyan noticed some issues with sbt 1.3 in his testing. Not sure if you had the same issue when testing this locally?
https://snplow.atlassian.net/wiki/spaces/EN/pages/1205600277/Adding+Snyk+to+a+Project#sbt-1.3%2B-incompatibility

- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/scala@master
with:
command: monitor
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
command: monitor
command: monitor
args: --project-name=stream-collector --org=data-cap

Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to specify --org=data-cap if the service account token is generated against the Data Cap organisation in Snyk

Copy link
Contributor

Choose a reason for hiding this comment

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

Good, to know! Thanks @paulboocock!

Copy link
Contributor

Choose a reason for hiding this comment

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

But somehow you do need to specify --project-name if I'm not mistaken.

Copy link
Contributor

Choose a reason for hiding this comment

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

You'll probably need args: --project-name=stream-collector yes. It tries to find the project name from config, or it defaults to the containing folder name. Unfortunately Github actions maps this into a workspace folder in the docker image that's running behind the scenes. So specifying --project-name just guarentees we get nice names in the Snyk UI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@benjben I think this is explained, could you change PR status, please?

Copy link
Contributor

@chuwy chuwy left a comment

Choose a reason for hiding this comment

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

LGTM.

As Paul mentioned there might be problems with SBT 1.3, but it worked when I added latest RC of sbt-dependency-graph to project plugins.

- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/scala@master
with:
command: monitor
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it defaults to test which doesn't upload the report to the Snyk UI. Currently, we're looking at running monitor so we have full visibility of our projects in the Snyk UI.

test is useful if you want your build to fail if there are any vulnerabilities, which we will likely add to our build processes in the future once we're more comfortable with where we are at with Snyk.

- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/scala@master
with:
command: monitor
Copy link
Contributor

Choose a reason for hiding this comment

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

But somehow you do need to specify --project-name if I'm not mistaken.

@lukeindykiewicz
Copy link
Contributor Author

Not sure if you had the same issue when testing this locally?

yeah, but I added the global plugin and it worked. Now I checked the version, I use the same as Dilyan mentioned.

@lukeindykiewicz
Copy link
Contributor Author

As Paul mentioned there might be problems with SBT 1.3, but it worked when I added latest RC of sbt-dependency-graph to project plugins.

Thanks Anton! I already had that :)

@lukeindykiewicz lukeindykiewicz force-pushed the feature/snyk-monitor-gh-actions branch from c97b26a to 5694d09 Compare June 17, 2020 16:34
Copy link
Contributor

@benjben benjben left a comment

Choose a reason for hiding this comment

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

👍

@lukeindykiewicz lukeindykiewicz merged commit 6e32331 into develop Aug 3, 2020
@lukeindykiewicz lukeindykiewicz deleted the feature/snyk-monitor-gh-actions branch August 3, 2020 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants