Skip to content

Add ssh parameter support for image builds#642

Open
sowmya-sl wants to merge 1 commit into
containers:mainfrom
sowmya-sl:add-ssh-params
Open

Add ssh parameter support for image builds#642
sowmya-sl wants to merge 1 commit into
containers:mainfrom
sowmya-sl:add-ssh-params

Conversation

@sowmya-sl

Copy link
Copy Markdown

Allow passing SSH agent sockets or keys to the build API, similar to the existing secrets parameter support.
Fixes: #602

@inknos

inknos commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@sowmya-sl thanks for the PR, please sign your commit as DCO bot says

@inknos

inknos commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

/packit retest-failed

@inknos inknos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Apologies for the noise. I think the PR looks good but something might be missing on Podman's side and an issue could be filed to add ssh parameter there too. I'll investigate that while tests run

@sowmya-sl

sowmya-sl commented Apr 10, 2026

Copy link
Copy Markdown
Author

@inknos Let me know if anything needs to be added from the server side.

@sowmya-sl

Copy link
Copy Markdown
Author

/packit retest-failed

Comment thread podman/domain/images_build.py Outdated
manifest (str) - add the image to the specified manifest list.
Creates manifest list if it does not exist.
secrets (list[str]) - Secret files/envs to expose to the build
ssh (list[str]) - SSH agent socket or keys to expose to the build

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 would add an example of how content should look, or refer that content should look like podman build --ssh.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added

Comment thread podman/domain/images_build.py Outdated
params["secrets"] = json.dumps(kwargs.get("secrets"))

if "ssh" in kwargs:
params["ssh"] = json.dumps(kwargs.get("ssh"))

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.

Non-blocking: What if kwargs.get("ssh") returns an empty array?

Allow passing SSH agent sockets or keys to the build API,
similar to the existing secrets parameter support.

Review comments:
- Add usage examples and reference to podman build --ssh in
  the ssh parameter docstring

Signed-off-by: sowmya-sl <lsowmyanarayanan@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@inknos

inknos commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@sowmya-sl thanks

@Honny1 I think a change is needed in podman like this. it's just a POC, what do you think?

@Honny1

Honny1 commented Jun 8, 2026

Copy link
Copy Markdown
Member

@sowmya-sl thanks

@Honny1 I think a change is needed in podman like this. it's just a POC, what do you think?

I think yes.

inknos added a commit to inknos/podman that referenced this pull request Jun 9, 2026
Pass SSH agent sockets or keys through the build API,
mirroring the existing secrets parameter support.

- Add `ssh` query parameter to the build endpoint
- Parse and move SSH key files out of the build context
  (same pattern as secrets)
- Wire SSHSources into buildah CommonBuildOptions
- Add client-side SSH key file handling in Go bindings
- Add e2e test for --ssh flag with key file

Related: containers/podman-py#602
Related: containers/podman-py#642
Signed-off-by: Nicola Sella <nsella@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Pass --ssh option when building an image

3 participants