diff --git a/cmd/osbuild-worker-executor/handler_build.go b/cmd/osbuild-worker-executor/handler_build.go index d45a5f89e..eed9b740d 100644 --- a/cmd/osbuild-worker-executor/handler_build.go +++ b/cmd/osbuild-worker-executor/handler_build.go @@ -85,6 +85,7 @@ func runOsbuild(logger *logrus.Logger, buildDir string, control *controlJSON, ou // #nosec G204 cmd = exec.Command( "tar", + "--exclude=output/output.tar", "-Scf", filepath.Join(outputDir, "output.tar"), "output", @@ -97,7 +98,10 @@ func runOsbuild(logger *logrus.Logger, buildDir string, control *controlJSON, ou _, _ = mw.Write([]byte(err.Error())) return "", err } - logger.Infof("tar output:\n%s", out) + if len(out) > 0 { + logger.Warnf("unexpected tar output:\n%s", out) + } + return outputDir, nil } diff --git a/cmd/osbuild-worker-executor/handler_build_test.go b/cmd/osbuild-worker-executor/handler_build_test.go index e9341e342..57decab58 100644 --- a/cmd/osbuild-worker-executor/handler_build_test.go +++ b/cmd/osbuild-worker-executor/handler_build_test.go @@ -81,7 +81,7 @@ func makeTestPost(t *testing.T, controlJSON, manifestJSON string) *bytes.Buffer } func TestBuildIntegration(t *testing.T) { - baseURL, baseBuildDir, _ := runTestServer(t) + baseURL, baseBuildDir, loggerHook := runTestServer(t) endpoint := baseURL + "api/v1/build" // osbuild is called with --export tree and then the manifest.json @@ -124,6 +124,11 @@ echo "fake-build-result" > %[1]s/build/output/image/disk.img assert.NoError(t, err) assert.True(t, stat.IsDir()) + // ensure tar is not generating any warnings + for _, entry := range loggerHook.Entries { + assert.NotContains(t, entry.Message, "unexpected tar output") + } + // now get the result endpoint = baseURL + "api/v1/result/image/disk.img" rsp, err = http.Get(endpoint)