diff --git a/.bazelrc b/.bazelrc index 61f1089a..c13b49ce 100644 --- a/.bazelrc +++ b/.bazelrc @@ -4,9 +4,6 @@ test --test_output=errors -# TODO(alex): enable -common --noenable_bzlmod - # Define value used by tests build --define=SOME_VAR=SOME_VALUE diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f0ca1fea..2bacfa4e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,6 @@ jobs: # NB: the root folder is tested with Aspect Workflows on BuildKite, see /.aspect/workflows/config.yaml folders: '["e2e/smoke", "e2e/repository-rule-deps", "e2e/system-interpreter", "examples/uv_pip_compile"]' # TODO: Build Windows tools and add to toolchain - # TODO(alex): switch the root folder to bzlmod # TODO: fix remaining folders on Bazel 8 exclude: | [ diff --git a/BUILD.bazel b/BUILD.bazel index c882dfb5..68aecc50 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,6 +1,5 @@ load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary") load("@pypi//:requirements.bzl", "all_whl_requirements") -load("@rules_python//python:defs.bzl", "py_runtime", "py_runtime_pair") load("@rules_python//python/pip_install:requirements.bzl", "compile_pip_requirements") load("@rules_python_gazelle_plugin//:def.bzl", "GAZELLE_PYTHON_RUNTIME_DEPS") load("@rules_python_gazelle_plugin//manifest:defs.bzl", "gazelle_python_manifest") @@ -43,24 +42,3 @@ modules_mapping( name = "modules_map", wheels = all_whl_requirements, ) - -py_runtime( - name = "container_py3_runtime", - interpreter_path = "/usr/bin/python", - python_version = "PY3", -) - -py_runtime_pair( - name = "container_py_runtime_pair", - py2_runtime = None, - py3_runtime = ":container_py3_runtime", -) - -toolchain( - name = "container_py_toolchain", - exec_compatible_with = [ - "@io_bazel_rules_docker//platforms:run_in_container", - ], - toolchain = ":container_py_runtime_pair", - toolchain_type = "@bazel_tools//tools/python:toolchain_type", -) diff --git a/MODULE.bazel b/MODULE.bazel index 967dad27..facdad1d 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -21,7 +21,7 @@ bazel_dep(name = "platforms", version = "0.0.7") python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True) python.toolchain( is_default = False, - python_version = "3.8.12", + python_version = "3.9", ) tools = use_extension("//py:extensions.bzl", "py_tools") @@ -82,3 +82,20 @@ crate.from_cargo( ], ) use_repo(crate, "crate_index") + +# For building test images with py_image_layer +bazel_dep(name = "container_structure_test", version = "1.19.1", dev_dependency = True) +bazel_dep(name = "rules_oci", version = "2.0.1", dev_dependency = True) + +oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True) +oci.pull( + name = "ubuntu", + digest = "sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab", + image = "ubuntu", + platforms = [ + "linux/arm64/v8", + "linux/amd64", + ], + tag = "latest", +) +use_repo(oci, "ubuntu", "ubuntu_linux_amd64", "ubuntu_linux_arm64_v8") diff --git a/WORKSPACE b/WORKSPACE index 9b9f05b7..af575f13 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -19,9 +19,6 @@ load("//py:toolchains.bzl", "rules_py_toolchains") rules_py_toolchains() -# Load the Python toolchain for rules_docker -register_toolchains("//:container_py_toolchain") - load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") python_register_toolchains( @@ -139,22 +136,6 @@ load("@bazel_skylib_gazelle_plugin//:setup.bzl", "bazel_skylib_gazelle_plugin_se bazel_skylib_gazelle_plugin_setup(register_go_toolchains = False) -############################################ -# rules_docker dependencies for containers -load( - "@io_bazel_rules_docker//repositories:repositories.bzl", - container_repositories = "repositories", -) - -container_repositories() - -load( - "@io_bazel_rules_docker//python3:image.bzl", - _py_image_repos = "repositories", -) - -_py_image_repos() - ############################################ # rules_rust dependencies for building tools load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set") @@ -306,3 +287,29 @@ crates_repository( load("@crate_index//:defs.bzl", "crate_repositories") crate_repositories() + +load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies") + +rules_oci_dependencies() + +load("@rules_oci//oci:repositories.bzl", "oci_register_toolchains") + +oci_register_toolchains(name = "oci") + +# You can pull your base images using oci_pull like this: +load("@rules_oci//oci:pull.bzl", "oci_pull") + +oci_pull( + name = "ubuntu", + digest = "sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab", + image = "ubuntu", + platforms = [ + "linux/arm64/v8", + "linux/amd64", + ], + tag = "latest", +) + +load("@container_structure_test//:repositories.bzl", "container_structure_test_register_toolchain") + +container_structure_test_register_toolchain(name = "cst") diff --git a/internal_deps.bzl b/internal_deps.bzl index d4c41e99..51748eb6 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -78,13 +78,6 @@ def rules_py_internal_deps(): ], ) - http_archive( - name = "io_bazel_rules_docker", - sha256 = "9d41cbe09688d4de137b19091f162de05be9a629a4355bfc1a993f378231730a", - strip_prefix = "rules_docker-3040e1fd74659a52d1cdaff81359f57ee0e2bb41", - urls = ["https://github.com/bazelbuild/rules_docker/archive/3040e1fd74659a52d1cdaff81359f57ee0e2bb41.zip"], - ) - http_archive( name = "rules_python_gazelle_plugin", sha256 = "c68bdc4fbec25de5b5493b8819cfc877c4ea299c0dcb15c244c5a00208cde311", @@ -92,6 +85,20 @@ def rules_py_internal_deps(): url = "https://github.com/bazelbuild/rules_python/releases/download/0.31.0/rules_python-0.31.0.tar.gz", ) + http_archive( + name = "rules_oci", + sha256 = "1bd16e455278d523f01326e0c3964cd64d7840a7e99cdd6e2617e59f698f3504", + strip_prefix = "rules_oci-2.2.0", + url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.2.0/rules_oci-v2.2.0.tar.gz", + ) + + http_archive( + name = "container_structure_test", + integrity = "sha256-TLs4LT1+3JcSn3n4MZbJXmAG2QY9ntuzOiMRupNyrTk=", + strip_prefix = "container-structure-test-1.19.3", + url = "https://github.com/GoogleContainerTools/container-structure-test/archive/refs/tags/v1.19.3.zip", + ) + http_archive( name = "rules_rust", integrity = "sha256-heIBNyerJvsiq9/+SyrAwnotW2KWFnumPY9uExQPUfk=", diff --git a/py/tests/containers/BUILD.bazel b/py/tests/containers/BUILD.bazel deleted file mode 100644 index 9e68d321..00000000 --- a/py/tests/containers/BUILD.bazel +++ /dev/null @@ -1,38 +0,0 @@ -load("@io_bazel_rules_docker//contrib:test.bzl", "container_test") -load("@io_bazel_rules_docker//python3:image.bzl", "py3_image") -load("//py:defs.bzl", "py_binary") - -py_binary( - name = "main_bin", - srcs = ["__main__.py"], - tags = ["manual"], - deps = [ - "//py/tests/containers/branding", - "//py/tests/internal-deps/adder", - "@pypi_colorama//:pkg", - ], -) - -# py3_image container support reverts us back to the rules_python way of invoking the binary, -# (as really there is a py_binary in the py3_image). -# This test ensures that rules_py can still run in that mode, but there are a few notable exceptions: -# * There is no longer a virtual env to run in -# * The rules_py launcher isn't invoked -# * There is no pip -# * Dependencies that were consumed via wheel targets are lost -# Perhaps rules_container can provide a suitable alternative here, or rules_py provides a thin wrapper around the -# rules_docker container_image that produces the expected output, but it would be limited in terms of customisation. -py3_image( - name = "py_image", - srcs = ["__main__.py"], - main = "__main__.py", - tags = ["manual"], - deps = [":main_bin"], -) - -container_test( - name = "py_image_test", - configs = ["py_image_test.yaml"], - image = ":py_image", - tags = ["manual"], -) diff --git a/py/tests/containers/branding/BUILD.bazel b/py/tests/containers/branding/BUILD.bazel deleted file mode 100644 index e357207d..00000000 --- a/py/tests/containers/branding/BUILD.bazel +++ /dev/null @@ -1,8 +0,0 @@ -load("//py:defs.bzl", "py_library") - -py_library( - name = "branding", - srcs = ["__init__.py"], - imports = [".."], - visibility = ["//py/tests/containers:__pkg__"], -) diff --git a/py/tests/containers/py_image_test.yaml b/py/tests/containers/py_image_test.yaml deleted file mode 100644 index 9df880c5..00000000 --- a/py/tests/containers/py_image_test.yaml +++ /dev/null @@ -1,14 +0,0 @@ -schemaVersion: 2.0.0 - -fileExistenceTests: - - name: __main__ is present - path: /app/py/tests/containers/py_image.binary.runfiles/aspect_rules_py/py/tests/containers/__main__.py - - name: runfiles dependencies are present - path: /app/py/tests/containers/py_image.binary.runfiles/pypi_colorama/__init__.py -commandTests: - - name: can run binary - exitCode: 0 - command: /usr/bin/python - args: - - /app/py/tests/containers/py_image.binary - expectedOutput: ["Hello rules_py - 3.14"] diff --git a/py/tests/internal-deps/adder/BUILD.bazel b/py/tests/internal-deps/adder/BUILD.bazel index c8fd66e0..0609c9c8 100644 --- a/py/tests/internal-deps/adder/BUILD.bazel +++ b/py/tests/internal-deps/adder/BUILD.bazel @@ -10,7 +10,7 @@ py_library( # This library contributes to the container test, testing we can pull in and use a library from another # package in the repo. visibility = [ - "//py/tests/containers:__pkg__", "//py/tests/internal-deps:__pkg__", + "//py/tests/py_image_layer:__pkg__", ], ) diff --git a/py/tests/py_image_layer/BUILD.bazel b/py/tests/py_image_layer/BUILD.bazel index 914b964d..fae2acad 100644 --- a/py/tests/py_image_layer/BUILD.bazel +++ b/py/tests/py_image_layer/BUILD.bazel @@ -1,3 +1,5 @@ +load("@container_structure_test//:defs.bzl", "container_structure_test") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load") load("//py:defs.bzl", "py_binary", "py_image_layer") load("asserts.bzl", "assert_tar_listing") @@ -9,10 +11,15 @@ platform( ], ) -# Case 1: Basic usage py_binary( name = "my_app_bin", - srcs = ["main.py"], + srcs = ["__main__.py"], + tags = ["manual"], + deps = [ + "//py/tests/internal-deps/adder", + "//py/tests/py_image_layer/branding", + "@pypi_colorama//:pkg", + ], ) py_image_layer( @@ -26,3 +33,26 @@ assert_tar_listing( actual = [":my_app_layers"], expected = ":my_app_layers.listing", ) + +oci_image( + name = "image", + # This is defined by an oci.pull() call in /MODULE.bazel + base = "@ubuntu", + entrypoint = ["/{}/my_app_bin".format(package_name())], + tars = [":my_app_layers"], +) + +# To build the image and load it into it into a local runtime: +# $ bazel run //py/tests/py_image_layer:image_load +# $ docker run --rm gcr.io/oci_python_hello_world:latest +oci_load( + name = "image_load", + image = ":image", + repo_tags = ["gcr.io/oci_python_hello_world:latest"], +) + +container_structure_test( + name = "py_image_test", + configs = ["py_image_test.yaml"], + image = ":image", +) diff --git a/py/tests/containers/__main__.py b/py/tests/py_image_layer/__main__.py similarity index 100% rename from py/tests/containers/__main__.py rename to py/tests/py_image_layer/__main__.py diff --git a/py/tests/py_image_layer/asserts.bzl b/py/tests/py_image_layer/asserts.bzl index 3b484bb9..f443d9b5 100644 --- a/py/tests/py_image_layer/asserts.bzl +++ b/py/tests/py_image_layer/asserts.bzl @@ -19,5 +19,4 @@ def assert_tar_listing(name, actual, expected): in_file = actual_listing, out_file = expected, testonly = True, - tags = ["skip-on-bazel6"], ) diff --git a/py/tests/py_image_layer/branding/BUILD.bazel b/py/tests/py_image_layer/branding/BUILD.bazel new file mode 100644 index 00000000..e8fa0100 --- /dev/null +++ b/py/tests/py_image_layer/branding/BUILD.bazel @@ -0,0 +1,8 @@ +load("@aspect_rules_py//py:defs.bzl", "py_library") + +py_library( + name = "branding", + srcs = ["__init__.py"], + imports = [".."], + visibility = ["//py/tests/py_image_layer:__pkg__"], +) diff --git a/py/tests/containers/branding/__init__.py b/py/tests/py_image_layer/branding/__init__.py similarity index 100% rename from py/tests/containers/branding/__init__.py rename to py/tests/py_image_layer/branding/__init__.py diff --git a/py/tests/py_image_layer/main.py b/py/tests/py_image_layer/main.py deleted file mode 100644 index e8ac73ad..00000000 --- a/py/tests/py_image_layer/main.py +++ /dev/null @@ -1 +0,0 @@ -print("Hello!!") \ No newline at end of file diff --git a/py/tests/py_image_layer/my_app_layers.listing b/py/tests/py_image_layer/my_app_layers.listing index 7b02781a..acc3792b 100644 --- a/py/tests/py_image_layer/my_app_layers.listing +++ b/py/tests/py_image_layer/my_app_layers.listing @@ -828,6 +828,29 @@ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app -rwxr-xr-x 0 0 0 3697 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/python_toolchain_x86_64-unknown-linux-gnu/lib/python3.9/site-packages/setuptools/warnings.py -rwxr-xr-x 0 0 0 8628 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/python_toolchain_x86_64-unknown-linux-gnu/lib/python3.9/site-packages/setuptools/wheel.py -rwxr-xr-x 0 0 0 719 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/python_toolchain_x86_64-unknown-linux-gnu/lib/python3.9/site-packages/setuptools/windows_support.py +drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/ +-rwxr-xr-x 0 0 0 149 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/__init__.py +drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/ +-rwxr-xr-x 0 0 0 266 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/__init__.py +-rwxr-xr-x 0 0 0 2522 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/ansi.py +-rwxr-xr-x 0 0 0 11128 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/ansitowin32.py +-rwxr-xr-x 0 0 0 3325 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/initialise.py +drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/tests/ +-rwxr-xr-x 0 0 0 75 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/tests/__init__.py +-rwxr-xr-x 0 0 0 2839 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/tests/ansi_test.py +-rwxr-xr-x 0 0 0 10678 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/tests/ansitowin32_test.py +-rwxr-xr-x 0 0 0 6741 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/tests/initialise_test.py +-rwxr-xr-x 0 0 0 1866 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/tests/isatty_test.py +-rwxr-xr-x 0 0 0 1079 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/tests/utils.py +-rwxr-xr-x 0 0 0 3709 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/tests/winterm_test.py +-rwxr-xr-x 0 0 0 6181 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/win32.py +-rwxr-xr-x 0 0 0 7134 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/winterm.py +drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama-0.4.6.dist-info/ +-rwxr-xr-x 0 0 0 42 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama-0.4.6.dist-info/INSTALLER +-rwxr-xr-x 0 0 0 17158 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama-0.4.6.dist-info/METADATA +-rwxr-xr-x 0 0 0 105 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama-0.4.6.dist-info/WHEEL +drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama-0.4.6.dist-info/licenses/ +-rwxr-xr-x 0 0 0 1491 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama-0.4.6.dist-info/licenses/LICENSE.txt drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/python_toolchain_x86_64-unknown-linux-gnu/ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/python_toolchain_x86_64-unknown-linux-gnu/bin/ -rwxr-xr-x 0 0 0 20960 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/python_toolchain_x86_64-unknown-linux-gnu/bin/python3 @@ -2438,20 +2461,27 @@ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/ --rwxr-xr-x 0 0 0 2887 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin --rwxr-xr-x 0 0 0 16 Jan 1 2023 ./py/tests/py_image_layer/main.py --rwxr-xr-x 0 0 0 40 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.venv.pth +-rwxr-xr-x 0 0 0 2895 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin +-rwxr-xr-x 0 0 0 204 Jan 1 2023 ./py/tests/py_image_layer/__main__.py +-rwxr-xr-x 0 0 0 183 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.venv.pth drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/ +drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/internal-deps/ +drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/internal-deps/adder/ +-rwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/internal-deps/adder/__init__.py +-rwxr-xr-x 0 0 0 32 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/internal-deps/adder/add.py drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/py_image_layer/ --rwxr-xr-x 0 0 0 16 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/py_image_layer/main.py --rwxr-xr-x 0 0 0 40 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/py_image_layer/my_app_bin.venv.pth +drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/py_image_layer/branding/ +-rwxr-xr-x 0 0 0 42 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/py_image_layer/branding/__init__.py +drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/ +-rwxr-xr-x 0 0 0 204 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/py_image_layer/__main__.py +-rwxr-xr-x 0 0 0 183 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/py_image_layer/my_app_bin.venv.pth drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/bazel_tools/ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/bazel_tools/tools/ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/bazel_tools/tools/bash/ drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/bazel_tools/tools/bash/runfiles/ -rwxr-xr-x 0 0 0 21622 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash drwxr-xr-x 0 0 0 0 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tools/ --rwxr-xr-x 0 0 0 2887 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/py_image_layer/my_app_bin +-rwxr-xr-x 0 0 0 2895 Jan 1 2023 ./py/tests/py_image_layer/my_app_bin.runfiles/aspect_rules_py/py/tests/py_image_layer/my_app_bin diff --git a/py/tests/py_image_layer/py_image_test.yaml b/py/tests/py_image_layer/py_image_test.yaml new file mode 100644 index 00000000..75e0e068 --- /dev/null +++ b/py/tests/py_image_layer/py_image_test.yaml @@ -0,0 +1,12 @@ +schemaVersion: 2.0.0 + +fileExistenceTests: + - name: __main__ is present + path: /py/tests/py_image_layer/__main__.py + - name: runfiles dependencies are present + path: /py/tests/py_image_layer/my_app_bin.runfiles/pypi_colorama/site-packages/colorama/__init__.py +commandTests: + - name: can run binary + exitCode: 0 + command: /py/tests/py_image_layer/my_app_bin + expectedOutput: ["Hello rules_py - 3.14"]