diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index ff3484eda93..2d91454340c 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -74,6 +74,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - Fix recovering from invalid output configuration when running under Elastic-Agent {pull}36016[36016] - Improve StreamBuf append to improve performance when reading long lines from files. {pull}35928[35928] - Eliminate cloning of event in deepUpdate {pull}35945[35945] +- Support build of projects outside of beats directory {pull}36126[36126] *Auditbeat* diff --git a/dev-tools/mage/build.go b/dev-tools/mage/build.go index 0673c486328..263299671fd 100644 --- a/dev-tools/mage/build.go +++ b/dev-tools/mage/build.go @@ -139,6 +139,18 @@ func GolangCrossBuild(params BuildArgs) error { return err } + // Support projects outside of the beats directory. + repoInfo, err := GetProjectRepoInfo() + if err != nil { + return err + } + + // TODO: Support custom build dir/subdir + projectMountPoint := filepath.ToSlash(filepath.Join("/go", "src", repoInfo.CanonicalRootImportPath)) + if err := sh.Run("git", "config", "--global", "--add", "safe.directory", projectMountPoint); err != nil { + return err + } + return Build(params) }