mirror of
https://github.com/containers/podman.git
synced 2025-06-20 09:03:43 +08:00
[NO TESTS NEEDED] Turn on podman-remote build --isolation
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 <dwalsh@redhat.com>
This commit is contained in:
@ -8,7 +8,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/buildah"
|
|
||||||
"github.com/containers/buildah/define"
|
"github.com/containers/buildah/define"
|
||||||
buildahCLI "github.com/containers/buildah/pkg/cli"
|
buildahCLI "github.com/containers/buildah/pkg/cli"
|
||||||
"github.com/containers/buildah/pkg/parse"
|
"github.com/containers/buildah/pkg/parse"
|
||||||
@ -159,11 +158,11 @@ func buildFlags(cmd *cobra.Command) {
|
|||||||
flags.SetNormalizeFunc(buildahCLI.AliasFlags)
|
flags.SetNormalizeFunc(buildahCLI.AliasFlags)
|
||||||
if registry.IsRemote() {
|
if registry.IsRemote() {
|
||||||
flag = flags.Lookup("isolation")
|
flag = flags.Lookup("isolation")
|
||||||
buildOpts.Isolation = buildah.OCI
|
buildOpts.Isolation = define.OCI
|
||||||
if err := flag.Value.Set(buildah.OCI); err != nil {
|
if err := flag.Value.Set(define.OCI); err != nil {
|
||||||
logrus.Errorf("unable to set --isolation to %v: %v", buildah.OCI, err)
|
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("disable-content-trust")
|
||||||
_ = flags.MarkHidden("cache-from")
|
_ = flags.MarkHidden("cache-from")
|
||||||
_ = flags.MarkHidden("sign-by")
|
_ = flags.MarkHidden("sign-by")
|
||||||
@ -412,10 +411,10 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
|
|||||||
format := ""
|
format := ""
|
||||||
flags.Format = strings.ToLower(flags.Format)
|
flags.Format = strings.ToLower(flags.Format)
|
||||||
switch {
|
switch {
|
||||||
case strings.HasPrefix(flags.Format, buildah.OCI):
|
case strings.HasPrefix(flags.Format, define.OCI):
|
||||||
format = buildah.OCIv1ImageManifest
|
format = define.OCIv1ImageManifest
|
||||||
case strings.HasPrefix(flags.Format, buildah.DOCKER):
|
case strings.HasPrefix(flags.Format, define.DOCKER):
|
||||||
format = buildah.Dockerv2ImageManifest
|
format = define.Dockerv2ImageManifest
|
||||||
default:
|
default:
|
||||||
return nil, errors.Errorf("unrecognized image type %q", flags.Format)
|
return nil, errors.Errorf("unrecognized image type %q", flags.Format)
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,9 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Make sure cni network plugins directory exists
|
||||||
|
mkdir -p /etc/cni/net.d
|
||||||
|
|
||||||
# Ensure that all lower-level contexts and child-processes have
|
# Ensure that all lower-level contexts and child-processes have
|
||||||
# ready access to higher level orchestration (e.g Cirrus-CI)
|
# ready access to higher level orchestration (e.g Cirrus-CI)
|
||||||
# variables.
|
# variables.
|
||||||
|
@ -199,13 +199,9 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
format := buildah.Dockerv2ImageManifest
|
format := buildah.Dockerv2ImageManifest
|
||||||
registry := query.Registry
|
registry := query.Registry
|
||||||
isolation := buildah.IsolationChroot
|
isolation := buildah.IsolationDefault
|
||||||
/*
|
|
||||||
// FIXME, This is very broken. Buildah will only work with chroot
|
|
||||||
isolation := buildah.IsolationDefault
|
|
||||||
*/
|
|
||||||
if utils.IsLibpodRequest(r) {
|
if utils.IsLibpodRequest(r) {
|
||||||
// isolation = parseLibPodIsolation(query.Isolation)
|
isolation = parseLibPodIsolation(query.Isolation)
|
||||||
registry = ""
|
registry = ""
|
||||||
format = query.OutputFormat
|
format = query.OutputFormat
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user