diff --git a/drivers/docker/coordinator_test.go b/drivers/docker/coordinator_test.go index 850d1d0e6..be1765627 100644 --- a/drivers/docker/coordinator_test.go +++ b/drivers/docker/coordinator_test.go @@ -368,7 +368,8 @@ func TestDockerCoordinator_PullImage_ProgressError(t *testing.T) { readErr := errors.New("a bad bad thing happened") mock.pullReader = &readErrorer{readErr: readErr} - _, _, err := coordinator.PullImage("foo", nil, uuid.Generate(), nil, timeout, timeout) + _, _, err := coordinator.PullImage( + "docker.invalid/"+uuid.Generate(), nil, uuid.Generate(), nil, timeout, timeout) must.ErrorIs(t, err, readErr) } diff --git a/drivers/docker/docklog/docker_logger_test.go b/drivers/docker/docklog/docker_logger_test.go index 13e6b5421..65a26d6f7 100644 --- a/drivers/docker/docklog/docker_logger_test.go +++ b/drivers/docker/docklog/docker_logger_test.go @@ -10,7 +10,7 @@ import ( "fmt" "io" "os" - "strings" + "runtime" "testing" "time" @@ -26,13 +26,16 @@ import ( "github.com/hashicorp/nomad/testutil" ) -func testContainerDetails() (image string, imageName string, imageTag string) { - image = testutil.TestBusyboxImage() - parts := strings.Split(image, ":") - imageName = parts[0] - imageTag = parts[1] +func testRemoteContainerImage() string { + if runtime.GOOS == "windows" { + return "hashicorpdev/busybox-windows:server2016-0.1" + } - return image, imageName, imageTag + if testutil.IsCI() { + // use our mirror to avoid rate-limiting in CI + return "docker.mirror.hashicorp.services/busybox:1" + } + return "docker.io/busybox:1" } func TestDockerLogger_Success(t *testing.T) { @@ -40,7 +43,7 @@ func TestDockerLogger_Success(t *testing.T) { ctu.DockerCompatible(t) ctx := context.Background() - containerImage, containerImageName, containerImageTag := testContainerDetails() + containerImage := testRemoteContainerImage() client, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) if err != nil { @@ -49,7 +52,7 @@ func TestDockerLogger_Success(t *testing.T) { if img, _, err := client.ImageInspectWithRaw(ctx, containerImage); err != nil || img.ID == "" { t.Log("image not found locally, downloading...") - out, err := client.ImagePull(ctx, fmt.Sprintf("%s:%s", containerImageName, containerImageTag), image.PullOptions{}) + out, err := client.ImagePull(ctx, containerImage, image.PullOptions{}) must.NoError(t, err, must.Sprint("failed to pull image")) defer out.Close() io.Copy(os.Stdout, out) @@ -112,7 +115,7 @@ func TestDockerLogger_Success_TTY(t *testing.T) { ctu.DockerCompatible(t) ctx := context.Background() - containerImage, containerImageName, containerImageTag := testContainerDetails() + containerImage := testRemoteContainerImage() client, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) if err != nil { @@ -121,7 +124,7 @@ func TestDockerLogger_Success_TTY(t *testing.T) { if img, _, err := client.ImageInspectWithRaw(ctx, containerImage); err != nil || img.ID == "" { t.Log("image not found locally, downloading...") - _, err = client.ImagePull(ctx, fmt.Sprintf("%s:%s", containerImageName, containerImageTag), image.PullOptions{}) + _, err = client.ImagePull(ctx, containerImage, image.PullOptions{}) must.NoError(t, err, must.Sprint("failed to pull image")) } @@ -197,7 +200,7 @@ func TestDockerLogger_LoggingNotSupported(t *testing.T) { ctu.DockerCompatible(t) ctx := context.Background() - containerImage, containerImageName, containerImageTag := testContainerDetails() + containerImage := testRemoteContainerImage() client, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) if err != nil { @@ -206,7 +209,7 @@ func TestDockerLogger_LoggingNotSupported(t *testing.T) { if img, _, err := client.ImageInspectWithRaw(ctx, containerImage); err != nil || img.ID == "" { t.Log("image not found locally, downloading...") - _, err = client.ImagePull(ctx, fmt.Sprintf("%s:%s", containerImageName, containerImageTag), image.PullOptions{}) + _, err = client.ImagePull(ctx, containerImage, image.PullOptions{}) require.NoError(t, err, "failed to pull image") } diff --git a/drivers/docker/driver_test.go b/drivers/docker/driver_test.go index a04f8870d..0d271d955 100644 --- a/drivers/docker/driver_test.go +++ b/drivers/docker/driver_test.go @@ -97,7 +97,7 @@ func dockerTask(t *testing.T) (*drivers.TaskConfig, *TaskConfig, []int) { dockerReserved := ports[0] dockerDynamic := ports[1] - cfg := newTaskConfig("", busyboxLongRunningCmd) + cfg := newTaskConfig(busyboxLongRunningCmd) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "redis-demo", @@ -250,6 +250,20 @@ func newTestDockerClient(t *testing.T) *client.Client { return client } +// testRemoteDockerImage is used only for tests where we need to pull the Docker +// image from a remote. Most tests should use newTaskConfig instead. +func testRemoteDockerImage(name, tag string) string { + img := name + ":" + tag + if tu.IsCI() { + // use our mirror to avoid rate-limiting in CI + img = "docker.mirror.hashicorp.services/" + img + } else { + // explicitly include docker.io for podman + img = "docker.io/" + img + } + return img +} + // Following tests have been removed from this file. // [TestDockerDriver_Fingerprint, TestDockerDriver_Fingerprint_Bridge, TestDockerDriver_Check_DockerHealthStatus] // If you want to checkout/revert those tests, please check commit: 41715b1860778aa80513391bd64abd721d768ab0 @@ -258,7 +272,7 @@ func TestDockerDriver_Start_Wait(t *testing.T) { ci.Parallel(t) testutil.DockerCompatible(t) - taskCfg := newTaskConfig("", busyboxLongRunningCmd) + taskCfg := newTaskConfig(busyboxLongRunningCmd) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "nc-demo", @@ -292,7 +306,7 @@ func TestDockerDriver_Start_WaitFinish(t *testing.T) { ci.Parallel(t) testutil.DockerCompatible(t) - taskCfg := newTaskConfig("", []string{"echo", "hello"}) + taskCfg := newTaskConfig([]string{"echo", "hello"}) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "nc-demo", @@ -333,7 +347,7 @@ func TestDockerDriver_Start_StoppedContainer(t *testing.T) { ci.Parallel(t) testutil.DockerCompatible(t) - taskCfg := newTaskConfig("", []string{"sleep", "9001"}) + taskCfg := newTaskConfig([]string{"sleep", "9001"}) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "nc-demo", @@ -448,7 +462,7 @@ func TestDockerDriver_Start_LoadImage(t *testing.T) { ci.Parallel(t) testutil.DockerCompatible(t) - taskCfg := newTaskConfig("", []string{"sh", "-c", "echo hello > $NOMAD_TASK_DIR/output"}) + taskCfg := newTaskConfig([]string{"sh", "-c", "echo hello > $NOMAD_TASK_DIR/output"}) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "busybox-demo", @@ -568,7 +582,7 @@ func TestDockerDriver_Start_Wait_AllocDir(t *testing.T) { exp := []byte{'w', 'i', 'n'} file := "output.txt" - taskCfg := newTaskConfig("", []string{ + taskCfg := newTaskConfig([]string{ "sh", "-c", fmt.Sprintf(`sleep 1; echo -n %s > $%s/%s`, @@ -621,7 +635,7 @@ func TestDockerDriver_Start_Kill_Wait(t *testing.T) { ci.Parallel(t) testutil.DockerCompatible(t) - taskCfg := newTaskConfig("", busyboxLongRunningCmd) + taskCfg := newTaskConfig(busyboxLongRunningCmd) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "busybox-demo", @@ -672,7 +686,7 @@ func TestDockerDriver_Start_KillTimeout(t *testing.T) { } timeout := 2 * time.Second - taskCfg := newTaskConfig("", []string{"sleep", "10"}) + taskCfg := newTaskConfig([]string{"sleep", "10"}) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "busybox-demo", @@ -770,23 +784,19 @@ func TestDockerDriver_StartNVersions(t *testing.T) { task1, cfg1, _ := dockerTask(t) - tcfg1 := newTaskConfig("", []string{"echo", "hello"}) + tcfg1 := newTaskConfig([]string{"echo", "hello"}) cfg1.Image = tcfg1.Image cfg1.LoadImage = tcfg1.LoadImage must.NoError(t, task1.EncodeConcreteDriverConfig(cfg1)) task2, cfg2, _ := dockerTask(t) - - tcfg2 := newTaskConfig("musl", []string{"echo", "hello"}) - cfg2.Image = tcfg2.Image - cfg2.LoadImage = tcfg2.LoadImage + cfg2.Image = "busybox:1.29.3" + cfg2.LoadImage = "busybox_musl.tar" must.NoError(t, task2.EncodeConcreteDriverConfig(cfg2)) task3, cfg3, _ := dockerTask(t) - - tcfg3 := newTaskConfig("glibc", []string{"echo", "hello"}) - cfg3.Image = tcfg3.Image - cfg3.LoadImage = tcfg3.LoadImage + cfg3.Image = "busybox:1.29.3" + cfg3.LoadImage = "busybox_glibc.tar" must.NoError(t, task3.EncodeConcreteDriverConfig(cfg3)) taskList := []*drivers.TaskConfig{task1, task2, task3} @@ -2274,7 +2284,7 @@ func setupDockerVolumes(t *testing.T, cfg map[string]interface{}, hostpath strin } containerFile := filepath.Join(containerPath, randfn) - taskCfg := newTaskConfig("", []string{"touch", containerFile}) + taskCfg := newTaskConfig([]string{"touch", containerFile}) taskCfg.Volumes = []string{fmt.Sprintf("%s:%s", hostpath, containerPath)} task := &drivers.TaskConfig{ @@ -2585,7 +2595,7 @@ func TestDockerDriver_OOMKilled(t *testing.T) { testutil.CgroupsCompatibleV2(t) - taskCfg := newTaskConfig("", []string{"sh", "-c", `sleep 2 && x=a && while true; do x="$x$x"; done`}) + taskCfg := newTaskConfig([]string{"sh", "-c", `sleep 2 && x=a && while true; do x="$x$x"; done`}) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "oom-killed", @@ -3098,19 +3108,23 @@ func TestDockerDriver_StopSignal(t *testing.T) { cases := []struct { name string + imageName string + imageLoad string variant string jobKillSignal string expectedSignals []string }{ { name: "stopsignal-only", - variant: "stopsignal", + imageName: "busybox:1.29.3-stopsignal", + imageLoad: "busybox_stopsignal.tar", jobKillSignal: "", expectedSignals: []string{"19", "9"}, }, { name: "stopsignal-killsignal", - variant: "stopsignal", + imageName: "busybox:1.29.3-stopsignal", + imageLoad: "busybox_stopsignal.tar", jobKillSignal: "SIGTERM", expectedSignals: []string{"15", "19", "9"}, }, @@ -3131,7 +3145,11 @@ func TestDockerDriver_StopSignal(t *testing.T) { for i := range cases { c := cases[i] t.Run(c.name, func(t *testing.T) { - taskCfg := newTaskConfig(c.variant, []string{"sleep", "9901"}) + taskCfg := newTaskConfig([]string{"sleep", "9901"}) + if c.imageLoad != "" { + taskCfg.Image = c.imageName + taskCfg.LoadImage = c.imageLoad + } task := &drivers.TaskConfig{ ID: uuid.Generate(), @@ -3145,11 +3163,7 @@ func TestDockerDriver_StopSignal(t *testing.T) { cleanup := d.MkAllocDir(task, true) defer cleanup() - if c.variant == "stopsignal" { - copyImage(t, task.TaskDir(), "busybox_stopsignal.tar") // Default busybox image with STOPSIGNAL 19 added - } else { - copyImage(t, task.TaskDir(), taskCfg.LoadImage) - } + copyImage(t, task.TaskDir(), taskCfg.LoadImage) client := newTestDockerClient(t) @@ -3222,7 +3236,7 @@ func TestDockerDriver_CollectStats(t *testing.T) { // we want to generate at least some CPU usage args := []string{"/bin/sh", "-c", "cat /dev/urandom | base64 > /dev/null"} - taskCfg := newTaskConfig("", args) + taskCfg := newTaskConfig(args) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "nc-demo", diff --git a/drivers/docker/driver_unix_test.go b/drivers/docker/driver_unix_test.go index 2d98c9d5b..43d025d4d 100644 --- a/drivers/docker/driver_unix_test.go +++ b/drivers/docker/driver_unix_test.go @@ -28,7 +28,6 @@ import ( "github.com/hashicorp/nomad/plugins/drivers" dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils" ntestutil "github.com/hashicorp/nomad/testutil" - tu "github.com/hashicorp/nomad/testutil" "github.com/shoenig/test/must" ) @@ -37,7 +36,6 @@ func TestDockerDriver_User(t *testing.T) { testutil.DockerCompatible(t) task, cfg, _ := dockerTask(t) - task.User = "alice" cfg.Command = "/bin/sleep" cfg.Args = []string{"10000"} @@ -78,7 +76,7 @@ func TestDockerDriver_NetworkAliases_Bridge(t *testing.T) { must.NoError(t, err) expected := []string{"foobar"} - taskCfg := newTaskConfig("", busyboxLongRunningCmd) + taskCfg := newTaskConfig(busyboxLongRunningCmd) taskCfg.NetworkMode = network.Name taskCfg.NetworkAliases = expected task := &drivers.TaskConfig{ @@ -114,7 +112,7 @@ func TestDockerDriver_NetworkMode_Host(t *testing.T) { testutil.DockerCompatible(t) expected := "host" - taskCfg := newTaskConfig("", busyboxLongRunningCmd) + taskCfg := newTaskConfig(busyboxLongRunningCmd) taskCfg.NetworkMode = expected task := &drivers.TaskConfig{ @@ -673,8 +671,8 @@ func TestDockerDriver_Cleanup(t *testing.T) { testutil.DockerCompatible(t) // using a small image and an specific point release to avoid accidental conflicts with other tasks - cfg := newTaskConfig("", []string{"sleep", "100"}) - cfg.Image = ntestutil.TestDockerImage("busybox", "1.29.2") + cfg := newTaskConfig([]string{"sleep", "100"}) + cfg.Image = testRemoteDockerImage("busybox", "1.29.2") cfg.LoadImage = "" task := &drivers.TaskConfig{ ID: uuid.Generate(), @@ -697,7 +695,7 @@ func TestDockerDriver_Cleanup(t *testing.T) { must.NoError(t, driver.DestroyTask(task.ID, true)) // Ensure image was removed - tu.WaitForResult(func() (bool, error) { + ntestutil.WaitForResult(func() (bool, error) { if _, _, err := client.ImageInspectWithRaw(context.Background(), cfg.Image); err == nil { return false, fmt.Errorf("image exists but should have been removed. Does another %v container exist?", cfg.Image) } @@ -742,7 +740,10 @@ func TestDockerDriver_Start_Image_HTTPS(t *testing.T) { harness.DestroyTask(task.ID, true) } -func newTaskConfig(variant string, command []string) TaskConfig { +// newTaskConfig returns a busybox task config that loads the image from +// test-resources. You'll need to call copyImage to copy this image into the +// TaskDir after the task has been defined. +func newTaskConfig(command []string) TaskConfig { var busyboxImageID, loadImage string @@ -755,15 +756,8 @@ func newTaskConfig(variant string, command []string) TaskConfig { loadImage = "busybox_linux_amd64.tar" } - image := busyboxImageID - - if variant != "" { - image = fmt.Sprintf("%s-%s", busyboxImageID, variant) - loadImage = fmt.Sprintf("busybox_%s.tar", variant) - } - return TaskConfig{ - Image: image, + Image: busyboxImageID, ImagePullTimeout: "5m", LoadImage: loadImage, Command: command[0], @@ -771,6 +765,14 @@ func newTaskConfig(variant string, command []string) TaskConfig { } } +// copyImage copies the Docker image in test-resources into the task directory +// for use with a task configuration with LoadImage (used by most of our tests). +// +// Note that if a test loads this image during task start, the local Docker +// daemon will now have it available for all other tests. Tests don't know if +// the image already existed before the test run, so we can't delete it from the +// local Docker daemon without causing side-effects on the host or making this +// all a lot more complicated. func copyImage(t *testing.T, taskDir *allocdir.TaskDir, image string) { dst := filepath.Join(taskDir.LocalDir, image) copyFile(filepath.Join("./test-resources/docker", image), dst, t) @@ -804,7 +806,7 @@ func TestDocker_ExecTaskStreaming(t *testing.T) { ci.Parallel(t) testutil.DockerCompatible(t) - taskCfg := newTaskConfig("", []string{"/bin/sleep", "1000"}) + taskCfg := newTaskConfig([]string{"/bin/sleep", "1000"}) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "nc-demo", @@ -862,7 +864,7 @@ func Test_dnsConfig(t *testing.T) { t.Run(c.name, func(t *testing.T) { harness := dockerDriverHarness(t, nil) - taskCfg := newTaskConfig("", []string{"/bin/sleep", "1000"}) + taskCfg := newTaskConfig([]string{"/bin/sleep", "1000"}) task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "nc-demo", diff --git a/drivers/docker/driver_windows_test.go b/drivers/docker/driver_windows_test.go index db3b42114..5d22c5fe4 100644 --- a/drivers/docker/driver_windows_test.go +++ b/drivers/docker/driver_windows_test.go @@ -6,20 +6,23 @@ package docker import ( + "os" "testing" "github.com/hashicorp/nomad/ci" "github.com/hashicorp/nomad/client/allocdir" "github.com/hashicorp/nomad/helper/uuid" "github.com/hashicorp/nomad/plugins/drivers" - "github.com/hashicorp/nomad/testutil" "github.com/shoenig/test/must" ) -func newTaskConfig(variant string, command []string) TaskConfig { - // busyboxImageID is an id of an image containing nanoserver windows and - // a busybox exe. - busyboxImageID := testutil.TestBusyboxImage() +func newTaskConfig(command []string) TaskConfig { + busyboxImageID := testRemoteDockerImage("hashicorpdev/busybox-windows", "server2016-0.1") + + // BUSYBOX_IMAGE environment variable overrides the busybox image name + if img, ok := os.LookupEnv("BUSYBOX_IMAGE"); ok { + busyboxImageID = img + } return TaskConfig{ Image: busyboxImageID, @@ -41,7 +44,7 @@ func Test_validateImageUser(t *testing.T) { Name: "busybox-demo", User: "nomadUser", } - taskDriverCfg := newTaskConfig("", []string{"sh", "-c", "sleep 1"}) + taskDriverCfg := newTaskConfig([]string{"sh", "-c", "sleep 1"}) tests := []struct { name string diff --git a/drivers/docker/reconcile_dangling_test.go b/drivers/docker/reconcile_dangling_test.go index d75a4c4d0..9abd23fb7 100644 --- a/drivers/docker/reconcile_dangling_test.go +++ b/drivers/docker/reconcile_dangling_test.go @@ -195,7 +195,6 @@ func TestDanglingContainerRemoval_network(t *testing.T) { c, iErr := dockerClient.ContainerInspect(context.Background(), id) must.NoError(t, iErr) must.Eq(t, "running", c.State.Status) - fmt.Println("state", c.State) // cleanup pause container err = dd.DestroyNetwork(allocID, spec) diff --git a/e2e/allocexec/input/sleepytar.hcl b/e2e/allocexec/input/sleepytar.hcl index 131238064..f45bbfda5 100644 --- a/e2e/allocexec/input/sleepytar.hcl +++ b/e2e/allocexec/input/sleepytar.hcl @@ -29,7 +29,7 @@ job "sleepytar" { driver = "docker" config { - image = "bash:latest" + image = "busybox:1" command = "sleep" args = ["infinity"] network_mode = "none" @@ -42,4 +42,3 @@ job "sleepytar" { } } } - diff --git a/e2e/artifact/input/artifact_linux.nomad b/e2e/artifact/input/artifact_linux.nomad index 45be009ee..8c7c0827b 100644 --- a/e2e/artifact/input/artifact_linux.nomad +++ b/e2e/artifact/input/artifact_linux.nomad @@ -242,8 +242,9 @@ job "linux" { } driver = "docker" config { - image = "bash:5" - args = ["-c", "cat local/go.mod && sleep 10"] + image = "busybox:1" + command = "/bin/sh" + args = ["-c", "cat local/go.mod && sleep 10"] } resources { cpu = 16 @@ -259,8 +260,9 @@ job "linux" { } driver = "docker" config { - image = "bash:5" - args = ["-c", "cat local/my/path/go.mod && sleep 10"] + image = "busybox:1" + command = "/bin/sh" + args = ["-c", "cat local/my/path/go.mod && sleep 10"] } resources { cpu = 16 @@ -277,8 +279,9 @@ job "linux" { } driver = "docker" config { - image = "bash:5" - args = ["-c", "cat ${NOMAD_ALLOC_DIR}/go.mod && sleep 10"] + image = "busybox:1" + command = "/bin/sh" + args = ["-c", "cat ${NOMAD_ALLOC_DIR}/go.mod && sleep 10"] } resources { cpu = 16 @@ -293,8 +296,9 @@ job "linux" { } driver = "docker" config { - image = "bash:5" - args = ["-c", "cat local/go-set-main/go.mod && sleep 10"] + image = "busybox:1" + command = "/bin/sh" + args = ["-c", "cat local/go-set-main/go.mod && sleep 10"] } resources { cpu = 16 @@ -310,8 +314,9 @@ job "linux" { } driver = "docker" config { - image = "bash:5" - args = ["-c", "cat local/my/zip/go-set-main/go.mod && sleep 10"] + image = "busybox:1" + command = "/bin/sh" + args = ["-c", "cat local/my/zip/go-set-main/go.mod && sleep 10"] } resources { cpu = 16 @@ -327,8 +332,9 @@ job "linux" { } driver = "docker" config { - image = "bash:5" - args = ["-c", "cat local/repository/go.mod && sleep 10"] + image = "busybox:1" + command = "/bin/sh" + args = ["-c", "cat local/repository/go.mod && sleep 10"] } resources { cpu = 16 diff --git a/e2e/csi/input/plugin-aws-efs-nodes.nomad b/e2e/csi/input/plugin-aws-efs-nodes.nomad index aec5222b1..7fb975ea3 100644 --- a/e2e/csi/input/plugin-aws-efs-nodes.nomad +++ b/e2e/csi/input/plugin-aws-efs-nodes.nomad @@ -22,7 +22,7 @@ job "plugin-aws-efs-nodes" { driver = "docker" config { - image = "amazon/aws-efs-csi-driver:v1.3.6" + image = "public.ecr.aws/efs-csi-driver/amazon/aws-efs-csi-driver:v1.3.6" args = [ "node", "--endpoint=${CSI_ENDPOINT}", diff --git a/e2e/docker/input/docker_config.hcl b/e2e/docker/input/docker_config.hcl index e98f5ec57..90fae5444 100644 --- a/e2e/docker/input/docker_config.hcl +++ b/e2e/docker/input/docker_config.hcl @@ -39,11 +39,13 @@ job "configure-docker" { unveil = ["r:${NOMAD_TASK_DIR}/daemon.json", "rwc:${var.docker_conf_dir}"] } + # note we need to keep the existing registry-mirrors from the host configuration template { destination = "local/daemon.json" perms = "644" data = < /tmp/daemon.json +{ + "registry-mirrors": ["https://docker.mirror.hashicorp.services"] +} +EOF +sudo mv /tmp/daemon.json /etc/docker/daemon.json # Java echo "Installing Java" diff --git a/e2e/workload_id/input/identity.nomad b/e2e/workload_id/input/identity.nomad index 3e941077e..5fadfe9c9 100644 --- a/e2e/workload_id/input/identity.nomad +++ b/e2e/workload_id/input/identity.nomad @@ -16,7 +16,8 @@ job "identity" { task "none" { driver = "docker" config { - image = "bash:5" + image = "busybox:1" + command = "/bin/sh" #HACK(schmichael) without the ending `sleep 2` we seem to sometimes miss logs :( args = ["-c", "wc -c < secrets/nomad_token; env | grep NOMAD_TOKEN; echo done; sleep 2"] @@ -35,7 +36,8 @@ job "identity" { driver = "docker" config { - image = "bash:5" + image = "busybox:1" + command = "/bin/sh" #HACK(schmichael) without the ending `sleep 2` we seem to sometimes miss logs :( args = ["-c", "wc -c < secrets/nomad_token; env | grep NOMAD_TOKEN; echo done; sleep 2"] @@ -57,7 +59,8 @@ job "identity" { driver = "docker" config { - image = "bash:5" + image = "busybox:1" + command = "/bin/sh" #HACK(schmichael) without the ending `sleep 2` we seem to sometimes miss logs :( args = ["-c", "wc -c < secrets/nomad_token; env | grep NOMAD_TOKEN; echo done; sleep 2"] @@ -78,7 +81,8 @@ job "identity" { driver = "docker" config { - image = "bash:5" + image = "busybox:1" + command = "/bin/sh" #HACK(schmichael) without the ending `sleep 2` we seem to sometimes miss logs :( args = ["-c", "wc -c < secrets/nomad_token; env | grep NOMAD_TOKEN; echo done; sleep 2"] @@ -99,7 +103,8 @@ job "identity" { driver = "docker" config { - image = "bash:5" + image = "busybox:1" + command = "/bin/sh" #HACK without the ending `sleep 2` we seem to sometimes miss logs :( args = ["-c", "wc -c < local/nomad_token; env | grep NOMAD_TOKEN; echo done; sleep 2"] @@ -121,7 +126,8 @@ job "identity" { driver = "docker" config { - image = "bash:5" + image = "busybox:1" + command = "/bin/sh" #HACK(schmichael) without the ending `sleep 2` we seem to sometimes miss logs :( args = ["-c", "wc -c < secrets/nomad_token; env | grep NOMAD_TOKEN; echo done; sleep 2"] diff --git a/e2e/workload_id/input/nobody.nomad b/e2e/workload_id/input/nobody.nomad index 3ff370975..78c22c17e 100644 --- a/e2e/workload_id/input/nobody.nomad +++ b/e2e/workload_id/input/nobody.nomad @@ -23,8 +23,9 @@ job "nobodyid" { driver = "docker" config { - image = "bash:5" - args = ["-c", "stat -c 'perms=%#a username=%U' secrets/nomad_token; echo done; sleep 2"] + image = "busybox:1" + command = "/bin/sh" + args = ["-c", "stat -c 'perms=%#a username=%U' secrets/nomad_token; echo done; sleep 2"] } resources { cpu = 16 diff --git a/testutil/container_images.go b/testutil/container_images.go deleted file mode 100644 index d98f40874..000000000 --- a/testutil/container_images.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -package testutil - -import ( - "os" - "runtime" -) - -const ( - // BusyboxImageEnvName is always used, if set, by TestBusyboxImage() - BusyboxImageEnvName = "BUSYBOX_IMAGE" -) - -func TestDockerImage(name, tag string) string { - img := name + ":" + tag - if IsCI() { - // use our mirror to avoid rate-limiting in CI - img = "docker.mirror.hashicorp.services/" + img - } else { - // explicitly include docker.io for podman - img = "docker.io/" + img - } - return img -} - -func TestBusyboxImage() string { - // if env is set, use it verbatim - if img, ok := os.LookupEnv(BusyboxImageEnvName); ok { - return img - } - - // otherwise, figure it out - name := "busybox" - tag := "1" - if runtime.GOOS == "windows" { - // this image is maintained in https://github.com/hashicorp/busybox-windows - name = "hashicorpdev/busybox-windows" - tag = "server2016-0.1" - } - return TestDockerImage(name, tag) -}