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

oci_pull: handle OCI-format images #74

Closed
alexeagle opened this issue Feb 23, 2023 · 5 comments · Fixed by #137
Closed

oci_pull: handle OCI-format images #74

alexeagle opened this issue Feb 23, 2023 · 5 comments · Fixed by #137

Comments

@alexeagle
Copy link
Collaborator

We should be able to pull an image that's published in OCI format, for example crane manifest quay.io/buildah/stable

Also it means we should handle more Media Types:

application/vnd.oci.image.index.v1+json
application/vnd.oci.image.manifest.v1+json
@alexeagle
Copy link
Collaborator Author

we should also add a test that our output matches e.g crane pull thesayyn/debian:oci ./pco --format=oci
for example the index.json file we produce needs the right media types.

alexeagle pushed a commit that referenced this issue Mar 12, 2023
* Adding a helper script for Bzlmod migration.

The script does the following things:
  - 1. Run the build without Bzlmod enabled to generate resolved external
    dependencies with --experimental_repository_resolved_file
  - 2. Run the build with Bzlmod enabled and identify recongnized error message
  - 3. Use the resolved external deps info to give migration suggestions.
  - 4. Repeat 2 and 3 until all external deps are available via Bzlmod (or WORKSPACE.bzlmod).

To start the migration, clone the Bazel central registry repo and run the following command from your project root:
```
<path to a local BCR repo>/tools/migrate_to_bzlmod.py <build flags> <build targets>
```

* More fixes

* Rename function

* Address comments
@seh
Copy link

seh commented Mar 13, 2023

Does google/go-containerregistry#1586 having merged (addressing google/go-containerregistry#1579) help advance this pursuit? Do we need a release there in order to make use of the new crane registry serve subcommand?

@thesayyn
Copy link
Collaborator

We'll be cutting a new release for go-containerregistry and rules_oci this week. that'll fix this issue.

@seh
Copy link

seh commented Mar 13, 2023

We'll be cutting a new release for go-containerregistry and rules_oci this week.

That’s great news. Overcoming this gap leaves only bazelbuild/bazel@dfdf63a arriving in a Bazel release to get me back to where I once was with rules_docker. Oh, one more: @alexeagle’s stamping-related changes in #70.

@alexeagle
Copy link
Collaborator Author

Leaving this open, as the new handling of images with a crane toolchain doesn't work under bzlmod:

oci.pull(
    name = "buildah",
    tag = "latest",
    image = "quay.io/buildah/stable",
    reproducible = False,
)

->

ERROR: An error occurred during the fetch of repository 'rules_oci~0.3.8~oci~buildah':
   Traceback (most recent call last):
        File "/shared/cache/bazel/user_base/359b45a24cf55cc22380e941fe3bcf54/external/rules_oci~0.3.8/oci/pull.bzl", line 315, column 36, in _oci_pull_impl
                mf, mf_len = _download_manifest(rctx, rctx.attr.identifier, mf_file)
        File "/shared/cache/bazel/user_base/359b45a24cf55cc22380e941fe3bcf54/external/rules_oci~0.3.8/oci/pull.bzl", line 247, column 30, in _download_manifest
                result = rctx.execute([crane, "manifest", "{}{}{}".format(rctx.attr.image, tag_or_digest, identifier), "--platform=all"])
Error in execute: Unable to load package for @[unknown repo 'oci_crane_linux_amd64' requested from @rules_oci~0.3.8]//:crane: The repository '@[unknown repo 'oci_crane_linux_amd64' requested from @rules_oci~0.3.8]' could not be resolved: No repository visible as '@oci_crane_linux_amd64' from repository '@rules_oci~0.3.8'

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 a pull request may close this issue.

3 participants