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

(cherry picked from commit 5488dcf)
  • Loading branch information
kuisathaverat authored and mergify-bot committed Jun 30, 2021
1 parent 2a94825 commit 9eedcbd
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 @@ -566,6 +566,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 9eedcbd

Please sign in to comment.