bazel-contrib / bazel-contrib/rules_oci

FR: incremental loader

Open
#627 7 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Starlark
Stars
423
Forks
213
Avg merge
53m
Merged PRs (30d)
1

Description

I witness the following error while trying to run a container test against a tarball created by `rules_oci`.

```
➜ mre-container-tar-test git:(main) ✗ bazel test //my_package:empty_file_image_tarball_test
ERROR: /Users/josalvatorre/code/mre-container-tar-test/my_package/BUILD.bazel:26:25: in container_structure_test rule //my_package:empty_file_image_tarball_test:
Traceback (most recent call last):
File "/private/var/tmp/_bazel_josalvatorre/bb1e2552732b81b1b69870fcd931a2e6/external/container_structure_test~/bazel/container_structure_test.bzl", line 55, column 17, in _structure_test_impl
fail("when the 'driver' attribute is not 'docker', then the image must be a .tar file")
Error in fail: when the 'driver' attribute is not 'docker', then the image must be a .tar file
ERROR: /Users/josalvatorre/code/mre-container-tar-test/my_package/BUILD.bazel:26:25: Analysis of target '//my_package:empty_file_image_tarball_test' failed
ERROR: Analysis of target '//my_package:empty_file_image_tarball_test' failed; build aborted
INFO: Elapsed time: 0.079s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
ERROR: No test targets were found, yet testing was requested
```

This *only* happens when testing against a tarball. I can test against the image layer just fine.

I created a simple [minimal reproducible example here][1].

This might just be an issue with [`container_structure_test`][3]. In that case, we can just mention in the documentation that we only support testing against the image layer instead of the tarball.

Sorry if I'm just doing something wrong 😅

[1]: https://github.com/josalvatorre/mre-container-tar-test
[2]: https://github.com/bazel-contrib/rules_oci/blob/3d43cb1a1bb2f5edc15c7f48b406be3fb225e673/README.md?plain=1#L95-L97
[3]: https://github.com/GoogleContainerTools/container-structure-test#running-structure-tests-through-bazel

Contributor guide

Open the contributing guide

Research direction

Start with the linked minimal reproducible example and its my_package/BUILD.bazel target, then read the referenced README lines and container_structure_test Bazel documentation. Compare testing the image layer with the tarball case and determine whether rules_oci or container_structure_test owns the limitation. Done means the behavior is fixed or the supported input is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.