Skip to content

Commit 5e5e96e

Browse files
committed
refactor: move BUILDKIT_HOST to buildkitutil
Signed-off-by: Justin Alvarez <[email protected]>
1 parent d0d1c2d commit 5e5e96e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

cmd/nerdctl/builder/builder_build.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package builder
1919
import (
2020
"errors"
2121
"fmt"
22-
"os"
2322
"strconv"
2423
"strings"
2524

@@ -263,13 +262,6 @@ func GetBuildkitHost(cmd *cobra.Command, namespace string) (string, error) {
263262
return buildkitHost, nil
264263
}
265264

266-
if buildkitHost := os.Getenv("BUILDKIT_HOST"); buildkitHost != "" {
267-
if err := buildkitutil.PingBKDaemon(buildkitHost); err != nil {
268-
return "", err
269-
}
270-
return buildkitHost, nil
271-
272-
}
273265
return buildkitutil.GetBuildkitHost(namespace)
274266
}
275267

pkg/buildkitutil/buildkitutil.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ func BuildctlBaseArgs(buildkitHost string) []string {
6060
}
6161

6262
func GetBuildkitHost(namespace string) (string, error) {
63+
if buildkitHost := os.Getenv("BUILDKIT_HOST"); buildkitHost != "" {
64+
if _, err := pingBKDaemon(buildkitHost); err != nil {
65+
return "", err
66+
}
67+
return buildkitHost, nil
68+
}
69+
6370
paths, err := getBuildkitHostCandidates(namespace)
6471
if err != nil {
6572
return "", err

0 commit comments

Comments
 (0)