forked from toolshed/abra
feat: upgrade/downgrade support chaos mode
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user