Merge pull request #13552 from dbussink/small-build-improvement

release: build with consistent paths
This commit is contained in:
Marek Siarkowicz 2022-11-21 15:45:44 +01:00 committed by GitHub
commit 16862fa0bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -87,7 +87,7 @@ function main {
export GOARCH=${TARGET_ARCH}
pushd etcd >/dev/null
GO_LDFLAGS="-s" ./scripts/build.sh
GO_LDFLAGS="-s -w" ./scripts/build.sh
popd >/dev/null
TARGET="etcd-${VER}-${GOOS}-${GOARCH}"

View File

@ -60,6 +60,7 @@ etcd_build() {
# Static compilation is useful when etcd is run in a container. $GO_BUILD_FLAGS is OK
# shellcheck disable=SC2086
run env "${GO_BUILD_ENV[@]}" go build $GO_BUILD_FLAGS \
-trimpath \
-installsuffix=cgo \
"-ldflags=${GO_LDFLAGS[*]}" \
-o="../${out}/etcd" . || return 2
@ -70,6 +71,7 @@ etcd_build() {
(
cd ./etcdutl
run env GO_BUILD_FLAGS="${GO_BUILD_FLAGS}" "${GO_BUILD_ENV[@]}" go build $GO_BUILD_FLAGS \
-trimpath \
-installsuffix=cgo \
"-ldflags=${GO_LDFLAGS[*]}" \
-o="../${out}/etcdutl" . || return 2
@ -80,6 +82,7 @@ etcd_build() {
(
cd ./etcdctl
run env GO_BUILD_FLAGS="${GO_BUILD_FLAGS}" "${GO_BUILD_ENV[@]}" go build $GO_BUILD_FLAGS \
-trimpath \
-installsuffix=cgo \
"-ldflags=${GO_LDFLAGS[*]}" \
-o="../${out}/etcdctl" . || return 2
@ -110,6 +113,7 @@ tools_build() {
run rm -f "${out}/${tool}"
# shellcheck disable=SC2086
run env GO_BUILD_FLAGS="${GO_BUILD_FLAGS}" CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} \
-trimpath \
-installsuffix=cgo \
"-ldflags=${GO_LDFLAGS[*]}" \
-o="${out}/${tool}" "./${tool}" || return 2

View File

@ -9,8 +9,8 @@ outdir="${BINDIR:-../bin}"
(
cd ./tests
CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o "${outdir}/etcd-agent" ./functional/cmd/etcd-agent
CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o "${outdir}/etcd-proxy" ./functional/cmd/etcd-proxy
CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o "${outdir}/etcd-runner" ./functional/cmd/etcd-runner
CGO_ENABLED=0 go test -v -installsuffix cgo -ldflags "-s" -c -o "${outdir}/etcd-tester" ./functional/cmd/etcd-tester
CGO_ENABLED=0 go build -trimpath -v -installsuffix cgo -ldflags "-s -w" -o "${outdir}/etcd-agent" ./functional/cmd/etcd-agent
CGO_ENABLED=0 go build -trimpath -v -installsuffix cgo -ldflags "-s -w" -o "${outdir}/etcd-proxy" ./functional/cmd/etcd-proxy
CGO_ENABLED=0 go build -trimpath -v -installsuffix cgo -ldflags "-s -w" -o "${outdir}/etcd-runner" ./functional/cmd/etcd-runner
CGO_ENABLED=0 go test -v -installsuffix cgo -ldflags "-s -w" -c -o "${outdir}/etcd-tester" ./functional/cmd/etcd-tester
)