update linters for go1.25 base version
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -49,7 +50,7 @@ func withDir(dir string) cmdOpt {
|
||||
}
|
||||
|
||||
func buildxCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
||||
cmd := exec.Command("buildx")
|
||||
cmd := exec.CommandContext(context.TODO(), "buildx")
|
||||
cmd.Env = os.Environ()
|
||||
for _, opt := range opts {
|
||||
opt(cmd)
|
||||
@@ -76,7 +77,7 @@ func buildxCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
||||
}
|
||||
|
||||
func composeCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
||||
cmd := exec.Command("compose")
|
||||
cmd := exec.CommandContext(context.TODO(), "compose")
|
||||
cmd.Env = os.Environ()
|
||||
for _, opt := range opts {
|
||||
opt(cmd)
|
||||
@@ -100,7 +101,7 @@ func composeCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
||||
}
|
||||
|
||||
func dockerCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
||||
cmd := exec.Command("docker")
|
||||
cmd := exec.CommandContext(context.TODO(), "docker")
|
||||
cmd.Env = os.Environ()
|
||||
for _, opt := range opts {
|
||||
opt(cmd)
|
||||
@@ -200,10 +201,10 @@ func buildkitVersion(t *testing.T, sb integration.Sandbox) string {
|
||||
os.RemoveAll(destDir)
|
||||
})
|
||||
|
||||
cmd := exec.Command(undockBin, "--cachedir", "/root/.cache/undock", "--include", "/usr/bin/buildkitd", "--rm-dist", buildkitImage, destDir)
|
||||
cmd := exec.CommandContext(context.TODO(), undockBin, "--cachedir", "/root/.cache/undock", "--include", "/usr/bin/buildkitd", "--rm-dist", buildkitImage, destDir)
|
||||
require.NoErrorf(t, cmd.Run(), "failed to extract buildkitd binary from %q", buildkitImage)
|
||||
|
||||
cmd = exec.Command(filepath.Join(destDir, "usr", "bin", "buildkitd"), "--version")
|
||||
cmd = exec.CommandContext(context.TODO(), filepath.Join(destDir, "usr", "bin", "buildkitd"), "--version")
|
||||
out, err := cmd.CombinedOutput()
|
||||
require.NoErrorf(t, err, "failed to get BuildKit version from %q: %s", buildkitImage, string(out))
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ func (w *containerWorker) New(ctx context.Context, cfg *integration.BackendConfi
|
||||
}
|
||||
defer os.RemoveAll(filepath.Dir(cfgfile))
|
||||
name := "integration-container-" + identity.NewID()
|
||||
cmd := exec.Command("buildx", "create",
|
||||
cmd := exec.CommandContext(ctx, "buildx", "create",
|
||||
"--bootstrap",
|
||||
"--name="+name,
|
||||
"--buildkitd-config="+cfgfile,
|
||||
@@ -75,7 +75,7 @@ func (w *containerWorker) New(ctx context.Context, cfg *integration.BackendConfi
|
||||
}
|
||||
|
||||
cl := func() error {
|
||||
cmd := exec.Command("buildx", "rm", "-f", name)
|
||||
cmd := exec.CommandContext(context.Background(), "buildx", "rm", "-f", name)
|
||||
cmd.Env = append(
|
||||
os.Environ(),
|
||||
"BUILDX_CONFIG=/tmp/buildx-"+name,
|
||||
|
||||
@@ -98,7 +98,7 @@ func (c dockerWorker) New(ctx context.Context, cfg *integration.BackendConfig) (
|
||||
}
|
||||
|
||||
name := "integration-" + identity.NewID()
|
||||
cmd := exec.Command("docker", "context", "create",
|
||||
cmd := exec.CommandContext(ctx, "docker", "context", "create",
|
||||
name,
|
||||
"--docker", "host="+bk.DockerAddress(),
|
||||
)
|
||||
@@ -109,7 +109,7 @@ func (c dockerWorker) New(ctx context.Context, cfg *integration.BackendConfig) (
|
||||
|
||||
cl = func() error {
|
||||
err := bkclose()
|
||||
cmd := exec.Command("docker", "context", "rm", "-f", name)
|
||||
cmd := exec.CommandContext(context.Background(), "docker", "context", "rm", "-f", name)
|
||||
if err1 := cmd.Run(); err == nil {
|
||||
err = errors.Wrapf(err1, "failed to remove buildx instance %s", name)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func (w remoteWorker) New(ctx context.Context, cfg *integration.BackendConfig) (
|
||||
}
|
||||
|
||||
name := "integration-remote-" + identity.NewID()
|
||||
cmd := exec.Command("buildx", "create",
|
||||
cmd := exec.CommandContext(ctx, "buildx", "create",
|
||||
"--bootstrap",
|
||||
"--name="+name,
|
||||
"--driver=remote",
|
||||
@@ -55,7 +55,7 @@ func (w remoteWorker) New(ctx context.Context, cfg *integration.BackendConfig) (
|
||||
|
||||
cl = func() error {
|
||||
err := bkclose()
|
||||
cmd := exec.Command("buildx", "rm", "-f", name)
|
||||
cmd := exec.CommandContext(context.Background(), "buildx", "rm", "-f", name)
|
||||
cmd.Env = append(os.Environ(), "BUILDX_CONFIG=/tmp/buildx-"+name)
|
||||
if err1 := cmd.Run(); err == nil {
|
||||
err = err1
|
||||
|
||||
Reference in New Issue
Block a user