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

compose-image: Add --initialize-mode #4598

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

cgwalters
Copy link
Member

A long time ago I did
containers/skopeo@08b27fc in preparation for this change.

Basically this is what we really want to be the default, but couldn't at the time: "Create a new image if one doesn't exist".

For completeness though, we also add support for always (which is the existing --initialize) as well as --never (which ensures we never overwrite an existing image, in case
someone cares).

However in testing this out: it basically works OK with a registry transport which is the big one, but:

  • It just plain doesn't work with .ociarchive due to skopeo bugs
  • It even more unfortunately doesn't work with oci directories and a target image reference; e.g. --format=oci manifest.yaml oci:foo:sometag

A long time ago I did
containers/skopeo@08b27fc
in preparation for this change.

Basically this is what we really want to be the default, but
couldn't at the time: "Create a new image if one doesn't exist".

For completeness though, we also add support for `always`
(which is the existing `--initialize`) as well as `--never`
(which ensures we never overwrite an existing image, in case
 someone cares).

However in testing this out: it basically works OK with
a registry transport which is the big one, but:

- It just plain doesn't work with `.ociarchive` due to skopeo bugs
- It even more unfortunately doesn't work with `oci` directories
  and a target image reference;
  e.g. `--format=oci manifest.yaml oci:foo:sometag`
cgwalters added a commit to cgwalters/skopeo that referenced this pull request Sep 15, 2023
By adding the standard ENOENT to our list of errors.

I hit this while working on
coreos/rpm-ostree#4598
which is a tool that builds base images and wants to query
if the image exists beforehand.
cgwalters added a commit to cgwalters/skopeo that referenced this pull request Sep 15, 2023
By adding the standard ENOENT to our list of errors.

I hit this while working on
coreos/rpm-ostree#4598
which is a tool that builds base images and wants to query
if the image exists beforehand.

Signed-off-by: Colin Walters <[email protected]>
@cgwalters
Copy link
Member Author

xref containers/skopeo#2114

cgwalters added a commit to cgwalters/skopeo that referenced this pull request Sep 15, 2023
By adding the standard ENOENT to our list of errors.

I hit this while working on
coreos/rpm-ostree#4598
which is a tool that builds base images and wants to query
if the image exists beforehand.

Signed-off-by: Colin Walters <[email protected]>
cgwalters added a commit to cgwalters/image that referenced this pull request Sep 18, 2023
This is for containers/skopeo#2114
which is in turn a dependency of coreos/rpm-ostree#4598

Basically I want to map ENOENT to `ImageNotFound`, because the build
tooling wants to treat "target image is not present" differently
from "DNS lookup failed" or "we got EPERM".

There's a bit of code motion here because we need to move
the `os.Open()` call before creating a temporary directory.

Signed-off-by: Colin Walters <[email protected]>
cgwalters added a commit to cgwalters/image that referenced this pull request Sep 18, 2023
This is for containers/skopeo#2114
which is in turn a dependency of coreos/rpm-ostree#4598

Basically I want to map ENOENT to `ImageNotFound`, because the build
tooling wants to treat "target image is not present" differently
from "DNS lookup failed" or "we got EPERM".

There's a bit of code motion here because we need to move
the `os.Open()` call before creating a temporary directory.
cgwalters added a commit to cgwalters/image that referenced this pull request Sep 18, 2023
This is for containers/skopeo#2114
which is in turn a dependency of coreos/rpm-ostree#4598

Basically I want to map ENOENT to a clear error, because the build
tooling wants to treat "target image is not present" differently
from "DNS lookup failed" or "we got EPERM".

There's a bit of code motion here because we need to move
the `os.Open()` call before creating a temporary directory.

Signed-off-by: Colin Walters <[email protected]>
cgwalters added a commit to cgwalters/image that referenced this pull request Sep 18, 2023
This is for containers/skopeo#2114
which is in turn a dependency of coreos/rpm-ostree#4598

Basically I want to map ENOENT to a clear error, because the build
tooling wants to treat "target image is not present" differently
from "DNS lookup failed" or "we got EPERM".

There's a bit of code motion here because we need to move
the `os.Open()` call before creating a temporary directory.

Signed-off-by: Colin Walters <[email protected]>
cgwalters added a commit to cgwalters/image that referenced this pull request Sep 18, 2023
This is for containers/skopeo#2114
which is in turn a dependency of coreos/rpm-ostree#4598

Basically I want to map ENOENT to a clear error, because the build
tooling wants to treat "target image is not present" differently
from "DNS lookup failed" or "we got EPERM".

There's a bit of code motion here because we need to move
the `os.Open()` call before creating a temporary directory.

Signed-off-by: Colin Walters <[email protected]>
Copy link
Member

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

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

lgtm

@jmarrero jmarrero merged commit 699ee98 into coreos:main Sep 19, 2023
17 checks passed
cgwalters added a commit to cgwalters/image that referenced this pull request Sep 19, 2023
This is for containers/skopeo#2114
which is in turn a dependency of coreos/rpm-ostree#4598

Basically I want to map ENOENT to a clear error, because the build
tooling wants to treat "target image is not present" differently
from "DNS lookup failed" or "we got EPERM".

There's a bit of code motion here because we need to move
the `os.Open()` call before creating a temporary directory.

Signed-off-by: Colin Walters <[email protected]>
cgwalters added a commit to cgwalters/image that referenced this pull request Sep 19, 2023
This is for containers/skopeo#2114
which is in turn a dependency of coreos/rpm-ostree#4598

Basically I want to map ENOENT to a clear error, because the build
tooling wants to treat "target image is not present" differently
from "DNS lookup failed" or "we got EPERM".

There's a bit of code motion here because we need to move
the `os.Open()` call before creating a temporary directory.

Signed-off-by: Colin Walters <[email protected]>
cgwalters added a commit to cgwalters/image that referenced this pull request Sep 19, 2023
This is for containers/skopeo#2114
which is in turn a dependency of coreos/rpm-ostree#4598

Basically I want to map ENOENT to a clear error, because the build
tooling wants to treat "target image is not present" differently
from "DNS lookup failed" or "we got EPERM".

There's a bit of code motion here because we need to move
the `os.Open()` call before creating a temporary directory.

Signed-off-by: Colin Walters <[email protected]>
cgwalters added a commit to cgwalters/image that referenced this pull request Sep 19, 2023
This is for containers/skopeo#2114
which is in turn a dependency of coreos/rpm-ostree#4598

Basically I want to map ENOENT to a clear error, because the build
tooling wants to treat "target image is not present" differently
from "DNS lookup failed" or "we got EPERM".

There's a bit of code motion here because we need to move
the `os.Open()` call before creating a temporary directory.

Signed-off-by: Colin Walters <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants