Fix broken SELinux detection

The upgrade of dependencies in #78187 introduced a regression in
detecting if SELinux is enabled or not. As the library requires
the golang build tag `selinux` to be enabled after that version update.

Fixes bug report #83679
This commit is contained in:
Christian Simon 2019-12-07 16:37:45 +00:00
parent 50437b4c5d
commit 24d105995d
4 changed files with 32 additions and 2 deletions

View File

@ -16,6 +16,9 @@ build --workspace_status_command hack/print-workspace-status.sh
# Make /tmp hermetic
build --sandbox_tmpfs_path=/tmp
# This tag is required to build github.com/opencontainers/selinux correctly
build --define gotags=selinux
# Ensure that Bazel never runs as root, which can cause unit tests to fail.
# This flag requires Bazel 0.5.0+
build --sandbox_fake_username

View File

@ -5,6 +5,9 @@
# gazelle:exclude _output
# gazelle:exclude _tmp
# This tag is required to build github.com/opencontainers/selinux correctly
# gazelle:build_tags selinux
# gazelle:prefix k8s.io/kubernetes
# Disable proto rules, since the Go sources are currently generated by

View File

@ -2,10 +2,22 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["selinux_stub.go"],
srcs = [
"selinux_linux.go",
"xattrs.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/opencontainers/selinux/go-selinux",
importpath = "github.com/opencontainers/selinux/go-selinux",
visibility = ["//visibility:public"],
deps = select({
"@io_bazel_rules_go//go/platform:android": [
"//vendor/golang.org/x/sys/unix:go_default_library",
],
"@io_bazel_rules_go//go/platform:linux": [
"//vendor/golang.org/x/sys/unix:go_default_library",
],
"//conditions:default": [],
}),
)
filegroup(

View File

@ -2,10 +2,22 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["label.go"],
srcs = [
"label.go",
"label_selinux.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/opencontainers/selinux/go-selinux/label",
importpath = "github.com/opencontainers/selinux/go-selinux/label",
visibility = ["//visibility:public"],
deps = select({
"@io_bazel_rules_go//go/platform:android": [
"//vendor/github.com/opencontainers/selinux/go-selinux:go_default_library",
],
"@io_bazel_rules_go//go/platform:linux": [
"//vendor/github.com/opencontainers/selinux/go-selinux:go_default_library",
],
"//conditions:default": [],
}),
)
filegroup(