10000 Add sub-action to download Grype by kzantow · Pull Request #152 · anchore/scan-action · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add sub-action to download Grype #152

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

Merged
merged 7 commits into from
Mar 31, 2022

Conversation

kzantow
Copy link
Contributor
@kzantow kzantow commented Mar 29, 2022

This PR adds a sub-action to download grype, along with some misc. code clean up that was discovered while working on this:

  • functions included in the compiled action code which were only being used by tests
  • split grype version to a separate file in preparation for adding an auto-updating job in a follow-on PR

An example run is: https://github.com/kzantow-anchore/scan-action-test/runs/5739124385?check_suite_focus=true#step:5:12

With an execution of the Grype binary: https://github.com/kzantow-anchore/scan-action-test/runs/5739124385?check_suite_focus=true#step:7:1

@kzantow kzantow force-pushed the add-install-grype-action branch from 0cc492b to 14c7231 Compare March 29, 2022 14:03
kzantow added 5 commits March 29, 2022 10:19
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
@kzantow kzantow marked this pull request as ready for review March 29, 2022 17:04
@kzantow kzantow requested a review from a team March 29, 2022 17:04
@@ -1,80 +1,113 @@
const error = require('../dist');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only changes in this file were moving some utility functions that were only used in this test from the action itself to this test.

run().catch((err) => {
throw new Error(err);
});
const entrypoint = core.getInput("run");
Copy link
Contributor Author
@kzantow kzantow Mar 29, 2022

Choose a reason for hiding this comment

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

I decided to use a parameter to switch functionality here instead of compiling multiple different files; there are some limitations to the ncc tool used to build the actual dist/index.js and limitations in github actions that mean you either need to do this or compile multiple distinct scripts, all of which have duplicated code. I did the latter approach in sbom-action but I'm probably going to swap to this method to simplify things and speed up the commit/build cycle.

@kzantow kzantow linked an issue Mar 29, 2022 that may be closed by this pull request
run: "download-grype",
});
expect(outputs.cmd).toBeDefined();

Choose a reason for hiding this comment

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

Is this comparing to blank? output === undefined? Because a successful execution doesn't output anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is comparing to undefined, which means this output is any sort of string.

@kzantow kzantow merged commit 637a129 into anchore:main Mar 31, 2022
@kzantow kzantow deleted the add-install-grype-action branch March 31, 2022 12:55
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.

Add sub-action for installing grype
2 participants
0