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)
|
meta, err := GetRecipeMeta(recipeName, conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), "does not exist") {
|
switch err.(type) {
|
||||||
|
case RecipeMissingFromCatalogue:
|
||||||
meta = RecipeMeta{}
|
meta = RecipeMeta{}
|
||||||
} else {
|
default:
|
||||||
return Recipe{}, err
|
return Recipe{}, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -378,8 +379,13 @@ func EnsureLatest(recipeName string, conf *runtime.Config) error {
|
||||||
|
|
||||||
meta, err := GetRecipeMeta(recipeName, conf)
|
meta, err := GetRecipeMeta(recipeName, conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
switch err.(type) {
|
||||||
|
case RecipeMissingFromCatalogue:
|
||||||
|
meta = RecipeMeta{}
|
||||||
|
default:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var branch plumbing.ReferenceName
|
var branch plumbing.ReferenceName
|
||||||
if meta.DefaultBranch != "" {
|
if meta.DefaultBranch != "" {
|
||||||
|
@ -734,6 +740,14 @@ func VersionsOfService(recipe, serviceName string, conf *runtime.Config) ([]stri
|
||||||
return versions, nil
|
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.
|
// GetRecipeMeta retrieves the recipe metadata from the recipe catalogue.
|
||||||
func GetRecipeMeta(recipeName string, conf *runtime.Config) (RecipeMeta, error) {
|
func GetRecipeMeta(recipeName string, conf *runtime.Config) (RecipeMeta, error) {
|
||||||
catl, err := ReadRecipeCatalogue(conf)
|
catl, err := ReadRecipeCatalogue(conf)
|
||||||
|
@ -743,7 +757,9 @@ func GetRecipeMeta(recipeName string, conf *runtime.Config) (RecipeMeta, error)
|
||||||
|
|
||||||
recipeMeta, ok := catl[recipeName]
|
recipeMeta, ok := catl[recipeName]
|
||||||
if !ok {
|
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 {
|
if err := EnsureExists(recipeName, conf); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue