-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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(cli): Add offline linting #5569
Conversation
13b762a
to
494e6ce
Compare
Codecov Report
@@ Coverage Diff @@
## master #5569 +/- ##
==========================================
- Coverage 47.08% 46.92% -0.17%
==========================================
Files 240 244 +4
Lines 15050 15202 +152
==========================================
+ Hits 7087 7134 +47
- Misses 7058 7162 +104
- Partials 905 906 +1
Continue to review full report at Codecov.
|
@alexec would be great if you could give some pointers on the implementation for offline linting, thanks! |
var explicitPath string | ||
var ( | ||
explicitPath string | ||
Offline bool |
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 wonder if we should have ARGO_OFFLINE
envvar?
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 think it would be better suited as an argument atm since it is only supported for the linting.
@@ -48,7 +48,10 @@ func NewCreateCommand() *cobra.Command { | |||
|
|||
func CreateCronWorkflows(filePaths []string, cliOpts *cliCreateOpts, submitOpts *wfv1.SubmitOpts) { | |||
ctx, apiClient := client.NewAPIClient() | |||
serviceClient := apiClient.NewCronWorkflowServiceClient() | |||
serviceClient, err := apiClient.NewCronWorkflowServiceClient() | |||
if err != nil { |
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.
minor: prefer errors.CheckError(err)
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 have tried to be consistent with the error handling in each part of the code. Suggest we make a clean up in a seperate PR to errors.CheckError(err)
. WDYT?
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 don't feel strongly. Any comment prefixed with "minor" is a suggestion.
Signed-off-by: NikeNano <niklas.sven.hansson@gmail.com>
f979ca7
to
0e207c2
Compare
Signed-off-by: NikeNano <niklas.sven.hansson@gmail.com>
Lint error
|
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.
Please lint
@@ -62,6 +66,7 @@ func NewClientFromOpts(opts Opts) (context.Context, Client, error) { | |||
if opts.ClientConfigSupplier != nil { | |||
opts.ClientConfig = opts.ClientConfigSupplier() | |||
} | |||
return newArgoKubeClient(opts.ClientConfig, instanceid.NewService(opts.InstanceID)) | |||
ctx, client, err := newArgoKubeClient(opts.ClientConfig, instanceid.NewService(opts.InstanceID)) | |||
return ctx, client, err |
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.
suggestion: revert
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.
Do you mean new line? Or that you actually want this to be indented?
@@ -14,6 +14,8 @@ import ( | |||
|
|||
type httpClient http1.Facade | |||
|
|||
var _ Client = &httpClient{} |
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.
nice
@@ -719,6 +721,24 @@ func (s *CLISuite) TestWorkflowLint() { | |||
}) | |||
} | |||
|
|||
func (s *CLISuite) TestWorkflowOfflineLint() { |
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.
nice
how do I re-trigger the tests again @alexec? |
there are some users submitting PRs adding crypto mining code - lets wait for them to go away |
Is is possible to run the tests again @alexec? |
Will continue to work on why the |
Signed-off-by: NikeNano <niklas.sven.hansson@gmail.com>
… into nikenano/offlineLint
Signed-off-by: NikeNano <niklas.sven.hansson@gmail.com>
Need to rerun the tests. |
Signed-off-by: NikeNano <niklas.sven.hansson@gmail.com>
Could you PTALA @alexec , thanks. |
}, | ||
} | ||
|
||
command.Flags().StringSliceVar(&lintKinds, "kinds", []string{"all"}, fmt.Sprintf("Which kinds will be linted. Can be: %s", strings.Join(allKinds, "|"))) | ||
command.Flags().StringVarP(&output, "output", "o", "pretty", "Linting results output format. One of: pretty|simple") | ||
command.Flags().BoolVar(&strict, "strict", true, "Perform strict workflow validation") | ||
command.Flags().BoolVar(&offline, "offline", false, "perform offline linting") |
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.
suggestion:
command.Flags().BoolVar(&client.Offline, "offline", false, "Go offline - do not connect to server")
Checklist: