-
Notifications
You must be signed in to change notification settings - Fork 580
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
feat: adding cta for docker users #1352
Conversation
956692b
to
8a1c76f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
src/cli/commands/test/index.ts
Outdated
@@ -263,6 +264,10 @@ async function test(...args: MethodArgs): Promise<TestCommandResult> { | |||
// first one | |||
error.code = errorResults[0].code; | |||
error.userMessage = errorResults[0].userMessage; | |||
if (error.userMessage === 'Test limit reached!' && options.isDockerUser) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That condition might be a bit fragile (if message changes), but probably we don't have an alternative check we could use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see any better way of doing this, but open to suggestions if anyone would have an idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a type to the error? Maybe do something like error.userMessage === SomeDefinedError.errorMessage
Defined error example: https://github.com/snyk/snyk/blob/924f10abbc8d78da74fcd5ee0fbdd14dc11e7705/src/lib/errors/authentication-failed-error.ts#L5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orsagie WDYT? added an error type for it and changed the condition
983dfea
to
e177956
Compare
e177956
to
4f16863
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename the Pull request to not have the internal ticket ID before merging?
🎉 This PR is included in version 1.382.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What does this PR do?
Adding a CTA if a test is made without an API key and with a Docker JWT.
There are 2 cases -
Scan successful


Scan not successful - the user has reached the free test limit

How should this be manually tested?
Need to setup the env locally with JWT auth enabled and with a valid token.
In any
snyk test
where the API key doesn't exist and theSNYK_DOCKER_TOKEN
env var is set, the CTA should be displayed.