Skip to content

Commit

Permalink
[NO TESTS NEEDED] Turn on podman-remote build --isolation
Browse files Browse the repository at this point in the history
Currently podman only works with --isolation chroot.  This PR
fixes this by allowing the isolation mode to default to OCI and to
also allow users to pass the isolation mode into the containers.

The current tests for --isolation should cause this code to be tested.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Mar 27, 2021
1 parent 4d0b583 commit 6e250c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
17 changes: 8 additions & 9 deletions cmd/podman/images/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"strings"
"time"

"github.com/containers/buildah"
"github.com/containers/buildah/define"
buildahCLI "github.com/containers/buildah/pkg/cli"
"github.com/containers/buildah/pkg/parse"
Expand Down Expand Up @@ -159,11 +158,11 @@ func buildFlags(cmd *cobra.Command) {
flags.SetNormalizeFunc(buildahCLI.AliasFlags)
if registry.IsRemote() {
flag = flags.Lookup("isolation")
buildOpts.Isolation = buildah.OCI
if err := flag.Value.Set(buildah.OCI); err != nil {
logrus.Errorf("unable to set --isolation to %v: %v", buildah.OCI, err)
buildOpts.Isolation = define.OCI
if err := flag.Value.Set(define.OCI); err != nil {
logrus.Errorf("unable to set --isolation to %v: %v", define.OCI, err)
}
flag.DefValue = buildah.OCI
flag.DefValue = define.OCI
_ = flags.MarkHidden("disable-content-trust")
_ = flags.MarkHidden("cache-from")
_ = flags.MarkHidden("sign-by")
Expand Down Expand Up @@ -412,10 +411,10 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
format := ""
flags.Format = strings.ToLower(flags.Format)
switch {
case strings.HasPrefix(flags.Format, buildah.OCI):
format = buildah.OCIv1ImageManifest
case strings.HasPrefix(flags.Format, buildah.DOCKER):
format = buildah.Dockerv2ImageManifest
case strings.HasPrefix(flags.Format, define.OCI):
format = define.OCIv1ImageManifest
case strings.HasPrefix(flags.Format, define.DOCKER):
format = define.Dockerv2ImageManifest
default:
return nil, errors.Errorf("unrecognized image type %q", flags.Format)
}
Expand Down
3 changes: 3 additions & 0 deletions contrib/cirrus/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ do
fi
done

# Make sure cni network plugins directory exists
mkdir -p /etc/cni/net.d

# Ensure that all lower-level contexts and child-processes have
# ready access to higher level orchestration (e.g Cirrus-CI)
# variables.
Expand Down
8 changes: 2 additions & 6 deletions pkg/api/handlers/compat/images_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,9 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
}
format := buildah.Dockerv2ImageManifest
registry := query.Registry
isolation := buildah.IsolationChroot
/*
// FIXME, This is very broken. Buildah will only work with chroot
isolation := buildah.IsolationDefault
*/
isolation := buildah.IsolationDefault
if utils.IsLibpodRequest(r) {
// isolation = parseLibPodIsolation(query.Isolation)
isolation = parseLibPodIsolation(query.Isolation)
registry = ""
format = query.OutputFormat
} else {
Expand Down

0 comments on commit 6e250c3

Please sign in to comment.