convert legacy deployment event to promote event

This commit is contained in:
Brad Rydzewski 2019-07-21 10:10:14 -07:00
parent c50000a465
commit b5eadf626c
2 changed files with 15 additions and 2 deletions

View File

@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Convert legacy branch filter to ref trigger, by [@bradrydzewski](https://github.com/bradrydzewski).
- Convert legacy deployment event to promotion event, by [@bradrydzewski](https://github.com/bradrydzewski).
## [1.2.1] - 2019-07-17
### Added

View File

@ -267,13 +267,25 @@ func toConditions(from Constraints) droneyaml.Conditions {
Exclude: from.Branch.Exclude,
},
Status: droneyaml.Condition{
Include: from.Status.Include,
Exclude: from.Status.Exclude,
Include: toPromote(from.Status.Include),
Exclude: toPromote(from.Status.Exclude),
},
Matrix: from.Matrix,
}
}
// helper function finds and replaces deployment event status
// with promote status
func toPromote(events []string) []string {
for i, s := range events {
switch s {
case "deploy", "deployment":
events[i] = "promote"
}
}
return events
}
// helper function converts the legacy environment syntax
// to the new environment syntax.
func toEnvironment(from *Container) map[string]*droneyaml.Variable {