feat: upgrade/downgrade support chaos mode

This commit is contained in:
2021-10-18 08:57:25 +02:00
parent c5a7a831d2
commit 62cc7ef92d
4 changed files with 75 additions and 39 deletions

View File

@ -195,3 +195,26 @@ func EnsureLatest(recipeName string) error {
return nil
}
// ChaosVersion constructs a chaos mode recipe version.
func ChaosVersion(recipeName string) (string, error) {
var version string
head, err := gitPkg.GetRecipeHead(recipeName)
if err != nil {
return version, err
}
version = head.String()[:8]
isClean, err := gitPkg.IsClean(recipeName)
if err != nil {
return version, err
}
if !isClean {
version = fmt.Sprintf("%s + unstaged changes", version)
}
return version, nil
}