api/types: minor BuilderVersion refactor
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
3152f94362
commit
20e3b5ba2c
2 changed files with 8 additions and 4 deletions
|
@ -163,13 +163,17 @@ func newImageBuildOptions(ctx context.Context, r *http.Request) (*types.ImageBui
|
|||
}
|
||||
|
||||
func parseVersion(s string) (types.BuilderVersion, error) {
|
||||
if s == "" || s == string(types.BuilderV1) {
|
||||
if s == "" {
|
||||
return types.BuilderV1, nil
|
||||
}
|
||||
if s == string(types.BuilderBuildKit) {
|
||||
switch types.BuilderVersion(s) {
|
||||
case types.BuilderV1:
|
||||
return types.BuilderV1, nil
|
||||
case types.BuilderBuildKit:
|
||||
return types.BuilderBuildKit, nil
|
||||
default:
|
||||
return "", errors.Errorf("invalid version %s", s)
|
||||
}
|
||||
return "", errors.Errorf("invalid version %s", s)
|
||||
}
|
||||
|
||||
func (br *buildRouter) postPrune(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
|
|
|
@ -205,7 +205,7 @@ const (
|
|||
// BuilderV1 is the first generation builder in docker daemon
|
||||
BuilderV1 BuilderVersion = "1"
|
||||
// BuilderBuildKit is builder based on moby/buildkit project
|
||||
BuilderBuildKit = "2"
|
||||
BuilderBuildKit BuilderVersion = "2"
|
||||
)
|
||||
|
||||
// ImageBuildResponse holds information
|
||||
|
|
Loading…
Reference in a new issue