Hi, not sure if what I am doing is somewhat going against the grain of what dagger is designed for but looking for some advice. Essentially I am building a DevelopmentDeploy dagger call and part of this function call it will test some go code. If this errors I want the dagger call to exit with an error so my CI will fail but still have the junit test results available. The only way I seem to see this working is gracefully exiting without an error, check a returned exit status and then running again to pull the artifact out. This would then need me to manually throw an error in CI.
func (d *DaggerDemo) DeployDevelopment(
ctx context.Context,
src *dagger.Directory,
) (*dagger.Directory, error) {
output := dag.Directory()
result := dag.Golang(src).Test()
testResult := result.Junit()
if testResult != nil {
output = output.WithFile(
"unit-tests.xml",
testResult,
)
}
_, err = result.Stdout(ctx)
if err != nil {
// if I dont return this err then CI will not fail.
// If I return this I cant get the test result outputs
return output, err
}
// further deployment steps each output artifacts to the output directory
return output, nil
}
Thanks!