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

commit: add a --add-file flag #5226

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

nalind
Copy link
Member

@nalind nalind commented Dec 13, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Add a flag to buildah commit which allows adding arbitrary files to the image while we're committing it. When not squashing, they'll take the form of a second new layer.

How to verify it

New integration test!

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

The bit that warns about not being able to do this in combination with --cw should be easy to fix once #5224 or something like it is merged.

Does this PR introduce a user-facing change?

`buildah commit` now accepts a `--add-file` flag, which can be used to add a file to the committed image without modifying the working container which is being committed.

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 13, 2023
Copy link
Contributor

openshift-ci bot commented Dec 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nalind

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@nalind nalind force-pushed the commit-add-files branch 2 times, most recently from 0e7204b to 8611bdc Compare December 13, 2023 19:13
@rhatdan
Copy link
Member

rhatdan commented Dec 13, 2023

LGTM
Who would do this and Why? Is this a feature you want to add to buildah build?

@nalind
Copy link
Member Author

nalind commented Dec 13, 2023

It's something we're going to use for https://issues.redhat.com/browse/RUN-1838. It's really only exposed at the CLI so that we can have an integration test as part of this PR. For build I'd still point people at ADD and COPY instructions, since this only handles one file at a time.

Read the contents of the file `source` and add it to the committed image as a file at `destination`. The new file will
be owned by UID 0, GID 0, have 0644 permissions, and be given a current timestamp unless the **--timestamp** option is
also specified. This option can be specified multiple times.

Copy link
Member

Choose a reason for hiding this comment

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

Not necessary for this PR, but did you consider making the destination optional? I.e., if not specified, it would default to the source location?

Copy link
Member Author

Choose a reason for hiding this comment

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

It hadn't occurred to me, but there's no reason it couldn't be optional.

Add a flag to `buildah commit` which allows adding arbitrary files to
the image while we're committing it.  When not squashing, they'll take
the form of a second new layer.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
@TomSweeneyRedHat
Copy link
Member

LGTM

@rhatdan
Copy link
Member

rhatdan commented Dec 16, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Dec 16, 2023
@openshift-merge-bot openshift-merge-bot bot merged commit b9346c5 into containers:main Dec 16, 2023
33 checks passed
@nalind nalind deleted the commit-add-files branch January 8, 2024 14:32
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved kind/feature Categorizes issue or PR as related to a new feature. lgtm locked - please file new issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants