mirror of
https://github.com/thegeeklab/drone-yaml.git
synced 2024-11-24 19:10:40 +00:00
convert legacy deployment event to promote event
This commit is contained in:
parent
c50000a465
commit
b5eadf626c
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user