2021-12-22 13:52:09 -06:00
|
|
|
package model
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
type stepStatus int
|
|
|
|
|
|
|
|
const (
|
|
|
|
StepStatusSuccess stepStatus = iota
|
|
|
|
StepStatusFailure
|
2022-01-21 10:10:26 -06:00
|
|
|
StepStatusSkipped
|
2021-12-22 13:52:09 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
var stepStatusStrings = [...]string{
|
|
|
|
"success",
|
|
|
|
"failure",
|
2022-01-21 10:10:26 -06:00
|
|
|
"skipped",
|
2021-12-22 13:52:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s stepStatus) MarshalText() ([]byte, error) {
|
|
|
|
return []byte(s.String()), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *stepStatus) UnmarshalText(b []byte) error {
|
|
|
|
str := string(b)
|
|
|
|
for i, name := range stepStatusStrings {
|
|
|
|
if name == str {
|
|
|
|
*s = stepStatus(i)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return fmt.Errorf("invalid step status %q", str)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s stepStatus) String() string {
|
|
|
|
if int(s) >= len(stepStatusStrings) {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return stepStatusStrings[s]
|
|
|
|
}
|
|
|
|
|
|
|
|
type StepResult struct {
|
|
|
|
Outputs map[string]string `json:"outputs"`
|
|
|
|
Conclusion stepStatus `json:"conclusion"`
|
|
|
|
Outcome stepStatus `json:"outcome"`
|
|
|
|
}
|