Skip to content

Commit

Permalink
Merge pull request #16777 from Luap99/build-remote-volume
Browse files Browse the repository at this point in the history
podman-remote build add --volume support
  • Loading branch information
openshift-merge-robot authored Dec 9, 2022
2 parents 02b7866 + 9f6cf50 commit 15fca66
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
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

0 comments on commit 15fca66

Please sign in to comment.