-
Notifications
You must be signed in to change notification settings - Fork 788
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
internal/mkcw.Archive(): handle extra image content #5252
Conversation
@@ -70,8 +71,6 @@ func (c chainRetrievalError) Error() string { | |||
|
|||
// Archive generates a WorkloadConfig for a specified directory and produces a | |||
// tar archive of a container image's rootfs with the expected contents. | |||
// The input directory will have a ".krun_config.json" file added to it while | |||
// this function is running, but it will be removed on completion. |
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.
This comment was no longer correct as of #5224, but I forgot to drop it during that one.
internal/mkcw/archive.go
Outdated
} | ||
defer input.Close() | ||
if _, err := io.Copy(output, input); err != nil { | ||
return fmt.Errorf("copying contents of %q to %q in root filesystem: %w", location, content, err) |
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.
Above error stmt is using container root filesystem
instead of only root filesystem
, maybe we can just keep any one of them for consistency.
return fmt.Errorf("copying contents of %q to %q in root filesystem: %w", location, content, err) | |
return fmt.Errorf("copying contents of %q to %q in container root filesystem: %w", location, content, err) |
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.
Changing it. Also, I had the orders of location
and content
mixed up, switching them.
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 one comment above.
cmd/buildah/mkcw.go
Outdated
if len(addFile) > 0 { | ||
options.ExtraImageContent = make(map[string]string) | ||
for _, spec := range addFile { | ||
specSlice := strings.SplitN(spec, ":", 2) |
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.
Are we supposed to use strings.Cut now?
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.
Yes. Correcting it.
LGTM |
When we have extra files to add to the image, handle them by adding them to the upper overlay layer before creating the plaintext filesystem image. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
And don't refer to a filename in an example as a directory in accompanying text. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
a44e76b
to
de7c1e1
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, nalind, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Add the
--add-file
to themkcw
command, and handle it whencommit
is given the--cw
option: when we have extra files to add to the image, handle them by adding them to the upper overlay layer before creating the plaintext filesystem image.Also touch up a couple of man pages.
How to verify it
Extended integration test!
Which issue(s) this PR fixes:
None
Special notes for your reviewer:
Does this PR introduce a user-facing change?