improve error when malformed port

This commit is contained in:
Brad Rydzewski 2019-07-29 19:55:25 -07:00
parent c7788c4587
commit 801212a923
2 changed files with 13 additions and 1 deletions

View file

@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- copy parameters from parent build when promoting, by [@bradrydzewski](https://github.com/bradrydzewski). [#2748](https://github.com/drone/drone/issues/2748),
- improve error when kubernetes malforms the port configuration, by [@bradrydzewski](https://github.com/bradrydzewski). [#2742](https://github.com/drone/drone/issues/2742).
- copy parameters from parent build when promoting, by [@bradrydzewski](https://github.com/bradrydzewski). [#2748](https://github.com/drone/drone/issues/2748).
## [1.2.2] - 2019-07-29
### Added

View file

@ -15,6 +15,7 @@
package config
import (
"errors"
"fmt"
"os"
"strings"
@ -391,6 +392,9 @@ func Environ() (Config, error) {
defaultSession(&cfg)
defaultCallback(&cfg)
configureGithub(&cfg)
if err := kubernetesServiceConflict(&cfg); err != nil {
return cfg, err
}
return cfg, err
}
@ -499,6 +503,13 @@ func configureGithub(c *Config) {
}
}
func kubernetesServiceConflict(c *Config) error {
if strings.HasPrefix(c.Server.Port, "tcp://") {
return errors.New("Invalid port configuration. See https://discourse.drone.io/t/drone-server-changing-ports-protocol/4144")
}
return nil
}
// Bytes stores number bytes (e.g. megabytes)
type Bytes int64