Skip to content

Commit

Permalink
fix: Force PLATFORMS environment variable when we build Elastic Agent…
Browse files Browse the repository at this point in the history
… dependencies on arm64 (#26415)

* fix: build elastic agent dependencies on the architecture you are running

* fix: format

* fix: build ARM on ARM

* fix: format

* chore: backup the platforms env var
  • Loading branch information
kuisathaverat committed Jun 30, 2021
1 parent 1541b2e commit 5488dcf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions x-pack/elastic-agent/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,16 @@ func packageAgent(requiredPackages []string, packagingFn func()) {
}

os.Setenv(agentDropPath, dropPath)
if runtime.GOARCH == "arm64" {
const platformsVar = "PLATFORMS"
oldPlatforms := os.Getenv(platformsVar)
os.Setenv(platformsVar, runtime.GOOS+"/"+runtime.GOARCH)
if oldPlatforms != "" {
defer os.Setenv(platformsVar, oldPlatforms)
} else {
defer os.Unsetenv(oldPlatforms)
}
}

// cleanup after build
defer os.RemoveAll(dropPath)
Expand Down

0 comments on commit 5488dcf

Please sign in to comment.