High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
perf(e2e): tag smoke images by a digest of their build inputs so unchanged ones are reused
Luigi Agosti5a94a39f9bd0
diff --git a/.dockerignore b/.dockerignoreindex a7cc7284..5a0637de 100644--- a/.dockerignore+++ b/.dockerignore@@ -17,6 +17,10 @@ tests/.pinchtab/.openclaw/+# Agent task board: working state, rewritten every few minutes. Not a build input,+# and leaving it in the context invalidates the COPY layer on every board write.+.alp/+# macOS.DS_Storediff --git a/TESTING.md b/TESTING.mdindex 31588530..057bfa44 100644--- a/TESTING.md+++ b/TESTING.md@@ -110,6 +110,39 @@ Runs `api-extended`, `cli-extended`, `infra-extended`, and `plugin` in sequence.Smoke is its own tier: it runs `*-smoke.sh` scenarios plus host-level Docker smoke checks, and it does not include basic or extended scenarios. Use the filtered smoke suites when you only need one smoke lane.+#### Docker image reuse++The two images the host Docker checks need are tagged by a digest of what they are built+from — the Dockerfile, the platform it is pinned to, and the content of every file in the+build context. So an image whose inputs are unchanged is already on the host under the tag+this run is asking for, and the lane reuses it; an image whose inputs changed answers a+different tag, misses, and is rebuilt. Reuse is therefore never "a tag exists, skip it":+the tag cannot exist unless it was built from exactly these bytes.++The digest is over content, not timestamps, so a checkout or a `touch` does not force a+rebuild and an edit reverted byte-for-byte returns to the original tag. `.dockerignore`+decides what counts as context, and `.alp/` is excluded there for the same reason as any+other working state: it is rewritten every few minutes and would otherwise invalidate the+image — and Docker's own `COPY` layer — on every write.++Every run states its decision per image before the checks run, so a stale-image suspicion+is answerable from the log rather than by deleting tags:++```+ image pinchtab-release-smoke:9df635add9f96cea reusing: build inputs unchanged since this image was built+ image pinchtab-chrome-cft-smoke:c20b4da906e78fdf building: no local image for these build inputs+```++Pass `--rebuild` to build regardless — that is what CI should use when it wants a cold+build. `PINCHTAB_DOCKER_SMOKE_RELEASE_IMAGE` and `PINCHTAB_DOCKER_SMOKE_CHROME_IMAGE`+still override an image outright, and such an image is never built.++**What the lane costs.** Measured locally on an arm host: the host Docker checks are ~79s+when both images have to be built and ~6s when both are reused, and a full `./dev e2e+smoke` on reused images is ~83s wall for 43 tests, the balance being the compose stack and+the smoke scenarios. The Chrome-for-Testing image is pinned `--platform linux/amd64` and+so builds under emulation on arm, which is what made the rebuild worth avoiding.+## Environment Variables| Variable | Default | Description |diff --git a/tests/tools/runner/internal/e2e/dockerimage.go b/tests/tools/runner/internal/e2e/dockerimage.gonew file mode 100644index 00000000..5ab06f67--- /dev/null+++ b/tests/tools/runner/internal/e2e/dockerimage.go@@ -0,0 +1,225 @@+package e2e++import (+ "bufio"+ "crypto/sha256"+ "encoding/hex"+ "fmt"+ "io"+ "os"+ "os/exec"+ "path/filepath"+ "sort"+ "strings"+)++// smokeImageSpec is one image the docker smoke lane needs, described by what it is built+// FROM rather than by a tag. The tag is derived from those inputs, so an image whose+// inputs changed cannot collide with the image built from the old ones.+type smokeImageSpec struct {+ Repo string+ Dockerfile string+ Platform string+ EnvVar string+}++// smokeImage is the resolved decision for one image: which tag to use, whether the lane+// has to build it, and the sentence the run prints so a stale-image suspicion is+// answerable from the log.+type smokeImage struct {+ Repo string+ Tag string+ Build bool+ Reason string+}++func (i smokeImage) Ref() string {+ if i.Tag == "" {+ return i.Repo+ }+ return i.Repo + ":" + i.Tag+}++// resolveSmokeImage decides whether the lane builds this image or reuses one already on+// the host. The tag IS the digest of the build inputs, so "an image with this tag exists"+// and "the inputs are unchanged" are the same question — a stale image cannot answer it,+// because different inputs produce a different tag and therefore a miss.+func (r *Runner) resolveSmokeImage(spec smokeImageSpec, exists func(ref string) bool) smokeImage {+ if custom := strings.TrimSpace(os.Getenv(spec.EnvVar)); custom != "" {+ return smokeImage{Repo: custom, Reason: "reusing: supplied via " + spec.EnvVar}+ }++ if r.args.DryRun {+ return smokeImage{Repo: spec.Repo, Tag: "dry-run", Build: true, Reason: "building: dry run does not inspect local images"}+ }++ digest, err := buildInputsDigest(r.repoRoot, spec)+ if err != nil {+ return smokeImage{+ Repo: spec.Repo,+ Tag: "no-digest",+ Build: true,+ Reason: fmt.Sprintf("building: could not digest the build inputs (%v)", err),+ }+ }++ image := smokeImage{Repo: spec.Repo, Tag: digest}+ switch {+ case r.args.Rebuild:+ image.Build = true+ image.Reason = "building: --rebuild was requested"+ case exists(image.Ref()):+ image.Reason = "reusing: build inputs unchanged since this image was built"+ default:+ image.Build = true+ image.Reason = "building: no local image for these build inputs"+ }+ return image+}++func (r *Runner) localImageExists(ref string) bool {+ cmd := exec.Command("docker", "image", "inspect", ref) // #nosec G204 -- ref is derived from a fixed repo name and a hex digest+ cmd.Dir = r.repoRoot+ return cmd.Run() == nil+}++// buildInputsDigest hashes everything `docker build` would consume for this image: the+// Dockerfile, the platform it is pinned to, and the content of every file in the build+// context. Content, not mtime — a checkout, a stash pop or a touch must not read as a+// change, and an edit that restores a file byte-for-byte must not read as one either.+func buildInputsDigest(repoRoot string, spec smokeImageSpec) (string, error) {+ excluded, err := contextExcludedDirs(filepath.Join(repoRoot, dockerIgnoreFile))+ if err != nil {+ return "", err+ }++ sum := sha256.New()+ _, _ = fmt.Fprintf(sum, "dockerfile:%s\nplatform:%s\n", spec.Dockerfile, spec.Platform)++ // The Dockerfile is hashed by name AND content here rather than being left to the+ // context walk, because -f can point outside the context: the CFT Dockerfile lives+ // under tests/, which .dockerignore excludes, so the walk never reaches the one file+ // whose every line is a build input.+ dockerfileSum, err := fileDigest(filepath.Join(repoRoot, spec.Dockerfile))+ if err != nil {+ return "", err+ }+ _, _ = fmt.Fprintf(sum, "dockerfile-content:%s\n", dockerfileSum)++ files, err := contextFiles(repoRoot, excluded)+ if err != nil {+ return "", err+ }+ for _, rel := range files {+ fileSum, err := fileDigest(filepath.Join(repoRoot, rel))+ if err != nil {+ return "", err+ }+ _, _ = fmt.Fprintf(sum, "%s %s\n", fileSum, rel)+ }+ return hex.EncodeToString(sum.Sum(nil))[:16], nil+}++const dockerIgnoreFile = ".dockerignore"++// contextExcludedDirs reads the directory prefixes .dockerignore excludes. It deliberately+// understands only unnegated `dir/` entries and treats every other pattern as included.+//+// The asymmetry is the point. Digesting a file docker ignores costs a rebuild that was not+// strictly needed, and the run says so. MISSING a file docker sends is a stale image+// passing a run it should have failed — silent, and the exact failure this card warns+// about. So anything this parser cannot decide exactly is included.+func contextExcludedDirs(path string) (map[string]bool, error) {+ file, err := os.Open(path) // #nosec G304 -- path is the repo's own .dockerignore+ if os.IsNotExist(err) {+ return map[string]bool{}, nil+ }+ if err != nil {+ return nil, err+ }+ defer func() { _ = file.Close() }()++ var dirs []string+ var negated []string+ scanner := bufio.NewScanner(file)+ for scanner.Scan() {+ line := strings.TrimSpace(scanner.Text())+ if line == "" || strings.HasPrefix(line, "#") {+ continue+ }+ if after, ok := strings.CutPrefix(line, "!"); ok {+ negated = append(negated, strings.TrimSpace(after))+ continue+ }+ if strings.HasSuffix(line, "/") && !strings.ContainsAny(line, "*?[") {+ dirs = append(dirs, strings.TrimSuffix(line, "/"))+ }+ }+ if err := scanner.Err(); err != nil {+ return nil, err+ }++ excluded := map[string]bool{}+ for _, dir := range dirs {+ if !anyNegationReaches(dir, negated) {+ excluded[dir] = true+ }+ }+ return excluded, nil+}++func anyNegationReaches(dir string, negated []string) bool {+ for _, n := range negated {+ if n == dir || strings.HasPrefix(n, dir+"/") {+ return true+ }+ }+ return false+}++func contextFiles(repoRoot string, excludedDirs map[string]bool) ([]string, error) {+ var files []string+ err := filepath.WalkDir(repoRoot, func(path string, entry os.DirEntry, err error) error {+ if err != nil {+ return err+ }+ rel, relErr := filepath.Rel(repoRoot, path)+ if relErr != nil {+ return relErr+ }+ rel = filepath.ToSlash(rel)+ if rel == "." {+ return nil+ }+ if entry.IsDir() {+ if excludedDirs[rel] || excludedDirs[filepath.Base(rel)] {+ return filepath.SkipDir+ }+ return nil+ }+ if entry.Type()&os.ModeSymlink != 0 {+ return nil+ }+ files = append(files, rel)+ return nil+ })+ if err != nil {+ return nil, err+ }+ sort.Strings(files)+ return files, nil+}++func fileDigest(path string) (string, error) {+ file, err := os.Open(path) // #nosec G304 -- path comes from walking the repo's own build context+ if err != nil {+ return "", err+ }+ defer func() { _ = file.Close() }()++ sum := sha256.New()+ if _, err := io.Copy(sum, file); err != nil {+ return "", err+ }+ return hex.EncodeToString(sum.Sum(nil)), nil+}diff --git a/tests/tools/runner/internal/e2e/dockerimage_test.go b/tests/tools/runner/internal/e2e/dockerimage_test.gonew file mode 100644index 00000000..836a491c--- /dev/null+++ b/tests/tools/runner/internal/e2e/dockerimage_test.go@@ -0,0 +1,265 @@+package e2e++import (+ "bytes"+ "os"+ "path/filepath"+ "strings"+ "testing"+ "time"+)++func writeProbeContext(t *testing.T) string {+ t.Helper()+ root := t.TempDir()+ for path, body := range map[string]string{+ ".dockerignore": "# comment\ntests/\nnode_modules/\ndocs/\n!docs/examples/\n*.md\n",+ "Dockerfile": "FROM alpine\nCOPY . .\n",+ "main.go": "package main\n",+ "scripts/build.sh": "echo build\n",+ "tests/e2e/scenarios/probe.sh": "echo scenario\n",+ "tests/tools/docker/cft.Dockerfile": "FROM ubuntu\nARG VERSION=1\n",+ "docs/examples/enrich/main.go": "package main\n",+ "node_modules/dep/index.js": "module.exports = 1\n",+ } {+ full := filepath.Join(root, filepath.FromSlash(path))+ if err := os.MkdirAll(filepath.Dir(full), 0o755); err != nil {+ t.Fatal(err)+ }+ if err := os.WriteFile(full, []byte(body), 0o600); err != nil {+ t.Fatal(err)+ }+ }+ return root+}++var probeSpec = smokeImageSpec{Repo: "probe-image", Dockerfile: "Dockerfile"}++var probeCFTSpec = smokeImageSpec{+ Repo: "probe-cft",+ Dockerfile: "tests/tools/docker/cft.Dockerfile",+ Platform: "linux/amd64",+}++func digestOf(t *testing.T, root string, spec smokeImageSpec) string {+ t.Helper()+ digest, err := buildInputsDigest(root, spec)+ if err != nil {+ t.Fatalf("buildInputsDigest: %v", err)+ }+ if digest == "" {+ t.Fatal("empty digest")+ }+ return digest+}++func writeFile(t *testing.T, root, rel, body string) {+ t.Helper()+ if err := os.WriteFile(filepath.Join(root, filepath.FromSlash(rel)), []byte(body), 0o600); err != nil {+ t.Fatal(err)+ }+}++// "Unchanged" has to mean the bytes are the same, not that nothing was touched. A+// checkout, a stash pop or a rebuild of a generated file all move mtimes without changing+// what docker would put in the image, and an mtime-keyed cache rebuilds on every one of+// them — which is the cost this card exists to remove.+func TestBuildInputDigestTracksContentNotTimestamps(t *testing.T) {+ root := writeProbeContext(t)+ before := digestOf(t, root, probeSpec)++ future := time.Now().Add(2 * time.Hour)+ if err := os.Chtimes(filepath.Join(root, "main.go"), future, future); err != nil {+ t.Fatal(err)+ }+ if after := digestOf(t, root, probeSpec); after != before {+ t.Errorf("touching a file changed the digest (%s -> %s); the lane would rebuild for a file whose content is identical", before, after)+ }++ writeFile(t, root, "main.go", "package main // edited\n")+ edited := digestOf(t, root, probeSpec)+ if edited == before {+ t.Fatal("editing a context file did not change the digest; a stale image would be reused for changed inputs")+ }++ writeFile(t, root, "main.go", "package main\n")+ if restored := digestOf(t, root, probeSpec); restored != before {+ t.Errorf("restoring the original bytes did not restore the digest (%s != %s)", restored, before)+ }+}++// The digest must cover the Dockerfile itself even when it lives somewhere the context+// walk never reaches — `docker build -f` happily points outside the context, and the CFT+// Dockerfile sits under tests/, which .dockerignore excludes.+func TestBuildInputDigestCoversADockerfileOutsideTheContext(t *testing.T) {+ root := writeProbeContext(t)+ before := digestOf(t, root, probeCFTSpec)++ writeFile(t, root, "tests/tools/docker/cft.Dockerfile", "FROM ubuntu\nARG VERSION=2\n")+ if after := digestOf(t, root, probeCFTSpec); after == before {+ t.Fatal("editing the Dockerfile did not change the digest, so a changed Dockerfile would silently reuse the image built from the old one")+ }+}++func TestBuildInputDigestSeparatesImagesBuiltFromTheSameContext(t *testing.T) {+ root := writeProbeContext(t)+ if digestOf(t, root, probeSpec) == digestOf(t, root, probeCFTSpec) {+ t.Error("two images with different Dockerfiles and platforms share a digest, so one would reuse the other's image")+ }+}++// A file docker never sends must not force a rebuild — that is the whole saving, since+// the smoke scenarios under tests/ are the files that change most often. Everything the+// .dockerignore parser cannot decide exactly stays IN the digest, because over-rebuilding+// is loud and cheap while under-rebuilding is a stale image passing a run it should fail.+func TestBuildInputDigestFollowsTheDockerignoreOnlyWhereItIsUnambiguous(t *testing.T) {+ root := writeProbeContext(t)+ before := digestOf(t, root, probeSpec)++ for _, tc := range []struct {+ name string+ file string+ body string+ wantChange bool+ }{+ {+ name: "a plainly excluded directory does not affect the digest",+ file: "tests/e2e/scenarios/probe.sh", body: "echo edited\n", wantChange: false,+ },+ {+ name: "an excluded directory nested anywhere does not affect the digest",+ file: "node_modules/dep/index.js", body: "module.exports = 2\n", wantChange: false,+ },+ {+ name: "a directory with a negation stays in the digest, because the negation puts part of it back",+ file: "docs/examples/enrich/main.go", body: "package main // edited\n", wantChange: true,+ },+ {+ name: "the .dockerignore itself is an input: changing what is excluded changes the image",+ file: ".dockerignore", body: "# comment\nnode_modules/\ndocs/\n!docs/examples/\n*.md\n", wantChange: true,+ },+ } {+ t.Run(tc.name, func(t *testing.T) {+ root := writeProbeContext(t)+ writeFile(t, root, tc.file, tc.body)+ changed := digestOf(t, root, probeSpec) != before+ if changed != tc.wantChange {+ t.Errorf("editing %s changed the digest = %v, want %v", tc.file, changed, tc.wantChange)+ }+ })+ }+}++func probeRunner(t *testing.T, root string, args Args) *Runner {+ t.Helper()+ return &Runner{args: args, repoRoot: root, stdout: &bytes.Buffer{}, stderr: &bytes.Buffer{}}+}++func TestSmokeImageIsReusedOnlyWhenAnImageForTheseInputsExists(t *testing.T) {+ root := writeProbeContext(t)+ digest := digestOf(t, root, probeSpec)+ present := func(ref string) bool { return ref == "probe-image:"+digest }+ absent := func(string) bool { return false }++ reused := probeRunner(t, root, Args{}).resolveSmokeImage(probeSpec, present)+ if reused.Build {+ t.Errorf("rebuilt an image whose inputs are unchanged: %s", reused.Reason)+ }+ if reused.Ref() != "probe-image:"+digest {+ t.Errorf("ref = %q, want the digest-tagged image", reused.Ref())+ }++ missing := probeRunner(t, root, Args{}).resolveSmokeImage(probeSpec, absent)+ if !missing.Build {+ t.Error("reused an image that is not on the host")+ }++ // The tag IS the digest, so an image built from different inputs cannot be mistaken+ // for this one: it answers a different tag and the lookup misses.+ writeFile(t, root, "main.go", "package main // edited\n")+ changed := probeRunner(t, root, Args{}).resolveSmokeImage(probeSpec, present)+ if !changed.Build {+ t.Errorf("reused the image built from the OLD inputs after the context changed: %s", changed.Reason)+ }+}++func TestRebuildFlagBuildsEvenWhenTheImageIsAlreadyThere(t *testing.T) {+ root := writeProbeContext(t)+ always := func(string) bool { return true }++ image := probeRunner(t, root, Args{Rebuild: true}).resolveSmokeImage(probeSpec, always)+ if !image.Build {+ t.Error("--rebuild did not force a build")+ }+ if !strings.Contains(image.Reason, "--rebuild") {+ t.Errorf("reason = %q, want it to name --rebuild", image.Reason)+ }+}++func TestSmokeImageSuppliedByEnvIsNeverBuilt(t *testing.T) {+ t.Setenv(releaseSmokeImageSpec.EnvVar, "my-own:tag")+ image := probeRunner(t, writeProbeContext(t), Args{}).resolveSmokeImage(releaseSmokeImageSpec, func(string) bool { return false })+ if image.Build {+ t.Error("built over an image the operator supplied")+ }+ if image.Ref() != "my-own:tag" {+ t.Errorf("ref = %q, want the supplied image", image.Ref())+ }+}++// A suspicion that a run used a stale image has to be answerable from the log. Every+// decision therefore carries a reason, and every reason says which way it went.+func TestEveryImageDecisionExplainsItself(t *testing.T) {+ root := writeProbeContext(t)+ for _, tc := range []struct {+ name string+ args Args+ exists func(string) bool+ want string+ }{+ {name: "reuse", args: Args{}, exists: func(string) bool { return true }, want: "reusing:"},+ {name: "build", args: Args{}, exists: func(string) bool { return false }, want: "building:"},+ {name: "forced", args: Args{Rebuild: true}, exists: func(string) bool { return true }, want: "building:"},+ } {+ t.Run(tc.name, func(t *testing.T) {+ image := probeRunner(t, root, tc.args).resolveSmokeImage(probeSpec, tc.exists)+ if !strings.HasPrefix(image.Reason, tc.want) {+ t.Errorf("reason = %q, want it to start with %q", image.Reason, tc.want)+ }+ })+ }+}++// An unreadable build input must not silently become "nothing changed". Failing closed+// costs a rebuild; failing open ships a stale image.+func TestAnUndigestableInputForcesABuildRatherThanAReuse(t *testing.T) {+ root := writeProbeContext(t)+ missing := smokeImageSpec{Repo: "probe-image", Dockerfile: "no/such/Dockerfile"}++ image := probeRunner(t, root, Args{}).resolveSmokeImage(missing, func(string) bool { return true })+ if !image.Build {+ t.Error("reused an image although the build inputs could not be digested")+ }+ if !strings.Contains(image.Reason, "could not digest") {+ t.Errorf("reason = %q, want it to say the digest failed", image.Reason)+ }+}++// AC-4 is only met if the decision reaches the RUN OUTPUT. A reason field nothing prints+// leaves a stale-image suspicion exactly where it was: answerable only by deleting tags.+func TestDockerSmokeRunNamesEachImageAndWhy(t *testing.T) {+ var stdout, stderr bytes.Buffer+ if code := Run([]string{"--suite", "smoke", "--filter", "docker", "--dry-run"}, &stdout, &stderr); code != 0 {+ t.Fatalf("Run returned %d, stderr: %s", code, stderr.String())+ }+ out := stdout.String()+ for _, want := range []string{+ "image pinchtab-release-smoke:dry-run",+ "image pinchtab-chrome-cft-smoke:dry-run",+ "building: dry run does not inspect local images",+ } {+ if !strings.Contains(out, want) {+ t.Errorf("the run does not state the image decision %q:\n%s", want, out)+ }+ }+}diff --git a/tests/tools/runner/internal/e2e/e2e.go b/tests/tools/runner/internal/e2e/e2e.goindex 76ecd1a0..ea13eefe 100644--- a/tests/tools/runner/internal/e2e/e2e.go+++ b/tests/tools/runner/internal/e2e/e2e.go@@ -19,6 +19,7 @@ type Args struct {Provider stringProviders []string // resolved list; len>1 means matrix modeSlowest int+ Rebuild boolDryRun bool}@@ -54,6 +55,10 @@ Options:--slowest N Report only: print the N slowest tests and theper-scenario totals from results/timings-<suite>.json.Runs nothing and needs no Docker.+ --rebuild Rebuild the docker smoke images even when their build+ inputs are unchanged. The lane otherwise reuses an+ image already built from the same Dockerfile and+ context, which is what makes a repeat run cheap.--dry-run Print the compose plan without running it--help, -h Show this help`@@ -198,6 +203,8 @@ func ParseArgs(argv []string) (Args, error) {return args, fmt.Errorf("--slowest must be a positive whole number (got %q)", v)}args.Slowest = n+ case "--rebuild":+ args.Rebuild = truecase "--dry-run":args.DryRun = truedefault:diff --git a/tests/tools/runner/internal/e2e/runner.go b/tests/tools/runner/internal/e2e/runner.goindex ff8cdfba..12f952a0 100644--- a/tests/tools/runner/internal/e2e/runner.go+++ b/tests/tools/runner/internal/e2e/runner.go@@ -297,7 +297,8 @@ func (r *Runner) runSmokeLane(l lane) int {if code != 0 {return code}- dockerSteps := r.selectedDockerSmokeSteps()+ docker := r.selectedDockerSmokePlan()+ dockerSteps := docker.stepsif len(plans) == 0 && len(dockerSteps) == 0 {return r.reportNoSuitesMatched(l)}@@ -318,7 +319,7 @@ func (r *Runner) runSmokeLane(l lane) int {}if len(dockerSteps) > 0 {- if code := r.runDockerSmokeSteps(dockerSteps); code != 0 {+ if code := r.runDockerSmokeSteps(docker); code != 0 {codes[dockerSmokeSuite().Name] = code}_, _ = fmt.Fprintln(r.stdout, "")@@ -327,14 +328,18 @@ func (r *Runner) runSmokeLane(l lane) int {return r.reportLaneOutcome(l, codes, otherFailure)}-func (r *Runner) runDockerSmokeSteps(steps []dockerSmokeStep) int {+func (r *Runner) runDockerSmokeSteps(plan dockerSmokePlan) int {def := dockerSmokeSuite()r.printSuiteStart(def)+ for _, image := range plan.images {+ _, _ = fmt.Fprintf(r.stdout, " image %-32s %s\n", image.Ref(), image.Reason)+ }+ _, _ = fmt.Fprintln(r.stdout, "")r.prepareSuiteResults(def)started := time.Now()exitCode := 0- for _, step := range steps {+ for _, step := range plan.steps {stepStarted := time.Now()code := r.runLoggedCommand("running "+step.Name, def.Output, step.Command)status := "passed"@@ -363,14 +368,40 @@ func (r *Runner) runDockerSmokeSteps(steps []dockerSmokeStep) int {return exitCode}-func (r *Runner) selectedDockerSmokeSteps() []dockerSmokeStep {- return selectDockerSmokeSteps(r.dockerSmokeSteps(), r.args.Filter)+// dockerSmokePlan is the docker smoke lane's steps together with the image decisions that+// produced them, so the run can state per image whether it built or reused and why.+type dockerSmokePlan struct {+ steps []dockerSmokeStep+ images []smokeImage+}++var (+ releaseSmokeImageSpec = smokeImageSpec{+ Repo: "pinchtab-release-smoke",+ Dockerfile: "Dockerfile",+ EnvVar: "PINCHTAB_DOCKER_SMOKE_RELEASE_IMAGE",+ }+ chromeSmokeImageSpec = smokeImageSpec{+ Repo: "pinchtab-chrome-cft-smoke",+ Dockerfile: "tests/tools/docker/chrome-cft-smoke.Dockerfile",+ Platform: "linux/amd64",+ EnvVar: "PINCHTAB_DOCKER_SMOKE_CHROME_IMAGE",+ }+)++func (r *Runner) selectedDockerSmokePlan() dockerSmokePlan {+ plan := r.dockerSmokePlan()+ plan.steps = selectDockerSmokeSteps(plan.steps, r.args.Filter)+ return plan}-func (r *Runner) dockerSmokeSteps() []dockerSmokeStep {- releaseImage, chromeImage, customReleaseImage, customChromeImage := r.dockerSmokeImages()+func (r *Runner) dockerSmokePlan() dockerSmokePlan {+ release := r.resolveSmokeImage(releaseSmokeImageSpec, r.localImageExists)+ chrome := r.resolveSmokeImage(chromeSmokeImageSpec, r.localImageExists)+ releaseImage, chromeImage := release.Ref(), chrome.Ref()+steps := []dockerSmokeStep{}- if !customReleaseImage {+ if release.Build {steps = append(steps, dockerSmokeStep{Name: "docker: build release image",Tags: []string{"docker", "build", "release", "image"},@@ -378,11 +409,11 @@ func (r *Runner) dockerSmokeSteps() []dockerSmokeStep {ProvidesReleaseImage: true,})}- if !customChromeImage {+ if chrome.Build {steps = append(steps, dockerSmokeStep{Name: "docker: build Chrome for Testing image",Tags: []string{"docker", "build", "chrome", "cft", "image"},- Command: []string{"docker", "build", "--load", "--platform", "linux/amd64", "-f", "tests/tools/docker/chrome-cft-smoke.Dockerfile", "-t", chromeImage, "."},+ Command: []string{"docker", "build", "--load", "--platform", chromeSmokeImageSpec.Platform, "-f", chromeSmokeImageSpec.Dockerfile, "-t", chromeImage, "."},ProvidesChromeImage: true,})}@@ -412,33 +443,7 @@ func (r *Runner) dockerSmokeSteps() []dockerSmokeStep {RequiresReleaseImage: true,},)- return steps-}--func (r *Runner) dockerSmokeImages() (releaseImage, chromeImage string, customReleaseImage, customChromeImage bool) {- suffix := strings.TrimSpace(os.Getenv("PINCHTAB_DOCKER_SMOKE_TAG_SUFFIX"))- if suffix == "" {- if r.args.DryRun {- suffix = "dry-run"- } else {- suffix = fmt.Sprintf("%d", time.Now().UnixNano())- }- }-- releaseImage = strings.TrimSpace(os.Getenv("PINCHTAB_DOCKER_SMOKE_RELEASE_IMAGE"))- if releaseImage == "" {- releaseImage = "pinchtab-release-smoke:" + suffix- } else {- customReleaseImage = true- }-- chromeImage = strings.TrimSpace(os.Getenv("PINCHTAB_DOCKER_SMOKE_CHROME_IMAGE"))- if chromeImage == "" {- chromeImage = "pinchtab-chrome-cft-smoke:" + suffix- } else {- customChromeImage = true- }- return releaseImage, chromeImage, customReleaseImage, customChromeImage+ return dockerSmokePlan{steps: steps, images: []smokeImage{release, chrome}}}func selectDockerSmokeSteps(steps []dockerSmokeStep, filter string) []dockerSmokeStep {