Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(artifacts): fix NPE when expected artifact is null #4846

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kirangodishala
Copy link
Contributor

This is to address the issue : spinnaker/spinnaker#7004

While resolving expected artifact NullPointerException is thrown if the artifact is null.

Added a test to demonstrate the issue and provided the fix which identifies null artifact and throws InvalidRequestException which is a SpinnakerException.

@@ -120,6 +120,9 @@ public ResolveResult resolveExpectedArtifacts(Iterable<ExpectedArtifact> expecte
ImmutableList.Builder<ExpectedArtifact> boundExpectedArtifacts = ImmutableList.builder();

for (ExpectedArtifact expectedArtifact : expectedArtifacts) {
if (expectedArtifact == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

eh? Why would an expected artifact be null? Is this due to clouddriver failing image resolution and deciding to return null instead of an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not supposed to be null but looks like someone got NPE somehow(ref: spinnaker/spinnaker#7004). We will investigate the reason but I believe allowing NPE in any case is bad, so this PR is to address those edge cases.

Copy link
Contributor

@xibz xibz Feb 22, 2025

Choose a reason for hiding this comment

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

Im fairly certain it's due to clouddriver image resolution. Instead of failing and returning an error, it returns null for some odd reason. We may opt to fix that instead of the null check here which should be invalid.

This is important cause if we skip the artifact, things may not resolve properly. Like instead of using the expected artifact it will use the default artifact of the pipeline if configured as such.

So I think we need to investigate the why here first

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants