mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Merge pull request #87658 from dims/enable-selinux-tags-in-make-targets
Enable selinux tags in make targets
This commit is contained in:
commit
b7a1d61462
@ -700,6 +700,7 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
-gcflags "${gogcflags:-}"
|
-gcflags "${gogcflags:-}"
|
||||||
-asmflags "${goasmflags:-}"
|
-asmflags "${goasmflags:-}"
|
||||||
-ldflags "${goldflags:-}"
|
-ldflags "${goldflags:-}"
|
||||||
|
-tags "${gotags:-}"
|
||||||
)
|
)
|
||||||
CGO_ENABLED=0 kube::golang::build_some_binaries "${statics[@]}"
|
CGO_ENABLED=0 kube::golang::build_some_binaries "${statics[@]}"
|
||||||
fi
|
fi
|
||||||
@ -710,6 +711,7 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
-gcflags "${gogcflags:-}"
|
-gcflags "${gogcflags:-}"
|
||||||
-asmflags "${goasmflags:-}"
|
-asmflags "${goasmflags:-}"
|
||||||
-ldflags "${goldflags:-}"
|
-ldflags "${goldflags:-}"
|
||||||
|
-tags "${gotags:-}"
|
||||||
)
|
)
|
||||||
kube::golang::build_some_binaries "${nonstatics[@]}"
|
kube::golang::build_some_binaries "${nonstatics[@]}"
|
||||||
fi
|
fi
|
||||||
@ -725,6 +727,7 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
-gcflags "${gogcflags:-}" \
|
-gcflags "${gogcflags:-}" \
|
||||||
-asmflags "${goasmflags:-}" \
|
-asmflags "${goasmflags:-}" \
|
||||||
-ldflags "${goldflags:-}" \
|
-ldflags "${goldflags:-}" \
|
||||||
|
-tags "${gotags:-}" \
|
||||||
-o "${outfile}" \
|
-o "${outfile}" \
|
||||||
"${testpkg}"
|
"${testpkg}"
|
||||||
done
|
done
|
||||||
@ -776,7 +779,7 @@ kube::golang::build_binaries() {
|
|||||||
local host_platform
|
local host_platform
|
||||||
host_platform=$(kube::golang::host_platform)
|
host_platform=$(kube::golang::host_platform)
|
||||||
|
|
||||||
local goflags goldflags goasmflags gogcflags
|
local goflags goldflags goasmflags gogcflags gotags
|
||||||
# If GOLDFLAGS is unset, then set it to the a default of "-s -w".
|
# If GOLDFLAGS is unset, then set it to the a default of "-s -w".
|
||||||
# Disable SC2153 for this, as it will throw a warning that the local
|
# Disable SC2153 for this, as it will throw a warning that the local
|
||||||
# variable goldflags will exist, and it suggest changing it to this.
|
# variable goldflags will exist, and it suggest changing it to this.
|
||||||
@ -785,6 +788,10 @@ kube::golang::build_binaries() {
|
|||||||
goasmflags="-trimpath=${KUBE_ROOT}"
|
goasmflags="-trimpath=${KUBE_ROOT}"
|
||||||
gogcflags="${GOGCFLAGS:-} -trimpath=${KUBE_ROOT}"
|
gogcflags="${GOGCFLAGS:-} -trimpath=${KUBE_ROOT}"
|
||||||
|
|
||||||
|
# extract tags if any specified in GOFLAGS
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
gotags="selinux,$(echo "${GOFLAGS:-}" | sed -e 's|.*-tags=\([^-]*\).*|\1|')"
|
||||||
|
|
||||||
local -a targets=()
|
local -a targets=()
|
||||||
local arg
|
local arg
|
||||||
|
|
||||||
|
@ -105,6 +105,9 @@ func newAnalyzer(platform string) *analyzer {
|
|||||||
ctx.BuildTags = append(ctx.BuildTags, tagsSplit...)
|
ctx.BuildTags = append(ctx.BuildTags, tagsSplit...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add selinux tag explicitly
|
||||||
|
ctx.BuildTags = append(ctx.BuildTags, "selinux")
|
||||||
|
|
||||||
a := &analyzer{
|
a := &analyzer{
|
||||||
platform: platform,
|
platform: platform,
|
||||||
fset: token.NewFileSet(),
|
fset: token.NewFileSet(),
|
||||||
|
Loading…
Reference in New Issue
Block a user