From 6d38569c326bb3aa69f94fe186c1f1c70ab08550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Mon, 26 Oct 2020 16:56:29 +0100 Subject: [PATCH 1/2] Fix functionbeat --- libbeat/cfgfile/cfgfile.go | 4 ++++ x-pack/functionbeat/provider/gcp/pubsub/pubsub.go | 1 + x-pack/functionbeat/provider/gcp/storage/storage.go | 1 + x-pack/functionbeat/scripts/mage/update.go | 3 +++ 4 files changed, 9 insertions(+) diff --git a/libbeat/cfgfile/cfgfile.go b/libbeat/cfgfile/cfgfile.go index 767cbd34bc57..ff3949069314 100644 --- a/libbeat/cfgfile/cfgfile.go +++ b/libbeat/cfgfile/cfgfile.go @@ -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 != "" { diff --git a/x-pack/functionbeat/provider/gcp/pubsub/pubsub.go b/x-pack/functionbeat/provider/gcp/pubsub/pubsub.go index 44f77695e946..813a0df9cc06 100644 --- a/x-pack/functionbeat/provider/gcp/pubsub/pubsub.go +++ b/x-pack/functionbeat/provider/gcp/pubsub/pubsub.go @@ -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)) diff --git a/x-pack/functionbeat/provider/gcp/storage/storage.go b/x-pack/functionbeat/provider/gcp/storage/storage.go index c9d1660d67c1..2de829392d2b 100644 --- a/x-pack/functionbeat/provider/gcp/storage/storage.go +++ b/x-pack/functionbeat/provider/gcp/storage/storage.go @@ -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)) diff --git a/x-pack/functionbeat/scripts/mage/update.go b/x-pack/functionbeat/scripts/mage/update.go index 59b56cb6bed5..99f1b9a3ce34 100644 --- a/x-pack/functionbeat/scripts/mage/update.go +++ b/x-pack/functionbeat/scripts/mage/update.go @@ -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() From 6ea271368ac64c6805a838036c7b859694aaf958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Mon, 26 Oct 2020 17:03:15 +0100 Subject: [PATCH 2/2] add changelog entry --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index f27501759696..52f0a510a1d9 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -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