Skip to content

RHEL-14922: accept a config blob alongside the "changes" slice when committing#20657

Merged
openshift-merge-bot[bot] merged 3 commits intocontainers:mainfrom
nalind:commit-config
Dec 1, 2023
Merged

RHEL-14922: accept a config blob alongside the "changes" slice when committing#20657
openshift-merge-bot[bot] merged 3 commits intocontainers:mainfrom
nalind:commit-config

Conversation

@nalind
Copy link
Copy Markdown
Member

@nalind nalind commented Nov 10, 2023

Does this PR introduce a user-facing change?

`podman container commit` now features a `--config` option which accepts a filename containing a JSON-encoded container configuration to be merged in to the newly-created image.

Fixes #13770.

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note labels Nov 10, 2023
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Nov 10, 2023
Copy link
Copy Markdown
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

just some drive by comments

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would make more sense to accepts an io.Reader here instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Had to make it a *io.Reader to make the generator happy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah I think the generator could use some improvements, IMO a pointer to a interface makes things harder to use and more likely to cause nil derefs.
Anyway this shouldn't really block your work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also io.Reader here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Had to make it a *io.Reader to make the generator happy.

Comment on lines 37 to 39
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you can add schema:"-" to the type then it will not be added via ToParams()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, thanks, I wouldn't have guessed that.

@nalind nalind force-pushed the commit-config branch 4 times, most recently from 88dcb4f to 130fe7f Compare November 17, 2023 20:00
@nalind
Copy link
Copy Markdown
Member Author

nalind commented Nov 17, 2023

/override Build Each Commit

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Nov 17, 2023

@nalind: /override requires failed status contexts, check run or a prowjob name to operate on.
The following unknown contexts/checkruns were given:

  • Build
  • Commit
  • Each

Only the following failed contexts/checkruns were expected:

  • Artifacts
  • Build Each Commit
  • Total Success
  • Verify Win Installer Build
  • machine-hyperv podman windows rootless host sqlite
  • machine-wsl podman windows rootless host sqlite
  • tide

If you are trying to override a checkrun that has a space in it, you must put a double quote on the context.

Details

In response to this:

/override Build Each Commit

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@nalind
Copy link
Copy Markdown
Member Author

nalind commented Nov 17, 2023

/override "Build Each Commit"
... because the vendoring commit isn't going to be in the final version of this PR.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Nov 17, 2023

@nalind: Overrode contexts on behalf of nalind: Build Each Commit

Details

In response to this:

/override "Build Each Commit"
... because the vendoring commit isn't going to be in the final version of this PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@nalind nalind force-pushed the commit-config branch 2 times, most recently from a011559 to 8b7478b Compare November 17, 2023 23:04
@nalind
Copy link
Copy Markdown
Member Author

nalind commented Nov 18, 2023

/retitle RHEL-14922: accept a config blob alongside the "changes" slice when committing

@openshift-ci openshift-ci bot changed the title WIP: RHEL-14922: accept a config blob alongside the "changes" slice when committing RHEL-14922: accept a config blob alongside the "changes" slice when committing Nov 18, 2023
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 18, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 19, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 20, 2023
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This struct is used for the REST API as well - will this break given that io.Reader can't really be serialized over the network?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Changed it back to a []byte.

@nalind nalind force-pushed the commit-config branch 4 times, most recently from 77c513a to 08c51ea Compare November 28, 2023 16:31
@packit-as-a-service
Copy link
Copy Markdown

Ephemeral COPR build failed. @containers/packit-build please check.

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Nov 29, 2023

LGTM
@mheon @vrothberg PTAL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we point users to a specification of the configuration?

Copy link
Copy Markdown
Member Author

@nalind nalind Nov 29, 2023

Choose a reason for hiding this comment

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

It varies between OCI and Docker image formats. I don't think there's a stable location to point to for the Docker config blob format (the engine API documentation is close, but it includes the API version number) , and the OCI version is missing some interesting fields. If it wasn't being exercised in tests that I'm about to add, I could pretty easily be talked into dropping the option.
Actually, maybe even after I add the tests to the PR....

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Well, as written, it's a JSON-encoded copy of the structure defined at https://github.com/containers/image/blob/main/manifest/docker_schema2.go#L67. Would a pointer to that be useful enough to someone who hasn't spent time staring at that code at some point already?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great idea, thanks @nalind

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Okay, added. Pointed at the currently-newest tag instead of main in case the line number changes.

@nalind nalind force-pushed the commit-config branch 2 times, most recently from bd40243 to 7289285 Compare November 29, 2023 19:11
…tting

Use ParseUserNamespace instead of ParseNamespace to parse a passed-in
user namespace setting.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
When committing containers to create new images, accept a container
config blob being passed in the body of the API request by adding a
Config field to our API structures.  Populate it from the body of
requests that we receive, and use its contents as the body of requests
that we make.

Make the libpod commit endpoint split changes values at newlines, just
like the compat endpoint does.

Pass both the config blob and the "changes" slice to buildah's Commit()
API, so that it can handle cases where they overlap or conflict.

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

nalind commented Nov 30, 2023

Changed a line in the description of the -v flag for build to match what buildah's doc says about it, which I think removes a bit of ambiguity.

Be specific that the `-v` flag only affects RUN instructions.  The
previous wording left it ambiguous, and people might have concluded that
it applied to ADD and COPY as well.

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

rhatdan commented Dec 1, 2023

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 1, 2023
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Dec 1, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nalind, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 1, 2023
@openshift-merge-bot openshift-merge-bot bot merged commit c479628 into containers:main Dec 1, 2023
@nalind nalind deleted the commit-config branch December 1, 2023 21:11
@nalind
Copy link
Copy Markdown
Member Author

nalind commented Feb 7, 2024

/cherry-pick v4.9.1-rhel

@openshift-cherrypick-robot
Copy link
Copy Markdown
Collaborator

@nalind: new pull request created: #21547

Details

In response to this:

/cherry-pick v4.9.1-rhel

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@nalind
Copy link
Copy Markdown
Member Author

nalind commented Feb 7, 2024

/cherry-pick v4.9

@openshift-cherrypick-robot
Copy link
Copy Markdown
Collaborator

@nalind: new pull request created: #21549

Details

In response to this:

/cherry-pick v4.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label May 8, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/api-change Change to remote API; merits scrutiny lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker APIv2 /commit ignores uploaded config

7 participants