Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #144: Add rctx.watch and repo name fix in deb_resolve #145

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apt/apt.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def _apt_install(
"""
_deb_resolve(
name = name + "_resolve",
install_name = name,
manifest = manifest,
resolve_transitive = resolve_transitive,
)
Expand Down
1 change: 1 addition & 0 deletions apt/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def _distroless_extension(module_ctx):

deb_resolve(
name = install.name + "_resolve",
install_name = install.name,
manifest = install.manifest,
resolve_transitive = install.resolve_transitive,
)
Expand Down
7 changes: 6 additions & 1 deletion apt/private/deb_resolve.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ load(":version_constraint.bzl", "version_constraint")
def _parse_manifest(rctx, yq_toolchain_prefix, manifest):
is_windows = repo_utils.is_windows(rctx)
host_yq = Label("@{}_{}//:yq{}".format(yq_toolchain_prefix, repo_utils.platform(rctx), ".exe" if is_windows else ""))

if hasattr(rctx, "watch"):
rctx.watch(manifest)

yq_args = [
str(rctx.path(host_yq)),
str(rctx.path(manifest)),
Expand Down Expand Up @@ -120,7 +124,7 @@ def _deb_resolve_impl(rctx):
# NOTE: the split("~") is needed when we run bazel from another
# directory, e.g. when running e2e tests we change dir to e2e/smoke
# and then rctx.name is 'rules_distroless~~apt~bullseye'
repo_name = rctx.name.split("~")[-1].replace("_resolve", ""),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

repo_name = rctx.attr.install_name,
lock_label = lock_label,
workspace_relative_path = workspace_relative_path,
),
Expand All @@ -132,6 +136,7 @@ def _deb_resolve_impl(rctx):
deb_resolve = repository_rule(
implementation = _deb_resolve_impl,
attrs = {
"install_name": attr.string(),
"manifest": attr.label(),
"resolve_transitive": attr.bool(default = True),
"yq_toolchain_prefix": attr.string(default = "yq"),
Expand Down
Loading