Merge pull request #1186 from tiborvass/buildkit-envvar-zero

build: use strconv.ParseBool to parse DOCKER_BUILDKIT to allow value "0"
This commit is contained in:
Sebastiaan van Stijn 2018-07-04 01:28:03 +02:00 committed by GitHub
commit bded5beb78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import (
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime" "runtime"
"strconv"
"strings" "strings"
"github.com/docker/cli/cli" "github.com/docker/cli/cli"
@ -176,9 +177,15 @@ func (out *lastProgressOutput) WriteProgress(prog progress.Progress) error {
// nolint: gocyclo // nolint: gocyclo
func runBuild(dockerCli command.Cli, options buildOptions) error { func runBuild(dockerCli command.Cli, options buildOptions) error {
if os.Getenv("DOCKER_BUILDKIT") != "" { if buildkitEnv := os.Getenv("DOCKER_BUILDKIT"); buildkitEnv != "" {
enableBuildkit, err := strconv.ParseBool(buildkitEnv)
if err != nil {
return errors.Wrap(err, "DOCKER_BUILDKIT environment variable expects boolean value")
}
if enableBuildkit {
return runBuildBuildKit(dockerCli, options) return runBuildBuildKit(dockerCli, options)
} }
}
var ( var (
buildCtx io.ReadCloser buildCtx io.ReadCloser