forked from toolshed/abra
@ -105,7 +105,7 @@ func (r Recipe) IsChaosCommit(version string) (bool, error) {
|
||||
isChaosCommit = true
|
||||
}
|
||||
|
||||
return true, nil
|
||||
return isChaosCommit, nil
|
||||
}
|
||||
|
||||
// EnsureVersion checks whether a specific version exists for a recipe.
|
||||
|
@ -125,6 +125,20 @@ type Features struct {
|
||||
SSO string `json:"sso"`
|
||||
}
|
||||
|
||||
func GetEnvVersionRaw(name string) (string, error) {
|
||||
var version string
|
||||
|
||||
if strings.Contains(name, ":") {
|
||||
split := strings.Split(name, ":")
|
||||
if len(split) > 2 {
|
||||
return version, fmt.Errorf("version seems invalid: %s", name)
|
||||
}
|
||||
version = split[1]
|
||||
}
|
||||
|
||||
return version, nil
|
||||
}
|
||||
|
||||
func Get(name string) Recipe {
|
||||
version := ""
|
||||
if strings.Contains(name, ":") {
|
||||
|
@ -110,3 +110,11 @@ func TestDirtyMarkerRemoved(t *testing.T) {
|
||||
r := Get("abra-test-recipe:1e83340e+U")
|
||||
assert.Equal(t, "1e83340e", r.EnvVersion)
|
||||
}
|
||||
|
||||
func TestGetEnvVersionRaw(t *testing.T) {
|
||||
v, err := GetEnvVersionRaw("abra-test-recipe:1e83340e+U")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, "1e83340e+U", v)
|
||||
}
|
||||
|
Reference in New Issue
Block a user