Skip to content

Commit

Permalink
fix: handle __main__ and no package gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn committed Feb 25, 2023
1 parent 0da3922 commit f1394d8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions oci/private/structure_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ exec "{st_path}" test {fixed_args} "$@"
def _structure_test_impl(ctx):
st_info = ctx.toolchains["@contrib_rules_oci//oci:st_toolchain_type"].st_info

default_image_tag = "{workspace}.local/{package}/{name}:latest".format(
workspace = ctx.workspace_name,
package = ctx.label.package.replace("/", "_"),
workspace = "default_workspace" if ctx.workspace_name == "__main__" else ctx.workspace_name
package = "{}/".format(ctx.label.package.replace("/", "_")) if ctx.label.package else ""

default_image_tag = "{workspace}.local/{optional_package}{name}:latest".format(
workspace = workspace,
optional_package = package,
name = ctx.label.name,
)

Expand Down

0 comments on commit f1394d8

Please sign in to comment.