Skip to content

Commit

Permalink
Make mknotifyd package more self contained
Browse files Browse the repository at this point in the history
Some static files were still in the generic enterprise skel directory,
which can now be handled by bazel in the package itself.

Introduce a bazel way to deal with the monolithic skel.permissions file.
This file is needed by OMD to later set file permissions when creating
the sites etc directory and files based on the skel hierarchy. This
piece will be needed once we move more packages towards bazel.

Change-Id: Iba31ceae1e27fccc58b88df35e4c020c27185a60
  • Loading branch information
LarsMichelsen committed Dec 11, 2024
1 parent dc176b6 commit 33aaaf1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
15 changes: 15 additions & 0 deletions bazel_variables.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@ edition_deps = {
"//non-free/packages/cmk-otel-collector:pkg_tar",
],
}

edition_skel_permissions = {
"cce": [
"//non-free/packages/cmk-mknotifyd:skel.permissions",
],
"cee": [
"//non-free/packages/cmk-mknotifyd:skel.permissions",
],
"cme": [
"//non-free/packages/cmk-mknotifyd:skel.permissions",
],
"cse": [
"//non-free/packages/cmk-mknotifyd:skel.permissions",
],
}
22 changes: 21 additions & 1 deletion omd/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("//:bazel_variables.bzl", "edition_deps")
load("//:bazel_variables.bzl", "edition_deps", "edition_skel_permissions")

pkg_tar(
name = "intermediate_install",
Expand Down Expand Up @@ -52,3 +53,22 @@ pkg_tar(
"cme",
"cse",
]]

[genrule(
name = "skel_permissions_" + edition,
srcs = edition_skel_permissions[edition],
outs = ["skel.permissions_" + edition],
cmd = "cat $< > $@",
) for edition in [
"cce",
"cee",
"cme",
"cse",
]]

# Placeholder since we have no cre specfic skel.permissions so far (will come soon)
write_file(
name = "skel_permissions_cre",
out = "skel.permissions_cre",
content = [],
)
2 changes: 2 additions & 0 deletions omd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ $(SKEL_PERMISSIONS): $(INSTALL)
OUTPUT="$${OUTPUT}# $$p\n$$(cat $$p/skel.permissions)\n"; \
fi ; \
done ; \
bazel build //omd:skel_permissions_$(EDITION_SHORT) ; \
OUTPUT="$${OUTPUT}# Bazel\n$$(cat $(REPO_PATH)/bazel-bin/omd/skel.permissions_cee)\n" ; \
echo -e "$$OUTPUT" > $(SKEL_PERMISSIONS)

$(INSTALL_GLOBAL): $(SKEL_PERMISSIONS) $(BOM)
Expand Down

0 comments on commit 33aaaf1

Please sign in to comment.