Skip to content

Validation added for initialScale greater than maxScale (#14153) #9155

Validation added for initialScale greater than maxScale (#14153)

Validation added for initialScale greater than maxScale (#14153) #9155

Re-run triggered January 12, 2024 18:55
Status Failure
Total duration 3m 34s
Artifacts

knative-style.yaml

on: pull_request
style  /  changes
3s
style / changes
style  /  ...  /  Auto-format and Check
12s
style / Golang / Auto-format and Check
style  /  ...  /  Lint
3m 13s
style / Golang / Lint
style  /  ...  /  Do Not Submit
6s
style / Golang / Do Not Submit
style  /  ...  /  shell
0s
style / suggester / shell
style  /  ...  /  yaml
0s
style / suggester / yaml
style  /  ...  /  github_actions
0s
style / suggester / github_actions
Matrix: style / Golang / Boilerplate Check
Fit to window
Zoom out
Zoom in

Annotations

8 errors and 10 warnings
style / Golang / Auto-format and Check: pkg/apis/autoscaling/annotation_validation.go#L1
Please run goimports. diff --git a/pkg/apis/autoscaling/annotation_validation.go b/pkg/apis/autoscaling/annotation_validation.go index 1e31e17..8de680f 100644 --- a/pkg/apis/autoscaling/annotation_validation.go +++ b/pkg/apis/autoscaling/annotation_validation.go @@ -276,36 +276,35 @@ func validateInitialScale(config *autoscalerconfig.Config, m map[string]string) return nil } -func validateMaxInitialScale(config *autoscalerconfig.Config, m map[string]string) *apis.FieldError{ +func validateMaxInitialScale(config *autoscalerconfig.Config, m map[string]string) *apis.FieldError { - max,errs := getIntGE0(m,MaxScaleAnnotation) - initial,err := getIntGE0(m, InitialScaleAnnotation) + max, errs := getIntGE0(m, MaxScaleAnnotation) + initial, err := getIntGE0(m, InitialScaleAnnotation) - errs= errs.Also(err) - - if (initial<0){ - errs=errs.Also(&apis.FieldError{ + errs = errs.Also(err) + + if initial < 0 { + errs = errs.Also(&apis.FieldError{ Message: fmt.Sprintf("initial-scale=%d should be greater than 0", initial), - Paths: []string{MaxScaleAnnotationKey,InitialScaleAnnotationKey}, + Paths: []string{MaxScaleAnnotationKey, InitialScaleAnnotationKey}, }) - }else if !config.AllowZeroInitialScale && initial==0 { - errs=errs.Also(&apis.FieldError{ + } else if !config.AllowZeroInitialScale && initial == 0 { + errs = errs.Also(&apis.FieldError{ Message: fmt.Sprintf("initial-scale=%d not allowed by cluster", initial), - Paths: []string{MaxScaleAnnotationKey,InitialScaleAnnotationKey}, + Paths: []string{MaxScaleAnnotationKey, InitialScaleAnnotationKey}, }) - }else if max<=0{ - errs=errs.Also(&apis.FieldError{ - Message: fmt.Sprintf("max-scale=%d should be greate than 0",max), - Paths: []string{MaxScaleAnnotationKey,InitialScaleAnnotationKey}, + } else if max <= 0 { + errs = errs.Also(&apis.FieldError{ + Message: fmt.Sprintf("max-scale=%d should be greate than 0", max), + Paths: []string{MaxScaleAnnotationKey, InitialScaleAnnotationKey}, }) - } else if initial > max { - errs = errs.Also(&apis.FieldError{ + } else if initial > max { + errs = errs.Also(&apis.FieldError{ Message: fmt.Sprintf("max-scale=%d is less than initial-scale=%d", max, initial), - Paths: []string{MaxScaleAnnotationKey,InitialScaleAnnotationKey}, + Paths: []string{MaxScaleAnnotationKey, InitialScaleAnnotationKey}, }) } - return errs -} \ No newline at end of file +}
style / Golang / Auto-format and Check
Process completed with exit code 1.
style / Golang / Lint: pkg/apis/autoscaling/annotation_validation.go#L285
[trailing whitespace] reported by reviewdog 🐶 Raw Output: pkg/apis/autoscaling/annotation_validation.go:285:
style / Golang / Lint
Process completed with exit code 1.
style / Golang / Lint: pkg/apis/autoscaling/annotation_validation.go#L279
func `validateMaxInitialScale` is unused (unused)
style / Golang / Lint
issues found
style / Golang / Lint: pkg/apis/autoscaling/annotation_validation.go#L311
[EOF Newline] reported by reviewdog 🐶 Missing newline Raw Output: pkg/apis/autoscaling/annotation_validation.go:311: Missing newline
style / Golang / Lint
Process completed with exit code 1.
style / Golang / Auto-format and Check
Restore cache failed: Dependencies file is not found in /home/runner/work/serving/serving. Supported file pattern: go.sum
style / Golang / Boilerplate Check (sh)
The following actions uses node12 which is deprecated and will be forced to run on node16: andstor/file-existence-action@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
style / Golang / Boilerplate Check (sh)
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
style / Golang / Boilerplate Check (sh)
Restore cache failed: Dependencies file is not found in /home/runner/work/serving/serving. Supported file pattern: go.sum
style / Golang / Boilerplate Check (go)
The following actions uses node12 which is deprecated and will be forced to run on node16: andstor/file-existence-action@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
style / Golang / Boilerplate Check (go)
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
style / Golang / Boilerplate Check (go)
Restore cache failed: Dependencies file is not found in /home/runner/work/serving/serving. Supported file pattern: go.sum
style / Golang / Lint
The following actions uses node12 which is deprecated and will be forced to run on node16: andstor/file-existence-action@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
style / Golang / Lint
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
style / Golang / Lint
Restore cache failed: Dependencies file is not found in /home/runner/work/serving/serving. Supported file pattern: go.sum