mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
enabled "change" status
This commit is contained in:
parent
f217b40f9a
commit
2da1728c70
2 changed files with 20 additions and 0 deletions
|
@ -133,6 +133,9 @@ func (a *Agent) prep(w *queue.Work) (*yaml.Config, error) {
|
|||
transform.Clone(conf, w.Repo.Kind)
|
||||
transform.Environ(conf, envs)
|
||||
transform.DefaultFilter(conf)
|
||||
if w.BuildLast != nil {
|
||||
transform.ChangeFilter(conf, w.BuildLast.Status)
|
||||
}
|
||||
|
||||
transform.ImageSecrets(conf, secrets, w.Build.Event)
|
||||
transform.Identifier(conf)
|
||||
|
|
|
@ -5,6 +5,23 @@ import (
|
|||
"github.com/drone/drone/yaml"
|
||||
)
|
||||
|
||||
// ChangeFilter is a transform function that alters status constraints set to
|
||||
// change and replaces with the opposite of the prior status.
|
||||
func ChangeFilter(conf *yaml.Config, prev string) {
|
||||
for _, step := range conf.Pipeline {
|
||||
for i, status := range step.Constraints.Status.Include {
|
||||
if status != "change" && status != "changed" {
|
||||
continue
|
||||
}
|
||||
if prev == model.StatusFailure {
|
||||
step.Constraints.Status.Include[i] = model.StatusSuccess
|
||||
} else {
|
||||
step.Constraints.Status.Include[i] = model.StatusFailure
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultFilter is a transform function that applies default Filters to each
|
||||
// step in the Yaml specification file.
|
||||
func DefaultFilter(conf *yaml.Config) {
|
||||
|
|
Loading…
Reference in a new issue