Skip to content

Commit

Permalink
chore: convert examples folder in a different workspace/bzlmod (#89)
Browse files Browse the repository at this point in the history
* feat: create workspace in examples folder

* fix: allow empty as glob option for helm tests

* fix: do not use dev_dependency for oci rules in examples workspace

* chore: add examples module to bazelignore
  • Loading branch information
danigar authored Jan 13, 2025
1 parent fa8b859 commit fff69dd
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 17 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
examples
1 change: 1 addition & 0 deletions examples/.bazelrc
1 change: 1 addition & 0 deletions examples/.bazelversion
Empty file added examples/BUILD.bazel
Empty file.
15 changes: 15 additions & 0 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bazel_dep(name = "masorange_rules_helm", version = "0.0.0")
local_path_override(
module_name = "masorange_rules_helm",
path = "..",
)

bazel_dep(name = "rules_oci", version = "1.6.0")

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull(
name = "distroless_java_image",
digest = "sha256:161a1d97d592b3f1919801578c3a47c8e932071168a96267698f4b669c24c76d",
image = "gcr.io/distroless/java17",
)
use_repo(oci, "distroless_java_image")
12 changes: 12 additions & 0 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local_repository(
name = "masorange_rules_helm",
path = "..",
)

load("@masorange_rules_helm//:repositories.bzl", "masorange_rules_helm_repositories")

masorange_rules_helm_repositories()

load("@masorange_rules_helm//:config.bzl", "masorange_rules_helm_configure")

masorange_rules_helm_configure()
Empty file added examples/WORKSPACE.bzlmod
Empty file.
2 changes: 1 addition & 1 deletion examples/chart_override/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//helm:defs.bzl", "helm_chart")
load("@masorange_rules_helm//helm:defs.bzl", "helm_chart")

helm_chart(
name = "package",
Expand Down
2 changes: 1 addition & 1 deletion examples/chart_with_deps/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//helm:defs.bzl", "helm_chart")
load("@masorange_rules_helm//helm:defs.bzl", "helm_chart")

helm_chart(
name = "package",
Expand Down
18 changes: 9 additions & 9 deletions examples/chart_with_image/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
load("//helm:defs.bzl", "helm_chart")
load("@masorange_rules_helm//helm:defs.bzl", "helm_chart")
load("@rules_oci//oci:defs.bzl", "oci_image")

oci_image(
name = "image",
base = "@distroless_java",
base = "@distroless_java_image",
entrypoint = [
"java",
],
Expand All @@ -12,12 +12,12 @@ oci_image(

helm_chart(
name = "package",
image = ":image",
chart_name = "chart",
force_repository_append = False,
values_tag_yaml_path = "k8s.deployment.image.digest",
values = {
"k8s.deployment.appVersion": "v1.0.0",
},
image = ":image",
chart_name = "chart",
force_repository_append = False,
values_tag_yaml_path = "k8s.deployment.image.digest",
values = {
"k8s.deployment.appVersion": "v1.0.0",
},
srcs = glob(["test_chart/**/*.yaml"]),
)
2 changes: 1 addition & 1 deletion examples/empty_chart/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//helm:defs.bzl", "helm_chart")
load("@masorange_rules_helm//helm:defs.bzl", "helm_chart")

helm_chart(
name = "package",
Expand Down
4 changes: 2 additions & 2 deletions examples/release_local_chart/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//helm:defs.bzl", "helm_chart", "helm_release")
load("@masorange_rules_helm//helm:defs.bzl", "helm_chart", "helm_release")

helm_chart(
name = "package",
Expand All @@ -12,5 +12,5 @@ helm_release(
namespace = "myapp",
release_name = "release-name",
wait = True,
values = glob(["charts/myapp/values.yaml"]),
values = ["test_chart/values.yaml"],
)
2 changes: 1 addition & 1 deletion examples/release_remote_chart/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//helm:defs.bzl", "helm_release")
load("@masorange_rules_helm//helm:defs.bzl", "helm_release")

helm_release(
name = "install",
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_chart/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//helm:defs.bzl", "helm_chart", "helm_push", "helm_lint_test")
load("@masorange_rules_helm//helm:defs.bzl", "helm_chart", "helm_push", "helm_lint_test")

helm_chart(
name = "package",
Expand Down
2 changes: 1 addition & 1 deletion helm/tests/helm_chart/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ load("@bazel_skylib//lib:paths.bzl", "paths")
helm_chart(
name = "chart_%s" % chart_data.name,
chart_name = chart_data.name,
srcs = getattr(chart_data, "srcs", "") or glob(["charts/%s/**" % chart_data.name]),
srcs = getattr(chart_data, "srcs", "") or glob(["charts/%s/**" % chart_data.name], allow_empty = True),
deps = getattr(chart_data, "deps", []),
version = getattr(chart_data, "version", ""),
path_to_chart = getattr(chart_data, "path_to_chart", ""),
Expand Down

0 comments on commit fff69dd

Please sign in to comment.