debian-forge-composer/cmd/osbuild-worker-executor/build_result.go
Michael Vogt 372d9f07dd cmd/osbuild-worker-executor: import verbatim from mvo5/oaas
This commit imports the repository https://github.com/mvo5/oaas
without keeping the history. The history is largely unimportant
and can be looked up in https://github.com/mvo5/oaas/commits/main
if needed.
2024-06-05 18:26:08 +02:00

38 lines
743 B
Go

package main
import (
"io/ioutil"
"os"
"path/filepath"
)
type buildResult struct {
resultGood string
resultBad string
}
func newBuildResult(config *Config) *buildResult {
return &buildResult{
resultGood: filepath.Join(config.BuildDirBase, "result.good"),
resultBad: filepath.Join(config.BuildDirBase, "result.bad"),
}
}
func (br *buildResult) Mark(err error) error {
if err == nil {
return ioutil.WriteFile(br.resultGood, nil, 0600)
} else {
return ioutil.WriteFile(br.resultBad, nil, 0600)
}
}
// todo: switch to (Good, Bad, Unknown)
func (br *buildResult) Good() bool {
_, err := os.Stat(br.resultGood)
return err == nil
}
func (br *buildResult) Bad() bool {
_, err := os.Stat(br.resultBad)
return err == nil
}