mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Ensure reproducible builds when build through docker
Ind9cfd77149
andd70d04f92b
we added support for reproducible builds for individual binaries (like kube-apiserver), however we need to thread this support when we build binaries with docker as well (say during "make quick-release"). Essentially, if GOLDFLAGS is set explicitly by someone either to a valid value they would like to use or empty ("") then we pick that up. If it is not set we should avoid setting GOLDFLAGS to empty. This ensures that we support the same functionality documented here: https://github.com/kubernetes/kubernetes/blob/master/build/root/Makefile#L82-L85 Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
parent
564ffbd400
commit
4b3475bc65
@ -574,11 +574,17 @@ function kube::build::run_build_command_ex() {
|
||||
--env "KUBE_BUILD_WITH_COVERAGE=${KUBE_BUILD_WITH_COVERAGE:-}"
|
||||
--env "KUBE_BUILD_PLATFORMS=${KUBE_BUILD_PLATFORMS:-}"
|
||||
--env "GOFLAGS=${GOFLAGS:-}"
|
||||
--env "GOLDFLAGS=${GOLDFLAGS:-}"
|
||||
--env "GOGCFLAGS=${GOGCFLAGS:-}"
|
||||
--env "SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-}"
|
||||
)
|
||||
|
||||
# use GOLDFLAGS only if it is set explicitly.
|
||||
if [[ -v GOLDFLAGS ]]; then
|
||||
docker_run_opts+=(
|
||||
--env "GOLDFLAGS=${GOLDFLAGS:-}"
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ -n "${DOCKER_CGROUP_PARENT:-}" ]]; then
|
||||
kube::log::status "Using ${DOCKER_CGROUP_PARENT} as container cgroup parent"
|
||||
docker_run_opts+=(--cgroup-parent "${DOCKER_CGROUP_PARENT}")
|
||||
|
Loading…
Reference in New Issue
Block a user