Merge pull request #87658 from dims/enable-selinux-tags-in-make-targets

Enable selinux tags in make targets
This commit is contained in:
Kubernetes Prow Robot 2020-02-01 03:35:35 -08:00 committed by GitHub
commit b7a1d61462
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -700,6 +700,7 @@ kube::golang::build_binaries_for_platform() {
-gcflags "${gogcflags:-}"
-asmflags "${goasmflags:-}"
-ldflags "${goldflags:-}"
-tags "${gotags:-}"
)
CGO_ENABLED=0 kube::golang::build_some_binaries "${statics[@]}"
fi
@ -710,6 +711,7 @@ kube::golang::build_binaries_for_platform() {
-gcflags "${gogcflags:-}"
-asmflags "${goasmflags:-}"
-ldflags "${goldflags:-}"
-tags "${gotags:-}"
)
kube::golang::build_some_binaries "${nonstatics[@]}"
fi
@ -725,6 +727,7 @@ kube::golang::build_binaries_for_platform() {
-gcflags "${gogcflags:-}" \
-asmflags "${goasmflags:-}" \
-ldflags "${goldflags:-}" \
-tags "${gotags:-}" \
-o "${outfile}" \
"${testpkg}"
done
@ -776,7 +779,7 @@ kube::golang::build_binaries() {
local 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".
# Disable SC2153 for this, as it will throw a warning that the local
# variable goldflags will exist, and it suggest changing it to this.
@ -785,6 +788,10 @@ kube::golang::build_binaries() {
goasmflags="-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 arg

View File

@ -105,6 +105,9 @@ func newAnalyzer(platform string) *analyzer {
ctx.BuildTags = append(ctx.BuildTags, tagsSplit...)
}
// add selinux tag explicitly
ctx.BuildTags = append(ctx.BuildTags, "selinux")
a := &analyzer{
platform: platform,
fset: token.NewFileSet(),