-
Notifications
You must be signed in to change notification settings - Fork 54
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
HMS-3235 import containers in local containers-storage #306
Conversation
Depends on osbuild/osbuild#1489. I have tested this locally and it pulls in the container. It's just hard to add a test for this with the current setup. |
9778a78
to
a19771c
Compare
b0bec51
to
fa7e0ab
Compare
I've made it possible to configure the image store to which the containers get saved, given the following blueprint: {
"name": "embed-containers",
"blueprint": {
"packages": [
{
"name": "podman",
"version": "*"
}
],
"containers": [
{
"source": "registry.gitlab.com/redhat/services/products/image-builder/ci/osbuild-composer/fedora-minimal"
},
{
"source": "localhost/hello",
"containers-transport": "containers-storage"
}
],
"customizations": {
"containers-storage": {
"storage-path": "/ostree/container-storage"
}
}
}
}
We get the following output from the [
{
"Created": "2023-12-12T12:54:40.001637346Z",
"Digest": "sha256:d8bac64df06e506dd2e285a9e52ea86ee276637d1ad1cf1c89bb1f3b80b0d5ad",
"Id": "5dc7f15873a23033de66f8734cb61969a9c749ded0cfb56300e785bfaf5ef528",
"Names": [
"localhost/hello:latest"
]
},
{
"Created": "2022-07-11T13:16:13Z",
"Digest": "sha256:4d76a7480ce1861c95975945633dc9d03807ffb45c64b664ef22e673798d414b",
"Id": "d4ee87dab8193afad523b1042b9d3f5ec887555a704e5aaec2876798ebb585a6",
"Names": [
"registry.gitlab.com/redhat/services/products/image-builder/ci/osbuild-composer/fedora-minimal:latest"
]
}
]
I had to update |
fa7e0ab
to
b5c7adc
Compare
b5c7adc
to
a51f558
Compare
Does the ContainersStorage customization in the blueprint control both where to get containers from and where to install them? I think we need to separate two things here:
The customization in the blueprint is, I think, good for 2., configuring the container storage path for the image itself. {
"name": "embed-containers",
"blueprint": {
"packages": [
{
"name": "podman",
"version": "*"
}
],
"containers": [
{
"source": "registry.gitlab.com/redhat/services/products/image-builder/ci/osbuild-composer/fedora-minimal"
},
{
"source": "localhost/hello",
"containers-transport": "containers-storage",
"storage-location": "/var/lib/containers/storage"
}
],
"customizations": {
"containers-storage": {
"storage-path": "/data/containers/storage"
}
}
}
} |
Yeah spot on. The customisation is for the destination so that answers #2. And your suggestion for number #1 (the storage path) will work, it was only checking |
Definitely yeah. Unless it's more correct to read the storage.conf file. |
Ah you're right, skopeo reads the the Edit: I tested it out and it's all good (just need to extend the |
This is needed: osbuild/osbuild#1504 |
925f053
to
886005b
Compare
This is the source storage location, right? It seems mildly confusing to call it storage-location instead of something like source-location. |
Yeah this is a great point. Maybe we could flip this on it's head a bit? Rename the customization to {
"source": "localhost/hello",
"containers-transport": "containers-storage",
"source-path": "/var/lib/containers/storage"
} and {
"customizations": {
"containers-storage": {
"destination-path": "/data/containers/storage"
}
}
} |
I like that! It's consistent between the two related parts with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing approval. Option rename pending.
(also osbuild PR 😅)
886005b
to
6ebe224
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All sorted now. LGTM!
Oh, the CI runners need btrfs-tools installed now too. It's a build dependency of the project. Can you update the test configs to install it?
Also update the contribution guides (docs/developer/README.md and CONTRIBUTING.md. Now that I'm listing it all I realise this should all probably be defined in one location. A script or some equivalent to a Python package's |
Sounds like a good idea. Since we're referencing it in multiple places. I will update the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR! I gave it a read mostly of curiosity to learn a bit more about this area and put in some suggestions/ideas/questions. Looks nice and nothing is a blocker but maybe some of the comments are helpful :)
6ebe224
to
b0c1ea8
Compare
50fdc91
to
9c72009
Compare
Enabling container resolution for container images in `containers-storage` requires additional dependencies to compile the code. Jira: https://issues.redhat.com/browse/HMS-3235
Allow users to specify the `containers-transport` field and the `storage-path` (optional) to the local containers storage. The `containers-transport` field, at present, is an enum and the valid transports are `docker` & `containers-storage`. Jira: https://issues.redhat.com/browse/HMS-3235
Add an enum to the skopeo source for the containers-transport [1] type, since we would like to initially check for containers with the `containers-storage` transport in addition to the existing `docker` transport. This could later be extended for other transports too. Jira: https://issues.redhat.com/browse/HMS-3235 [1] CONTAINERS-TRANSPORTS(5)
Update the containers resolver to resolve containers in local `containers-storage`. This required the go package `github.com/containers/image/v5/transports/alltransports` as a dependency. Jira: https://issues.redhat.com/browse/HMS-3235
Allow users to specify `containers-storage` customizations. At the moment, only the `storage-path` for an addititional `containers-storage` is enabled. The `storage-type` and `transport` are not configurable, but could be enabled at a later stage. Jira: https://issues.redhat.com/browse/HMS-3235
`ostree` images require an alternative `containers-storage` since `/var/lib` is not writeable. This commit moves the logic to the distro in preparation for a configurable storage path for additional container image stores. Jira: https://issues.redhat.com/browse/HMS-3235
Custom container image stores will also require the `python-toml` or `toml` package (depending on the distro). Jira: https://issues.redhat.com/browse/HMS-3235
Enable a custom storage path for containers to be pulled into. Jira: https://issues.redhat.com/browse/HMS-3235
9c72009
to
e2c6abb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 🎉
The Container struct in the Blueprint was expanded as part of local containers-storage feature [1]. Adding and testing support for this feature will require more work. For now, let's explicitly ignore the fields during the Blueprint copying so we can update the images dependency. [1] osbuild/images#306
This PR adds the ability to import containers from local containers-storage. It additionally, adds the ability to specify a custom storage path that a user can configure. This will then update the configurations for the
/etc/containers/storage.conf
file and add the storage path to the additional image stores.Jira: https://issues.redhat.com/browse/HMS-3235