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

Fix Google Cloud Function configuration file issues #22156

Merged
merged 2 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Do not need Google credentials if not required for the operation. {issue}17329[17329] {pull}21072[21072]
- Fix dependency issues of GCP functions. {issue}20830[20830] {pull}21070[21070]
- Fix catchall bucket config errors by adding more validation. {issue}17572[16282] {pull}20887[16287]
- Fix Google Cloud Function configuration issue. {issue}20864[20864] {pull}22156[22156]

==== Added

Expand Down
4 changes: 4 additions & 0 deletions libbeat/cfgfile/cfgfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ func LoadList(file string) ([]*common.Config, error) {
return c, nil
}

func SetConfigPath(path string) {
*configPath = path
}

// GetPathConfig returns ${path.config}. If ${path.config} is not set, ${path.home} is returned.
func GetPathConfig() string {
if *configPath != "" {
Expand Down
1 change: 1 addition & 0 deletions x-pack/functionbeat/provider/gcp/pubsub/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func RunPubSub(ctx context.Context, m gpubsub.Message) error {
ConfigOverrides: config.FunctionOverrides,
}

cfgfile.SetConfigPath("/srv/src/pubsub")
cfgfile.ChangeDefaultCfgfileFlag(settings.Name)

return instance.Run(settings, initFunctionbeat(ctx, m))
Expand Down
1 change: 1 addition & 0 deletions x-pack/functionbeat/provider/gcp/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func RunCloudStorage(ctx context.Context, e gcp.StorageEvent) error {
ConfigOverrides: config.FunctionOverrides,
}

cfgfile.SetConfigPath("/srv/src/storage")
cfgfile.ChangeDefaultCfgfileFlag(settings.Name)

return instance.Run(settings, initFunctionbeat(ctx, e))
Expand Down
3 changes: 3 additions & 0 deletions x-pack/functionbeat/scripts/mage/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ func (Update) VendorBeats() error {
Exclude: []string{
".*_test.go$",
".*.yml",
// XXX GCP function metadata lib must be removed to avoid build failures
// GH issue: https://github.com/googleapis/google-cloud-go/issues/1947
".*cloud.google.com/go.*/functions/metadata.*",
},
}
err = cp.Execute()
Expand Down