-
Notifications
You must be signed in to change notification settings - Fork 274
feat(lint): add --all-variants flag for lint #4783
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
base: main
Are you sure you want to change the base?
Changes from 11 commits
e8ffd82
416a49e
fcdec7a
c1994db
a8d6f9d
9f24dc5
5d87d42
33b4ee2
f88caae
0c21d40
d6b523d
04e04b3
6375637
8a42b3b
05b19b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,7 @@ func getComponentToImportName(component v1alpha1.ZarfComponent) string { | |
| return component.Name | ||
| } | ||
|
|
||
| func resolveImports(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath, arch, flavor string, importStack []string, cachePath string, skipVersionCheck bool, remoteOptions types.RemoteOptions) (v1alpha1.ZarfPackage, error) { | ||
| func resolveImports(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath, arch, flavor string, importStack []string, cachePath string, allVariants, skipVersionCheck bool, remoteOptions types.RemoteOptions) (v1alpha1.ZarfPackage, error) { | ||
| l := logger.From(ctx) | ||
| start := time.Now() | ||
|
|
||
|
|
@@ -67,7 +67,7 @@ func resolveImports(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath, | |
| components := []v1alpha1.ZarfComponent{} | ||
|
|
||
| for _, component := range pkg.Components { | ||
| if !compatibleComponent(component, arch, flavor) { | ||
| if !compatibleComponent(component, arch, flavor, allVariants) { | ||
| continue | ||
| } | ||
|
|
||
|
|
@@ -110,7 +110,7 @@ func resolveImports(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath, | |
| } | ||
| } | ||
| importedPkg.Components = relevantComponents | ||
| importedPkg, err = resolveImports(ctx, importedPkg, importPkgPath.ManifestFile, arch, flavor, importStack, cachePath, skipVersionCheck, remoteOptions) | ||
| importedPkg, err = resolveImports(ctx, importedPkg, importPkgPath.ManifestFile, arch, flavor, importStack, cachePath, allVariants, skipVersionCheck, remoteOptions) | ||
| if err != nil { | ||
| return v1alpha1.ZarfPackage{}, err | ||
| } | ||
|
|
@@ -151,7 +151,7 @@ func resolveImports(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath, | |
| name := getComponentToImportName(component) | ||
| found := []v1alpha1.ZarfComponent{} | ||
| for _, component := range importedPkg.Components { | ||
| if component.Name == name && compatibleComponent(component, arch, flavor) { | ||
| if component.Name == name && compatibleComponent(component, arch, flavor, allVariants) { | ||
| found = append(found, component) | ||
| } | ||
| } | ||
|
|
@@ -259,9 +259,9 @@ func validateComponentCompose(c v1alpha1.ZarfComponent) error { | |
| return errors.Join(errs...) | ||
| } | ||
|
|
||
| func compatibleComponent(c v1alpha1.ZarfComponent, arch, flavor string) bool { | ||
| satisfiesArch := c.Only.Cluster.Architecture == "" || c.Only.Cluster.Architecture == arch | ||
| satisfiesFlavor := c.Only.Flavor == "" || c.Only.Flavor == flavor | ||
| func compatibleComponent(c v1alpha1.ZarfComponent, arch, flavor string, allVariants bool) bool { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we'll also want all variants of architectures.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I interpreted this to mean we want |
||
| satisfiesArch := c.Only.Cluster.Architecture == "" || c.Only.Cluster.Architecture == arch || allVariants | ||
| satisfiesFlavor := c.Only.Flavor == "" || c.Only.Flavor == flavor || allVariants | ||
| return satisfiesArch && satisfiesFlavor | ||
| } | ||
|
|
||
|
|
||
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.
We generally avoid reflect, I'd do something like this instead