@@ -43,15 +43,16 @@ type (
43
43
// It is disabled when it is empty.
44
44
Review * Review `json:"review,omitempty" yaml:"review"`
45
45
46
- FreezeWindows []FreezeWindow `json:"freeze_windows" yaml:"freeze_windows"`
46
+ // FrozenWindows is the list of windows to freeze deployments.
47
+ FrozenWindows []FrozenWindow `json:"frozen_windows" yaml:"frozen_windows"`
47
48
}
48
49
49
50
Review struct {
50
51
Enabled bool `json:"enabled" yaml:"enabled"`
51
52
Reviewers []string `json:"reviewers" yaml:"reviewers"`
52
53
}
53
54
54
- FreezeWindow struct {
55
+ FrozenWindow struct {
55
56
Start string `json:"start" yaml:"start"`
56
57
Duration string `json:"duration" yaml:"duration"`
57
58
Location string `json:"location" yaml:"location"`
@@ -184,16 +185,16 @@ func (e *Env) HasReview() bool {
184
185
// IsFreezed verifies whether the current time is in a freeze window.
185
186
// It returns an error when parsing an expression is failed.
186
187
func (e * Env ) IsFreezed (t time.Time ) (bool , error ) {
187
- if len (e .FreezeWindows ) == 0 {
188
+ if len (e .FrozenWindows ) == 0 {
188
189
return false , nil
189
190
}
190
191
191
- for _ , w := range e .FreezeWindows {
192
+ for _ , w := range e .FrozenWindows {
192
193
s , err := cronexpr .ParseInLocation (strings .TrimSpace (w .Start ), w .Location )
193
194
if err != nil {
194
195
return false , eutil .NewErrorWithMessage (
195
196
eutil .ErrorCodeConfigInvalid ,
196
- fmt .Sprintf ("The crontab expression of the freeze window is invalid." ),
197
+ fmt .Sprint ("The crontab expression of the freeze window is invalid." ),
197
198
err ,
198
199
)
199
200
}
@@ -202,7 +203,7 @@ func (e *Env) IsFreezed(t time.Time) (bool, error) {
202
203
if err != nil {
203
204
return false , eutil .NewErrorWithMessage (
204
205
eutil .ErrorCodeConfigInvalid ,
205
- fmt .Sprintf ("The duration of the freeze window is invalid." ),
206
+ fmt .Sprint ("The duration of the freeze window is invalid." ),
206
207
err ,
207
208
)
208
209
}
0 commit comments