dev build support for darwin-arm64 from envoy tip (#2815)

This commit is contained in:
Denis Mishin 2021-12-13 11:37:24 -05:00 committed by GitHub
parent 5a858f5d48
commit 993da5704b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 11 deletions

4
.gitignore vendored
View file

@ -89,4 +89,6 @@ docs/.vuepress/dist/
.service-accounts
/bazel-*
internal/envoy/files/
internal/envoy/files/envoy-*-?????
internal/envoy/files/envoy-*-?????.sha256
internal/envoy/files/envoy-*-?????.version

View file

@ -5,7 +5,6 @@ package envoy
import (
"context"
"runtime"
"syscall"
"github.com/pomerium/pomerium/internal/log"
@ -26,10 +25,5 @@ func (srv *Server) prepareRunEnvoyCommand(ctx context.Context, sharedArgs []stri
args = make([]string, len(sharedArgs))
copy(args, sharedArgs)
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
// until m1 macs are supported by envoy, fallback to x86 and use rosetta
return "arch", append([]string{"-x86_64", srv.envoyPath}, args...)
}
return srv.envoyPath, args
}

View file

@ -1,5 +1,5 @@
//go:build darwin
// +build darwin
//go:build darwin && amd64
// +build darwin,amd64
package files

View file

@ -0,0 +1,15 @@
//go:build darwin && arm64
// +build darwin,arm64
package files
import _ "embed" // embed
//go:embed envoy-darwin-arm64
var rawBinary []byte
//go:embed envoy-darwin-arm64.sha256
var rawChecksum string
//go:embed envoy-darwin-arm64.version
var rawVersion string

View file

@ -9,9 +9,12 @@ _envoy_version=1.19.1
_dir="$_project_root/internal/envoy/files"
_target="${TARGET:-"$(go env GOOS)-$(go env GOARCH)"}"
# until m1 macs are supported, fallback to x86 and use rosetta
if [ "$_target" == "darwin-arm64" ]; then
_target="darwin-amd64"
echo "Using local envoy distribution for Apple M1"
cp `which envoy` "$_dir/envoy-$_target"
(cd internal/envoy/files && sha256sum "$_dir/envoy-$_target" > "$_dir/envoy-$_target.sha256")
echo "1.21.0-dev" >"$_dir/envoy-$_target.version"
exit 0
fi
_url="https://github.com/pomerium/envoy-binaries/releases/download/v${_envoy_version}/envoy-${_target}"