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

podman-remote build add --volume support #16777

Merged
merged 1 commit into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmd/podman/images/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ func buildFlags(cmd *cobra.Command) {
_ = flags.MarkHidden("signature-policy")
_ = flags.MarkHidden("tls-verify")
_ = flags.MarkHidden("compress")
_ = flags.MarkHidden("volume")
_ = flags.MarkHidden("output")
_ = flags.MarkHidden("logsplit")
}
Expand Down
3 changes: 1 addition & 2 deletions docs/source/markdown/podman-build.1.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,7 @@ using the architecture variant of the build host.

Create a bind mount. Specifying the `-v /HOST-DIR:/CONTAINER-DIR` option, Podman
bind mounts `/HOST-DIR` from the host to `/CONTAINER-DIR` in the Podman
container. (This option is not available with the remote Podman client,
including Mac and Windows (excluding WSL2) machines)
container.

The `OPTIONS` are a comma-separated list and can be: <sup>[[1]](#Footnote1)</sup>

Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
Timestamp int64 `schema:"timestamp"`
Ulimits string `schema:"ulimits"`
UnsetEnvs []string `schema:"unsetenv"`
Volumes []string `schema:"volume"`
}{
Dockerfile: "Dockerfile",
IdentityLabel: true,
Expand Down Expand Up @@ -670,6 +671,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
ShmSize: strconv.Itoa(query.ShmSize),
Ulimit: ulimits,
Secrets: secrets,
Volumes: query.Volumes,
},
Compression: compression,
ConfigureNetwork: parseNetworkConfigurationPolicy(query.ConfigureNetwork),
Expand Down
6 changes: 6 additions & 0 deletions pkg/api/server/register_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,12 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// type: array
// items:
// type: string
// - in: query
// name: volume
// description: Extra volumes that should be mounted in the build container.
// type: array
// items:
// type: string
// produces:
// - application/json
// responses:
Expand Down
5 changes: 5 additions & 0 deletions pkg/bindings/images/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
params.Add("platform", platform)
}
}

for _, volume := range options.CommonBuildOpts.Volumes {
params.Add("volume", volume)
}

var err error
var contextDir string
if contextDir, err = filepath.EvalSymlinks(options.ContextDirectory); err == nil {
Expand Down
3 changes: 1 addition & 2 deletions test/buildah-bud/apply-podman-deltas
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ skip_if_remote "secret files not implemented under podman-remote" \
"bud with containerfile env secret" \
"bud with containerfile env secret priority"

skip_if_remote "volumes don't work with podman-remote" \
"buildah bud --volume" \
skip_if_remote "--signature-policy does not work with podman-remote" \
"buildah-bud-policy"

skip_if_remote "--build-context option not implemented in podman-remote" \
Expand Down