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

fix: Resolve issues with offline linter + add tests #10559

Conversation

julienduchesne
Copy link
Contributor

@julienduchesne julienduchesne commented Feb 21, 2023

#10059 was tested in very specific cases it seems (sorry about that 😬), because a couple things are wrong:

  • Linting directories does not work anymore
  • Resolving references in a namespace which doesn't show up in the given args, panics

In this PR, I fix those issues but I also add functional tests that checks that all of these cases work from the cmd level

I did not add to the argo/lint/lint_test.go tests and instead put the tests earlier down the line because the current tests do not cover the creation and configuration of the offline client (which is the part that is failing here, the actual linter was not modified in the PR above)

  • Create the PR as draft .
  • Run make pre-commit -B to fix codegen and lint problems.
  • Sign-off your commits (otherwise the DCO check will fail).
  • Use a conventional commit message (otherwise the commit message check will fail).
  • "Fixes #" is in both the PR title (for release notes) and this description (to automatically link and close the issue).
  • Add unit or e2e tests. Say how you tested your changes. If you changed the UI, attach screenshots.
  • Github checks are green.
  • Once required tests have passed, mark your PR "Ready for review".

Comment on lines +53 to 59
err := filepath.Walk(basePath, func(path string, info os.FileInfo, err error) error {
if info.IsDir() {
return nil
}

if _, ok := clusterWorkflowTemplateGetter.clusterWorkflowTemplates[cwftmpl.Name]; ok {
return nil, nil, fmt.Errorf("duplicate ClusterWorkflowTemplate found: %q", cwftmpl.Name)
if err != nil {
return err
}
Copy link
Contributor Author

@julienduchesne julienduchesne Feb 21, 2023

Choose a reason for hiding this comment

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

Reviewing without whitespace yields a nicer result here. The only real change is nesting the logic in a filepath.Walk

@julienduchesne julienduchesne force-pushed the julienduchesne/fix-issues-offline-linter branch from 5c82eaa to 704cc87 Compare February 21, 2023 05:00
@julienduchesne julienduchesne marked this pull request as ready for review February 21, 2023 05:00
@julienduchesne julienduchesne force-pushed the julienduchesne/fix-issues-offline-linter branch 4 times, most recently from 89e441e to 5199512 Compare February 22, 2023 00:47
argoproj#10059 was tested in very specific cases it seems because a couple things are wrong:
- Linting directories does not work anymore
- Resolving references in a namespace which doesn't show up in the given args, panics

In this PR, I fix those issues but I also add functional tests that checks that all of these cases work from the cmd level
I did not add to the `argo/lint/lint_test.go` tests and instead put the tests earlier down the line because the current tests do not cover the creation and configuration of the offline client

Signed-off-by: Julien Duchesne <julien.duchesne@grafana.com>
@julienduchesne julienduchesne force-pushed the julienduchesne/fix-issues-offline-linter branch from 5199512 to 2104aba Compare February 22, 2023 01:30
@alexec alexec merged commit f918e3a into argoproj:master Feb 24, 2023
@julienduchesne
Copy link
Contributor Author

Thanks for merging @alexec.

FYI, I have now been able to test this internally (we use a combination of CronWorkflows, WorkflowTemplates and ClusterWorkflowTemplates, with refs between each other) and have not seen any errors. We will start using it in our CI pipeline very soon.

@julienduchesne julienduchesne deleted the julienduchesne/fix-issues-offline-linter branch February 24, 2023 02:18
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.

2 participants