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

Sd 766 telefonistka get nil pointer dereference when it tries to diff a new application #27

Conversation

jared-logan-patrick-ct
Copy link

Description

Please provide a meaningful description of what this change will do, or is for. Bonus points for including links to related issues, other PRs, or technical references.

Note that by not including a description, you are asking reviewers to do extra work to understand the context of this change, which may lead to your PR taking much longer to review, or result in it not being reviewed at all.

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@jared-logan-patrick-ct
Copy link
Author

jared-logan-patrick-ct commented Oct 9, 2024

If findArgocdAppByManifestPathAnnotation reaches the end of the function it returns nil, nil.

The log message at the end of that function is the source of the observed No ArgoCD application found with manifest-generate-paths annotation that matches workspace/cloud-tools/logging/fluentd-pubsub(looked at repo https://github.com/commercetools/k8s-gitops, checked 192 apps)" message on line 6 in the stack trace output.

The foundApp is used here which, at this point in the code execution, would have returned nil.

I added an additional condition to check if the found app is nil which will result in retuning the error finding the argo app error.

@jared-logan-patrick-ct jared-logan-patrick-ct marked this pull request as ready for review October 10, 2024 20:38
Oded-B
Oded-B previously approved these changes Oct 15, 2024
@jared-logan-patrick-ct jared-logan-patrick-ct force-pushed the SD-766-Telefonistka-get-nil-pointer-dereference-when-it-tries-to-diff-a-new-application branch from 7f974f1 to 3ea2c25 Compare October 15, 2024 20:19
@jared-logan-patrick-ct jared-logan-patrick-ct force-pushed the SD-766-Telefonistka-get-nil-pointer-dereference-when-it-tries-to-diff-a-new-application branch from 3ea2c25 to 7188f6b Compare October 15, 2024 20:24
}

mockApplicationClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(expectedResponse, nil)
app, err := findArgocdAppByManifestPathAnnotation(ctx, "right/path", "some-repo", mockApplicationClient)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the reason this doesn't return an app because right/ != right/path?
If so I would use a different string to make it extra clear

Copy link
Collaborator

@Oded-B Oded-B Oct 16, 2024

Choose a reason for hiding this comment

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

like "Non existing app path" or something like that

@jared-logan-patrick-ct jared-logan-patrick-ct merged commit caaf793 into main Oct 18, 2024
5 checks passed
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