Files
atlantis/server/events/command/result.go
Sarvar Muminov 90e92e3a13 chore: move CommandContext and CommandResult to models (#193) (#2093)
* Moved CommandContext and CommandResult to models (#193)

* Moved CommandContext and CommandResult to models

* move from models to command

rename CommandContext -> Context
rename CommandResult -> Result

* moved command related helpers into command package

* move ProjectCommandContext and ProjectResult to command/project package

* move project command context and project result

* revert unrelated code

* move tests

* fix left over

* fix linting

* fix tests

* remove unused import

* fix project context dependencies

* fix depenedecies

* fix typo
2022-03-21 10:36:13 -07:00

27 lines
693 B
Go

package command
// Result is the result of running a Command.
type Result struct {
Error error
Failure string
ProjectResults []ProjectResult
// PlansDeleted is true if all plans created during this command were
// deleted. This happens if automerging is enabled and one project has an
// error since automerging requires all plans to succeed.
PlansDeleted bool
}
// HasErrors returns true if there were any errors during the execution,
// even if it was only in one project.
func (c Result) HasErrors() bool {
if c.Error != nil || c.Failure != "" {
return true
}
for _, r := range c.ProjectResults {
if !r.IsSuccessful() {
return true
}
}
return false
}