feat: teach recipe sync to understand new versions
Closes coop-cloud/organising#177.
This commit is contained in:
@ -41,6 +41,33 @@ func (r Recipe) UpdateTag(image, tag string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Tags list the recipe tags
|
||||
func (r Recipe) Tags() ([]string, error) {
|
||||
var tags []string
|
||||
|
||||
recipeDir := path.Join(config.ABRA_DIR, "apps", r.Name)
|
||||
repo, err := git.PlainOpen(recipeDir)
|
||||
if err != nil {
|
||||
return tags, err
|
||||
}
|
||||
|
||||
gitTags, err := repo.Tags()
|
||||
if err != nil {
|
||||
return tags, err
|
||||
}
|
||||
|
||||
if err := gitTags.ForEach(func(ref *plumbing.Reference) (err error) {
|
||||
tags = append(tags, strings.TrimPrefix(string(ref.Name()), "refs/tags/"))
|
||||
return nil
|
||||
}); err != nil {
|
||||
return tags, err
|
||||
}
|
||||
|
||||
logrus.Debugf("detected '%s' as tags for recipe '%s'", strings.Join(tags, ", "), r.Name)
|
||||
|
||||
return tags, nil
|
||||
}
|
||||
|
||||
// Get retrieves a recipe.
|
||||
func Get(recipeName string) (Recipe, error) {
|
||||
if err := EnsureExists(recipeName); err != nil {
|
||||
|
Reference in New Issue
Block a user