-
Notifications
You must be signed in to change notification settings - Fork 594
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
External sources configuration #1158
Conversation
Signed-off-by: Marco Deicas <mdeicas@google.com>
b94c603
to
6de5946
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.
LGTM!
Brilliant! I'll get this one merged in first. Thanks a million! |
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 neglected get this in on time! @spiffcs can you tackle follow ups to this?
import "github.com/spf13/viper" | ||
|
||
type ExternalSources struct { | ||
ExternalSourcesEnabled bool `yaml:"external-sources-enabled" json:"external-sources-enabled" mapstructure:"external-sources-enabled"` |
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.
ExternalSourcesEnabled bool `yaml:"external-sources-enabled" json:"external-sources-enabled" mapstructure:"external-sources-enabled"` | |
Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"` |
} | ||
|
||
func (e ExternalSources) loadDefaultValues(v *viper.Viper) { | ||
v.SetDefault("external-sources-enabled", false) |
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.
v.SetDefault("external-sources-enabled", false) | |
v.SetDefault("external-sources.enabled", false) |
@@ -41,6 +41,8 @@ type Cataloger interface { | |||
Name() string | |||
// Catalog is given an object to resolve file references and content, this function returns any discovered Packages after analyzing the catalog source. | |||
Catalog(resolver source.FileResolver) ([]pkg.Package, []artifact.Relationship, error) | |||
// UsesExternalSources returns if the cataloger uses external sources, such as querying a database | |||
UsesExternalSources() bool |
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 don't think we want to make this part of the cataloger interface, instead we should be passing in indication of this configuration to cataloger constructors, and constructors that return nil
instances and nil
error are discarded from the list of package catalogers.
* main: Update syft bootstrap tools to latest versions. (anchore#1171) Fix update-bootstrap-tools workflow (anchore#1170) workflow to create automated PRs to update bootstrap tools (anchore#1167) feat: add support for licenses in package-lock json v2 (anchore#1164) External sources configuration (anchore#1158) feat: add support for pnpm (anchore#1166) Prevent symlinks causing duplicate package-file relationships (anchore#1168) Associate node package licenses from node_modules (anchore#1152) Give the contributing guide a substantial rework (anchore#1155) Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
* main: Update syft bootstrap tools to latest versions. (#1176) enhance development support on macOS ARM (#1163) Capture if a node module is private (#1161) Find version numbers from jars with different naming conventions (#1174) Update syft bootstrap tools to latest versions. (#1171) Fix update-bootstrap-tools workflow (#1170) workflow to create automated PRs to update bootstrap tools (#1167) feat: add support for licenses in package-lock json v2 (#1164) External sources configuration (#1158) feat: add support for pnpm (#1166) Prevent symlinks causing duplicate package-file relationships (#1168) Associate node package licenses from node_modules (#1152)
This reverts commit 1329688. Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
reverted as functionality is to be merged with dev branch of kubecon draft
reverted as functionality is to be merged with dev branch of kubecon draft
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
reverted as functionality is to be merged with dev branch of kubecon draft
The use of external sources is new to Syft, and they must be managed thoughtfully (i.e. configurability, clear to users what has been used and how). This PR proposes a way to do so. It is motivated by #1159 and #1115.
It adds a new external sources configuration, an additional function that catalogers must implement, and a cli flag to shut off the use of external sources. This approach assumes that external sources will only come into Syft through catalogers.
When catalogers are implemented that use external sources, they must add their own configuration options to the application-wide external sources configuration created here.