Revert "feat: add boringcrypto builds for linux (#9528)" (#9529)

This reverts commit 79cd6047dc.
This commit is contained in:
Kyle Carberry
2023-09-05 08:37:07 -05:00
committed by GitHub
parent 79cd6047dc
commit da0ef92f77
7 changed files with 14 additions and 61 deletions

View File

@ -105,9 +105,6 @@ CODER_ARCH_IMAGE_PREREQUISITES := \
build/coder_$(VERSION)_%.tar.gz build/coder_$(VERSION)_%.tar.gz
endif endif
# used to decide if we can build with boringcrypto
local_os:=$(shell go env GOHOSTOS)
local_arch:=$(shell go env GOHOSTARCH)
clean: clean:
rm -rf build site/out rm -rf build site/out
@ -225,12 +222,6 @@ $(CODER_ALL_BINARIES): go.mod go.sum \
build_args+=(--slim) build_args+=(--slim)
fi fi
# boringcrypto is only supported on Linux
# boringcrypto uses CGO, which isn't supported when cross compiling architectures
if [[ "$$os" == "linux" ]] && [[ "${local_os}" == "linux" ]] && [[ "$$arch" == "${local_arch}" ]]; then
build_args+=(--boringcrypto)
fi
./scripts/build_go.sh "$${build_args[@]}" ./scripts/build_go.sh "$${build_args[@]}"
if [[ "$$mode" == "slim" ]]; then if [[ "$$mode" == "slim" ]]; then

View File

@ -1,7 +0,0 @@
//go:build boringcrypto
package buildinfo
import "crypto/boring"
var boringcrypto = boring.Enabled()

View File

@ -87,10 +87,6 @@ func IsAGPL() bool {
return strings.Contains(agpl, "t") return strings.Contains(agpl, "t")
} }
func IsBoringCrypto() bool {
return boringcrypto
}
// ExternalURL returns a URL referencing the current Coder version. // ExternalURL returns a URL referencing the current Coder version.
// For production builds, this will link directly to a release. // For production builds, this will link directly to a release.
// For development builds, this will link to a commit. // For development builds, this will link to a commit.

View File

@ -1,5 +0,0 @@
//go:build !boringcrypto
package buildinfo
var boringcrypto = false

View File

@ -18,7 +18,6 @@ type versionInfo struct {
ExternalURL string `json:"external_url"` ExternalURL string `json:"external_url"`
Slim bool `json:"slim"` Slim bool `json:"slim"`
AGPL bool `json:"agpl"` AGPL bool `json:"agpl"`
BoringCrypto bool `json:"boring_crypto"`
} }
// String() implements Stringer // String() implements Stringer
@ -29,9 +28,6 @@ func (vi versionInfo) String() string {
_, _ = str.WriteString("(AGPL) ") _, _ = str.WriteString("(AGPL) ")
} }
_, _ = str.WriteString(vi.Version) _, _ = str.WriteString(vi.Version)
if vi.BoringCrypto {
_, _ = str.WriteString(" BoringCrypto")
}
if !vi.BuildTime.IsZero() { if !vi.BuildTime.IsZero() {
_, _ = str.WriteString(" " + vi.BuildTime.Format(time.UnixDate)) _, _ = str.WriteString(" " + vi.BuildTime.Format(time.UnixDate))
@ -54,7 +50,6 @@ func defaultVersionInfo() *versionInfo {
ExternalURL: buildinfo.ExternalURL(), ExternalURL: buildinfo.ExternalURL(),
Slim: buildinfo.IsSlim(), Slim: buildinfo.IsSlim(),
AGPL: buildinfo.IsAGPL(), AGPL: buildinfo.IsAGPL(),
BoringCrypto: buildinfo.IsBoringCrypto(),
} }
} }

View File

@ -34,8 +34,7 @@ Full build of Coder, supports the  server  subcomm
"build_time": "0001-01-01T00:00:00Z", "build_time": "0001-01-01T00:00:00Z",
"external_url": "https://github.com/coder/coder", "external_url": "https://github.com/coder/coder",
"slim": false, "slim": false,
"agpl": false, "agpl": false
"boring_crypto": false
} }
` `
for _, tt := range []struct { for _, tt := range []struct {

View File

@ -2,7 +2,7 @@
# This script builds a single Go binary of Coder with the given parameters. # This script builds a single Go binary of Coder with the given parameters.
# #
# Usage: ./build_go.sh [--version 1.2.3-devel+abcdef] [--os linux] [--arch amd64] [--output path/to/output] [--slim] [--agpl] [--boringcrypto] # Usage: ./build_go.sh [--version 1.2.3-devel+abcdef] [--os linux] [--arch amd64] [--output path/to/output] [--slim] [--agpl]
# #
# Defaults to linux:amd64 with slim disabled, but can be controlled with GOOS, # Defaults to linux:amd64 with slim disabled, but can be controlled with GOOS,
# GOARCH and CODER_SLIM_BUILD=1. If no version is specified, defaults to the # GOARCH and CODER_SLIM_BUILD=1. If no version is specified, defaults to the
@ -22,9 +22,6 @@
# #
# If the --agpl parameter is specified, builds only the AGPL-licensed code (no # If the --agpl parameter is specified, builds only the AGPL-licensed code (no
# Coder enterprise features). # Coder enterprise features).
#
# If the --boringcrypto parameter is specified, builds use boringcrypto instead of
# the standard go crypto libraries.
set -euo pipefail set -euo pipefail
# shellcheck source=scripts/lib.sh # shellcheck source=scripts/lib.sh
@ -37,9 +34,8 @@ slim="${CODER_SLIM_BUILD:-0}"
sign_darwin="${CODER_SIGN_DARWIN:-0}" sign_darwin="${CODER_SIGN_DARWIN:-0}"
output_path="" output_path=""
agpl="${CODER_BUILD_AGPL:-0}" agpl="${CODER_BUILD_AGPL:-0}"
boringcrypto=${CODER_BUILD_BORINGCRYPTO:-0}
args="$(getopt -o "" -l version:,os:,arch:,output:,slim,agpl,sign-darwin,boringcrypto -- "$@")" args="$(getopt -o "" -l version:,os:,arch:,output:,slim,agpl,sign-darwin -- "$@")"
eval set -- "$args" eval set -- "$args"
while true; do while true; do
case "$1" in case "$1" in
@ -72,10 +68,6 @@ while true; do
sign_darwin=1 sign_darwin=1
shift shift
;; ;;
--boringcrypto)
boringcrypto=1
shift
;;
--) --)
shift shift
break break
@ -148,15 +140,7 @@ cmd_path="./enterprise/cmd/coder"
if [[ "$agpl" == 1 ]]; then if [[ "$agpl" == 1 ]]; then
cmd_path="./cmd/coder" cmd_path="./cmd/coder"
fi fi
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" GOARM="$arm_version" go build \
cgo=0
goexp=""
if [[ "$boringcrypto" == 1 ]]; then
cgo=1
goexp="boringcrypto"
fi
GOEXPERIMENT="$goexp" CGO_ENABLED="$cgo" GOOS="$os" GOARCH="$arch" GOARM="$arm_version" go build \
"${build_args[@]}" \ "${build_args[@]}" \
"$cmd_path" 1>&2 "$cmd_path" 1>&2