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

feat(oci_pull): expose the digest as a file #542

Merged
merged 5 commits into from
Jun 26, 2024

Conversation

aignas
Copy link
Contributor

@aignas aignas commented Apr 15, 2024

This makes the external image repos also expose the digest file, similarly how
the oci_image creates a .digest target. The actual name of the file can be
something else and I am just putting this out to initiate a discussion.

Let's say a user has @alpine image defined via oci_pull, they can access the
digest of the upstream image by accessing the @alpine//:image.digest file.
We could similarly have the platforms of the image written to a file as well,
but I am not sure if that is useful.

Having the image.digest in a file could be useful for various automation that
is done using write_source_file rule where one would use a genrule to get
the digest value from the @alpine//:image.digest target, transform it and
output it to a file that is later synced with write_source_file. Not needing
to depend on extra CLIs that might not be available to the user of rules_oci
as toolchains could be good here.

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

Nice, do you mind also adding some usage of it in the e2e or examples, so we have some form of test coverage that we don't drop or break this in the future?

oci/private/pull.bzl Outdated Show resolved Hide resolved
@thesayyn
Copy link
Collaborator

thesayyn commented Jun 8, 2024

@aignas do you want to finish this PR?

@thesayyn thesayyn added the can close? We'll close this issue if we don't get a new comment in 30 days. label Jun 8, 2024
@aignas
Copy link
Contributor Author

aignas commented Jun 9, 2024

Could you please give some guidance on where the tests should go and if I am expected to bump the lock files?

I would still love the feature, but if someone would like to take over and finish this PR, I am OK with that.

aignas added 2 commits June 17, 2024 12:53
This makes the external image repos also expose the digest file, similarly
how the `oci_image` creates a `.digest` target. The actual name of the
file can be something else and I am just putting this out to initate a
discussion.
@aignas aignas force-pushed the feat/digest-for-external-images branch from d8acbd5 to cce6558 Compare June 17, 2024 03:53
@aignas
Copy link
Contributor Author

aignas commented Jun 17, 2024

The tests are now passing, @thesayyn, let me know what is left to do here:

$ bazel test :test_bzlmod
INFO: Analyzed target //:test_bzlmod (125 packages loaded, 11031 targets configured).
INFO: Found 1 test target...
Target //:test_bzlmod up-to-date:
  bazel-bin/test_bzlmod_bats.sh
INFO: Elapsed time: 210.224s, Critical Path: 151.69s
INFO: 32 processes: 10 internal, 16 darwin-sandbox, 6 local.
INFO: Build completed successfully, 32 total actions
//:test_bzlmod                                                           PASSED in 64.0s

Executed 1 out of 1 test: 1 test passes.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.

$ bazel test :test_nobzlmod
INFO: Analyzed target //:test_nobzlmod (0 packages loaded, 1 target configured).
INFO: Found 1 test target...
Target //:test_nobzlmod up-to-date:
  bazel-bin/test_nobzlmod_bats.sh
INFO: Elapsed time: 69.553s, Critical Path: 66.46s
INFO: 6 processes: 4 internal, 2 local.
INFO: Build completed successfully, 6 total actions
//:test_nobzlmod                                                         PASSED in 66.2s

Executed 1 out of 1 test: 1 test passes.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.

oci/private/pull.bzl Outdated Show resolved Hide resolved
@thesayyn thesayyn removed the can close? We'll close this issue if we don't get a new comment in 30 days. label Jun 26, 2024
@thesayyn thesayyn merged commit 899af81 into bazel-contrib:main Jun 26, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants