fix: dont attempt to clone is local repo is there
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
See coop-cloud/organising#247.
This commit is contained in:
parent
9122c0a9b8
commit
486a1717e7
|
@ -2,6 +2,7 @@ package recipe
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -95,13 +96,18 @@ func Get(recipeName string) (Recipe, error) {
|
||||||
return Recipe{Name: recipeName, Config: config}, nil
|
return Recipe{Name: recipeName, Config: config}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnsureExists checks whether a recipe has been cloned locally or not.
|
// EnsureExists ensures that a recipe is locally cloned
|
||||||
func EnsureExists(recipe string) error {
|
func EnsureExists(recipe string) error {
|
||||||
recipeDir := path.Join(config.ABRA_DIR, "apps", strings.ToLower(recipe))
|
recipeDir := path.Join(config.ABRA_DIR, "apps", strings.ToLower(recipe))
|
||||||
url := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, recipe)
|
|
||||||
if err := gitPkg.Clone(recipeDir, url); err != nil {
|
if _, err := os.Stat(recipeDir); os.IsNotExist(err) {
|
||||||
return err
|
logrus.Debugf("%s does not exist, attemmpting to clone", recipeDir)
|
||||||
|
url := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, recipe)
|
||||||
|
if err := gitPkg.Clone(recipeDir, url); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue