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
[feature] Understanding packages from bundle directory #241
[feature] Understanding packages from bundle directory #241
Conversation
/retest |
1 similar comment
/retest |
e99aaa9
to
ed35d3d
Compare
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.
/hold
The package inference looks good, but I have concerns about using the graph loader here - please see comments inline.
pkg/registry/csv.go
Outdated
|
||
return &csv, nil | ||
} | ||
return nil, fmt.Errorf("csv typed YAML file not found in %s", bundleDir) |
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.
nit: no ClusterServiceVersion object found in %s
(since this parses yaml/json, don't indicate to users that it must be yaml)
return nil, fmt.Errorf("error loading CSV from bundle directory, %v", err) | ||
} | ||
|
||
pkgDir, err := registry.NewPackageGraphLoaderFromDir(path.Join(bundleDir, "..")) |
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.
I'm not sure this is what we want to do here.
This reads in the directory of files and generates a graph, and tells you if there are problems.
But the generate command is used for a single bundle. That single bundle may be applied to any target index, and has nothing to do with the bundles that happen to be in in the filesystem next to it.
I think this would be fine without the graph loader in this PR at all. Thoughts?
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.
But I thought the whole purpose of this though is to automagically decide what channels a given bundle is. How can we do that without attempting to build the graph for a given package?
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.
Same ask!
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.
Thanks for the explanation - commented before ☕️ !
I think there's a slight impedance mismatch here - this option is now only really useful if you're attempting convert an entire directory of the old format, right?
Should this really be part of the normal command for generating/buliding single bundles when it's so tied to the set?
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.
I think the trigger for it should be "if you didn't pass in these parameters explicitly, let's go see if we can find them for you" rather than it being an explicit opt in/opt out feature. IMO that's a better experience
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.
I second that this should be an experience enhancement type of feature based on the fact that you have the full-blown format with bundles nested in a package along with other bundles. Without it, it does not have any information we would be looking for. The default channel
and channels
are only obtainable in the *.package.yaml
file. To figure out which channels a bundle belongs to require relationships of this bundle with respect to every channel heads and see if it is directly/transitively replaced by those channel heads to be included as part of that channel. Without the package and rest of the bundles, all we can be certain from a single bundle is the package name
.
After all, this feature is just auto-filling package name
, channels
, and default channels
for a bundle.
ed35d3d
to
87200f4
Compare
This commit adds a feature to interpret bundle name and channels based on a given bundle directory and update bundle's annotation YAML. This feature is triggered when opm alpha generate/build is not supplying packageName, channels, and defaultChannels information. This Bundle directory needs to be inside a Package directory that contains all bundles. The previous reverted commit 13373cb accidentally changed opm command. This commit removes the duplicated package flag. This commit corrects bundle dir from pakcgae directory. This commit adds an error message for getting empty channels for a bundle. This commit skipes error for trying to parse anyfile as Json or Yaml format. The output directory of the annotation file is not the bundle directory rather its parent directory. This fix resolves it.
87200f4
to
99fc008
Compare
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.
@kevinrizza @ecordell log info added for inference.
INFO[0000] Bundle channels and package name information not provided, inferring from parent package directory
INFO[0000] Inferred channels: beta
INFO[0000] Inferred package name: banzaicloud-kafka-operator
INFO[0000] Inferred default channel: beta
INFO[0000] Building annotations.yaml
INFO[0000] Building Dockerfile
if packageName == "" { | ||
notProvided = append(notProvided, "package name") | ||
} | ||
log.Infof("Bundle %s information not provided, inferring from parent package directory", |
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.
log/notification added at the info level to suggestion inference took place.
if channels == "" { | ||
return fmt.Errorf("error interpreting channels, please manually input channels instead") | ||
} | ||
log.Infof("Inferred channels: %s", channels) |
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.
The inference results are also posted.
/lgtm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Bowenislandsong, ecordell, kevinrizza The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
/hold cancel |
/retest |
This commit adds a feature to interpret bundle name and channels
based on a given bundle directory and update bundle's annotation
YAML. This feature is triggered when opm alpha generate/build is
not supplying packageName, channels, and defaultChannels information.
This Bundle directory needs to be inside a Package directory
that contains all bundles.
The previous reverted commit 13373cb
accidentally changed opm command.
This commit removes the duplicated package flag.
This commit corrects bundle dir from pakcgae directory.
This commit adds an error message for getting empty channels for a bundle.
This commit skipes error for trying to parse anyfile as Json or Yaml format.
Description of the change:
Motivation for the change:
Reviewer Checklist
/docs