From 0df87ab1117bf4da5163ad486a82628f1bada7ed Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 6 Jan 2026 23:34:43 +0900 Subject: internal/pkg: automatic overlay mount on tmp This sets up the last Artifact to target /tmp as a writable overlay mount backed by the host side temp directory. This is useful for an Artifact containing source code to be built for another Artifact for example. Signed-off-by: Ophestra --- internal/pkg/testdata/main.go | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'internal/pkg/testdata') diff --git a/internal/pkg/testdata/main.go b/internal/pkg/testdata/main.go index bbf23400..4f3d047e 100644 --- a/internal/pkg/testdata/main.go +++ b/internal/pkg/testdata/main.go @@ -39,11 +39,19 @@ func main() { if !slices.Equal(wantEnv, os.Environ()) { log.Fatalf("Environ: %q, want %q", os.Environ(), wantEnv) } - const wantExec = "/opt/bin/testtool" + + var overlayTmp bool + const ( + wantExec = "/opt/bin/testtool" + wantExecOverlay = "/tmp/bin/testtool" + ) if got, err := os.Executable(); err != nil { log.Fatalf("Executable: error = %v", err) } else if got != wantExec { - log.Fatalf("Executable: %q, want %q", got, wantExec) + if got != wantExecOverlay { + log.Fatalf("Executable: %q, want %q", got, wantExec) + } + overlayTmp = true } wantHostname := "cure" @@ -105,7 +113,6 @@ func main() { if path.Base(lowerdir) != checksumEmptyDir { log.Fatal("unexpected artifact checksum") } - } else { if hostNet { ident = "I3T53NtN6HPAyyodHtq2B0clcsoS1nPdvCEb-Zc5K-hoqFGL2od1mftHhwG7gX1S" @@ -126,7 +133,16 @@ func main() { } } - next() // testtool artifact + if !overlayTmp { + next() // testtool artifact + } else { + ident = "3ELJ8l42g6XeIoLGR9LheVhMIwSIleD6VrhsliBuon5DAdBOwFSMqd7aiUI4fll7" + + next() + if path.Base(m.Root) != checksumEmptyDir || m.Target != "/tmp" { + log.Fatal("unexpected artifact checksum") + } + } next() if path.Base(m.Root) != ident || m.Target != "/work" { @@ -134,8 +150,16 @@ func main() { } next() - if path.Base(m.Root) != ident || m.Target != "/tmp" { - log.Fatal("unexpected temp mount entry") + if !overlayTmp { + if path.Base(m.Root) != ident || m.Target != "/tmp" { + log.Fatal("unexpected temp mount entry") + } + } else { + // testtool artifact + if m.Root != "/" || m.Target != "/tmp" || + m.Source != "overlay" || m.FsType != "overlay" { + log.Fatal("unexpected temp mount entry") + } } next() -- cgit v1.3.1