Merge branch 'fix-deploy-no-catalogue'
continuous-integration/drone/push Build was killed
Details
continuous-integration/drone/push Build was killed
Details
This commit is contained in:
commit
5ae73f700e
|
@ -236,9 +236,10 @@ func Get(recipeName string, conf *runtime.Config) (Recipe, error) {
|
|||
|
||||
meta, err := GetRecipeMeta(recipeName, conf)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "does not exist") {
|
||||
switch err.(type) {
|
||||
case RecipeMissingFromCatalogue:
|
||||
meta = RecipeMeta{}
|
||||
} else {
|
||||
default:
|
||||
return Recipe{}, err
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +379,12 @@ func EnsureLatest(recipeName string, conf *runtime.Config) error {
|
|||
|
||||
meta, err := GetRecipeMeta(recipeName, conf)
|
||||
if err != nil {
|
||||
return err
|
||||
switch err.(type) {
|
||||
case RecipeMissingFromCatalogue:
|
||||
meta = RecipeMeta{}
|
||||
default:
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
var branch plumbing.ReferenceName
|
||||
|
@ -734,6 +740,14 @@ func VersionsOfService(recipe, serviceName string, conf *runtime.Config) ([]stri
|
|||
return versions, nil
|
||||
}
|
||||
|
||||
// RecipeMissingFromCatalogue signifies a recipe is not present in the catalogue.
|
||||
type RecipeMissingFromCatalogue struct{ err string }
|
||||
|
||||
// Error outputs the error message.
|
||||
func (r RecipeMissingFromCatalogue) Error() string {
|
||||
return r.err
|
||||
}
|
||||
|
||||
// GetRecipeMeta retrieves the recipe metadata from the recipe catalogue.
|
||||
func GetRecipeMeta(recipeName string, conf *runtime.Config) (RecipeMeta, error) {
|
||||
catl, err := ReadRecipeCatalogue(conf)
|
||||
|
@ -743,7 +757,9 @@ func GetRecipeMeta(recipeName string, conf *runtime.Config) (RecipeMeta, error)
|
|||
|
||||
recipeMeta, ok := catl[recipeName]
|
||||
if !ok {
|
||||
return RecipeMeta{}, fmt.Errorf("recipe %s does not exist?", recipeName)
|
||||
return RecipeMeta{}, RecipeMissingFromCatalogue{
|
||||
err: fmt.Sprintf("recipe %s does not exist?", recipeName),
|
||||
}
|
||||
}
|
||||
|
||||
if err := EnsureExists(recipeName, conf); err != nil {
|
||||
|
|
Loading…
Reference in New Issue