diff --git a/dib/build.go b/dib/build.go index 1ca3f8b2..ccd5884c 100644 --- a/dib/build.go +++ b/dib/build.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path" + "strings" "sync" "time" @@ -140,7 +141,7 @@ func doRebuild(img *dag.Image, builder types.ImageBuilder, rateLimiter ratelimit if err := os.MkdirAll("dist/logs", 0o755); err != nil { return fmt.Errorf("could not create directory %s: %w", "dist/logs", err) } - filePath := path.Join("dist/logs", fmt.Sprintf("%s.txt", img.ShortName)) + filePath := path.Join("dist/logs", fmt.Sprintf("%s.txt", strings.ReplaceAll(img.ShortName, "/", "_"))) fileOutput, err := os.Create(filePath) if err != nil { return fmt.Errorf("failed to create file %s: %w", filePath, err) diff --git a/goss/runner.go b/goss/runner.go index d0a75c7d..a13539bf 100644 --- a/goss/runner.go +++ b/goss/runner.go @@ -97,7 +97,8 @@ func (b TestRunner) exportJunitReport(opts types.RunTestOptions, stdout string, return fmt.Errorf("could not create directory %s: %w", testRunner.ReportsDirectory, err) } - junitFilename := path.Join(testRunner.ReportsDirectory, fmt.Sprintf("junit-%s.xml", opts.ImageName)) + junitFilename := path.Join(testRunner.ReportsDirectory, + fmt.Sprintf("junit-%s.xml", strings.ReplaceAll(opts.ImageName, "/", "_"))) if err := ioutil.WriteFile(junitFilename, []byte(stdout), 0o644); err != nil { // nolint: gosec return fmt.Errorf("could not write junit report to file %s: %w", junitFilename, err) }