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

Migrated artifact registry into new validation framework #117

Merged
merged 2 commits into from
Jan 19, 2024

Conversation

jdob
Copy link
Contributor

@jdob jdob commented Jan 18, 2024

  • Migrated the isEmbeddedArtifactRegistry check into the combustion file for the registry work since it's primarily used by that component

@jdob jdob requested review from atanasdinov and dbw7 January 18, 2024 21:31
Copy link
Contributor

@dbw7 dbw7 left a comment

Choose a reason for hiding this comment

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

This is the first time I’ve gotten to see the new validation changes, I really like it! None of the suggestions are urgent, very minor nits.

registryComponent = "Artifact Registry"
)

func validateEmbeddedArtefactRegistry(ctx *image.Context) []FailedValidation {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nit but Artifact is only spelled with an "e" once in the whole file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, I was trying to keep consistent with the other places in the code that use Artefact, forgetting it was part of the definition. I'll revert these for consistency within the file.

"github.com/suse-edge/edge-image-builder/pkg/image"
)

func TestValidateEmbeddedArtefactRegistry(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as before, shows up here and on line 65, but only for 2/17 instances.

"The 'name' field is required for each entry in 'charts'.",
},
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Another potential nit, I think this coverage is fine, but I think I'd also like to see individual failure cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The individual failure cases are covered in the respective tests for validating container images and helm charts. This test simply shows that both of those are called from this runner function.

"The 'repoURL' field must begin with either 'http://' or 'https://'.",
},
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same nit suggestion regarding individual failure cases (which is probably not necessary to be honest). Though I will say that I really like the way you concatenate the error messages, very cool.

Comment on lines 19 to 21
if combustion.IsEmbeddedArtifactRegistryEmpty(def.EmbeddedArtifactRegistry) {
return failures
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we drop this check? Relying on the combustion package for the validation itself seems weird and trying to iterate over nil slices should not lead to errors below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't love this dependency either; it was mostly because the check is used at both runtime and validation time. But since this is the only instance where that happens (so far) and like you said it doesn't affect the behavior, I agree with dropping it.

@jdob jdob merged commit a253a73 into suse-edge:main Jan 19, 2024
2 checks passed
@jdob jdob deleted the registry-validation branch February 22, 2024 16:19
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.

3 participants