github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/initializer/errors/errors.go (about) 1 /* 2 Copyright 2020 The Skaffold Authors 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package errors 18 19 import "fmt" 20 21 // NoBuilderErr is an error returned by `skaffold init` when it couldn't find any build configuration. 22 type NoBuilderErr struct{} 23 24 func (e NoBuilderErr) ExitCode() int { return 101 } 25 func (e NoBuilderErr) Error() string { 26 return "one or more valid builder configuration (Dockerfile or Jib configuration) must be present to build images with skaffold; please provide at least one build config and try again or run `skaffold init --skip-build`" 27 } 28 29 // NoManifestErr is an error returned by `skaffold init` when no valid Kubernetes manifest is found. 30 type NoManifestErr struct{} 31 32 func (e NoManifestErr) ExitCode() int { return 102 } 33 func (e NoManifestErr) Error() string { 34 return "one or more valid Kubernetes manifests are required to run skaffold" 35 } 36 37 // PreExistingConfigErr is an error returned by `skaffold init` when a skaffold config file already exists. 38 type PreExistingConfigErr struct { 39 Path string 40 } 41 42 func (e PreExistingConfigErr) ExitCode() int { return 103 } 43 func (e PreExistingConfigErr) Error() string { 44 return fmt.Sprintf("pre-existing %s found (you may continue with --force)", e.Path) 45 } 46 47 // BuilderImageAmbiguitiesErr is an error returned by `skaffold init` when it can't resolve builder/image pairs. 48 type BuilderImageAmbiguitiesErr struct{} 49 50 func (e BuilderImageAmbiguitiesErr) ExitCode() int { return 104 } 51 func (e BuilderImageAmbiguitiesErr) Error() string { 52 return "unable to automatically resolve builder/image pairs; run `skaffold init` without `--force` to manually resolve ambiguities" 53 }