mirror of
https://github.com/thegeeklab/drone-yaml.git
synced 2024-11-25 11:30:41 +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
|
## Unreleased
|
||||||
### Added
|
### Added
|
||||||
- Convert legacy branch filter to ref trigger, by [@bradrydzewski](https://github.com/bradrydzewski).
|
- 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
|
## [1.2.1] - 2019-07-17
|
||||||
### Added
|
### Added
|
||||||
|
@ -267,13 +267,25 @@ func toConditions(from Constraints) droneyaml.Conditions {
|
|||||||
Exclude: from.Branch.Exclude,
|
Exclude: from.Branch.Exclude,
|
||||||
},
|
},
|
||||||
Status: droneyaml.Condition{
|
Status: droneyaml.Condition{
|
||||||
Include: from.Status.Include,
|
Include: toPromote(from.Status.Include),
|
||||||
Exclude: from.Status.Exclude,
|
Exclude: toPromote(from.Status.Exclude),
|
||||||
},
|
},
|
||||||
Matrix: from.Matrix,
|
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
|
// helper function converts the legacy environment syntax
|
||||||
// to the new environment syntax.
|
// to the new environment syntax.
|
||||||
func toEnvironment(from *Container) map[string]*droneyaml.Variable {
|
func toEnvironment(from *Container) map[string]*droneyaml.Variable {
|
||||||
|
Loading…
Reference in New Issue
Block a user