mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-01 03:38:44 +00:00
* 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
28 lines
982 B
Go
28 lines
982 B
Go
package events
|
|
|
|
import (
|
|
"github.com/runatlantis/atlantis/server/core/db"
|
|
"github.com/runatlantis/atlantis/server/events/command"
|
|
"github.com/runatlantis/atlantis/server/events/models"
|
|
)
|
|
|
|
type DBUpdater struct {
|
|
DB *db.BoltDB
|
|
}
|
|
|
|
func (c *DBUpdater) updateDB(ctx *command.Context, pull models.PullRequest, results []command.ProjectResult) (models.PullStatus, error) {
|
|
// Filter out results that errored due to the directory not existing. We
|
|
// don't store these in the database because they would never be "apply-able"
|
|
// and so the pull request would always have errors.
|
|
var filtered []command.ProjectResult
|
|
for _, r := range results {
|
|
if _, ok := r.Error.(DirNotExistErr); ok {
|
|
ctx.Log.Debug("ignoring error result from project at dir %q workspace %q because it is dir not exist error", r.RepoRelDir, r.Workspace)
|
|
continue
|
|
}
|
|
filtered = append(filtered, r)
|
|
}
|
|
ctx.Log.Debug("updating DB with pull results")
|
|
return c.DB.UpdatePullWithResults(pull, filtered)
|
|
}
|