fix: skip recipe clone / up to date sync for some commands

Continues work of 3dc5662821.
This commit is contained in:
2023-08-01 21:19:20 +02:00
parent 2cd453ae8d
commit 23f5745cb8
7 changed files with 73 additions and 7 deletions

View File

@ -252,6 +252,11 @@ func Get(recipeName string, conf *runtime.Config) (Recipe, error) {
// EnsureExists ensures that a recipe is locally cloned
func EnsureExists(recipeName string, conf *runtime.Config) error {
if !conf.RecipeExists {
logrus.Debug("skipping ensuring recipe locally exists")
return nil
}
recipeDir := path.Join(config.RECIPES_DIR, recipeName)
if _, err := os.Stat(recipeDir); os.IsNotExist(err) {
@ -339,6 +344,11 @@ func EnsureVersion(recipeName, version string) error {
// EnsureLatest makes sure the latest commit is checked out for a local recipe repository
func EnsureLatest(recipeName string, conf *runtime.Config) error {
if !conf.RecipeLatest {
logrus.Debug("skipping ensuring recipe is synced with remote")
return nil
}
recipeDir := path.Join(config.RECIPES_DIR, recipeName)
isClean, err := gitPkg.IsClean(recipeDir)
@ -584,6 +594,11 @@ func GetStringInBetween(recipeName, str, start, end string) (result string, err
// EnsureUpToDate ensures that the local repo is synced to the remote
func EnsureUpToDate(recipeName string, conf *runtime.Config) error {
if !conf.RecipeLatest {
logrus.Debug("skipping ensuring recipe is synced with remote")
return nil
}
recipeDir := path.Join(config.RECIPES_DIR, recipeName)
isClean, err := gitPkg.IsClean(recipeDir)