Skip to content

[Bug]: py_layer_tier ignores root #1476

Description

@tsudol-plaid

What happened?

...or I don't understand what it's supposed to do.

Given a py_layer_tier like:

py_layer_tier(
  name = "my_tier",
  root = "/my_favorite_dir",
)

I expect it to put the files in /my_favorite_dir/my_app.runfiles, or perhaps /my_favorite_dir.runfiles. I'm not sure.

Instead, it puts the files in /app.runfiles.

I'm seeing this on a full image build. To save time, I've done the reproduction with py_image_layer + checking the output tars.

Version

Development (host) and target OS/architectures:
Tested on:
Linux x86-64 host and target
MacOS arm host and target

Output of bazel --version: bazel 9.2.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: 2.0.0-alpha.6

Language(s) and/or frameworks involved: Python

How to reproduce

First, set up a repository containing:
MODULE.bazel:

module(
  name = "no-root",
  version = "0.1.0",
)

bazel_dep(name = "aspect_rules_py", version = "2.0.0-alpha.6")


BUILD.bazel:

load("@aspect_rules_py//py:defs.bzl", "py_binary", "py_image_layer", "py_layer_tier")

py_binary(
  name = "main",
  srcs = ["main.py"],
  deps = [],
)

py_layer_tier(
  name = "my_tier",
  root = "/my_favorite_dir",
)

py_image_layer(
  name = "image",
  binary = ":main",
  layer_tier = "//:my_tier",
)


main.py:

print("Hello, world!")


Build the image layers:

bazel build //:image  


Check the contents of the output tar:

tar -ztf bazel-bin/image_default.tar.gz | head


Expectation:
Something like `/my_favorite_dir/my_app.runfiles/_main/._main.venv/bin/python`

Actual result:
A list of files like:
`./app.runfiles/_main/._main.venv/bin/python`

Any other information?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions