Compare commits

..
11 changed files with 54 additions and 59 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ func GetMainAppImage(recipe recipe.Recipe) (string, error) {
}
for _, service := range config.Services {
if service.Name == "app" {
img, err := reference.ParseNormalizedNamed(formatter.RemoveSha(service.Image))
img, err := reference.ParseNormalizedNamed(service.Image)
if err != nil {
return "", err
}
+1 -1
View File
@@ -322,7 +322,7 @@ func GetImageVersions(recipe recipePkg.Recipe) (map[string]string, error) {
continue
}
img, err := reference.ParseNormalizedNamed(formatter.RemoveSha(service.Image))
img, err := reference.ParseNormalizedNamed(service.Image)
if err != nil {
return services, err
}
+1 -1
View File
@@ -130,7 +130,7 @@ interface.`),
}
for _, service := range config.Services {
img, err := reference.ParseNormalizedNamed(formatter.RemoveSha(service.Image))
img, err := reference.ParseNormalizedNamed(service.Image)
if err != nil {
log.Fatal(err)
}
+2 -2
View File
@@ -158,7 +158,7 @@ func GetImagesForStack(cl *dockerClient.Client, app appPkg.App) (map[string]stri
if service.Spec.TaskTemplate.ContainerSpec != nil {
imageName := service.Spec.TaskTemplate.ContainerSpec.Image
imageParsed, err := reference.ParseNormalizedNamed(formatter.RemoveSha(imageName))
imageParsed, err := reference.ParseNormalizedNamed(imageName)
if err != nil {
log.Warn(err)
continue
@@ -281,7 +281,7 @@ func GatherImagesForDeploy(cl *dockerClient.Client, app appPkg.App, compose *com
newImages := make(map[string]string)
for _, service := range compose.Services {
imageParsed, err := reference.ParseNormalizedNamed(formatter.RemoveSha(service.Image))
imageParsed, err := reference.ParseNormalizedNamed(service.Image)
if err != nil {
log.Warn(err)
continue
+1 -2
View File
@@ -34,8 +34,7 @@ func SmallSHA(hash string) string {
return hash[:8]
}
// RemoveSha remove image sha (digest suffix) from a string that are added in some docker outputs
// e.g., "image:tag@sha256:..." -> "image:tag"
// RemoveSha remove image sha from a string that are added in some docker outputs
func RemoveSha(str string) string {
return strings.Split(str, "@")[0]
}
-7
View File
@@ -6,13 +6,6 @@ import (
"github.com/stretchr/testify/assert"
)
func TestRemoveSha(t *testing.T) {
assert.Equal(t, "ubuntu:latest", RemoveSha("ubuntu:latest@sha256:1234567890abcdef"))
assert.Equal(t, "ubuntu:latest", RemoveSha("ubuntu:latest"))
assert.Equal(t, "my-repo/my-image:v1", RemoveSha("my-repo/my-image:v1@sha256:abcdef1234567890"))
assert.Equal(t, "my-repo/my-image", RemoveSha("my-repo/my-image@sha256:abcdef1234567890"))
}
func TestBoldDirtyDefault(t *testing.T) {
assert.Equal(t, "foo", BoldDirtyDefault("foo"))
}
-2
View File
@@ -52,7 +52,6 @@ func Clone(dir, url string) error {
URL: url,
Tags: git.AllTags,
ReferenceName: plumbing.ReferenceName("refs/heads/main"),
SingleBranch: true,
})
if err != nil && gitCloneIgnoreErr(err) {
@@ -71,7 +70,6 @@ func Clone(dir, url string) error {
URL: url,
Tags: git.AllTags,
ReferenceName: plumbing.ReferenceName("refs/heads/master"),
SingleBranch: true,
})
if err != nil && gitCloneIgnoreErr(err) {
+36 -36
View File
@@ -7,7 +7,7 @@
msgid ""
msgstr "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2026-06-14 17:56+0200\n"
"POT-Creation-Date: 2026-08-31 19:21+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -189,7 +189,7 @@ msgstr ""
msgid "%d volumes removed successfully"
msgstr ""
#: ./pkg/recipe/git.go:197
#: ./pkg/recipe/git.go:198
#, c-format
msgid "%s (%s) has locally unstaged changes?"
msgstr ""
@@ -419,7 +419,7 @@ msgstr ""
msgid "%s sanitised as %s for new app"
msgstr ""
#: ./pkg/recipe/git.go:445
#: ./pkg/recipe/git.go:451
#, c-format
msgid "%s service is missing image tag?"
msgstr ""
@@ -902,7 +902,7 @@ msgstr ""
msgid "Generate the recipe catalogue"
msgstr ""
#: ./pkg/recipe/git.go:459
#: ./pkg/recipe/git.go:465
#, c-format
msgid "GetRecipeVersions encountered error for %s: %s (collected %d versions)"
msgstr ""
@@ -1815,7 +1815,7 @@ msgstr ""
msgid "are you sure?"
msgstr ""
#: ./pkg/recipe/git.go:162
#: ./pkg/recipe/git.go:163
#, c-format
msgid "attempting to checkout '%s' as chaos commit"
msgstr ""
@@ -1951,7 +1951,7 @@ msgstr ""
msgid "cancelled"
msgstr ""
#: ./pkg/catalogue/catalogue.go:59 ./pkg/recipe/git.go:251
#: ./pkg/catalogue/catalogue.go:59 ./pkg/recipe/git.go:252
#, c-format
msgid "cannot ensure %s is up-to-date, no git remotes configured"
msgstr ""
@@ -1966,7 +1966,7 @@ msgstr ""
msgid "cannot get label %s for %s"
msgstr ""
#: ./pkg/recipe/git.go:58
#: ./pkg/recipe/git.go:59
#, c-format
msgid "cannot redeploy previous chaos version (%s), did you mean to use \"--chaos\"?"
msgstr ""
@@ -2118,7 +2118,7 @@ msgstr ""
msgid "cmd"
msgstr ""
#: ./pkg/recipe/git.go:470
#: ./pkg/recipe/git.go:476
#, c-format
msgid "collected %s for %s"
msgstr ""
@@ -2456,7 +2456,7 @@ msgstr ""
msgid "destination directory does not exist"
msgstr ""
#: ./pkg/recipe/git.go:373
#: ./pkg/recipe/git.go:379
#, c-format
msgid "detected %s as tags for recipe %s"
msgstr ""
@@ -2653,7 +2653,7 @@ msgstr ""
msgid "ensure recipe: %s"
msgstr ""
#: ./pkg/recipe/git.go:56
#: ./pkg/recipe/git.go:57
#, c-format
msgid "ensuring env version %s"
msgstr ""
@@ -2751,12 +2751,12 @@ msgstr ""
msgid "failed to check git status of %s: %s"
msgstr ""
#: ./pkg/git/branch.go:95 ./pkg/recipe/git.go:231
#: ./pkg/git/branch.go:95 ./pkg/recipe/git.go:232
#, c-format
msgid "failed to check out %s in %s"
msgstr ""
#: ./pkg/recipe/git.go:412
#: ./pkg/recipe/git.go:418
#, c-format
msgid "failed to check out %s in %s: %s"
msgstr ""
@@ -2806,7 +2806,7 @@ msgstr ""
msgid "failed to generate random bytes: %w"
msgstr ""
#: ./pkg/recipe/git.go:421
#: ./pkg/recipe/git.go:427
#, c-format
msgid "failed to get compose config for %s: %s"
msgstr ""
@@ -2844,7 +2844,7 @@ msgstr ""
msgid "failed to parse image %s, saw: %s"
msgstr ""
#: ./pkg/recipe/git.go:431
#: ./pkg/recipe/git.go:437
#, c-format
msgid "failed to parse image for %s in %s: %s"
msgstr ""
@@ -2952,7 +2952,7 @@ msgstr ""
msgid "fetch all recipes"
msgstr ""
#: ./pkg/catalogue/catalogue.go:84 ./pkg/recipe/git.go:284
#: ./pkg/catalogue/catalogue.go:84 ./pkg/recipe/git.go:290
#, c-format
msgid "fetched latest git changes for %s"
msgstr ""
@@ -3070,12 +3070,12 @@ msgstr ""
msgid "git changes pushed"
msgstr ""
#: ./pkg/recipe/git.go:417
#: ./pkg/recipe/git.go:423
#, c-format
msgid "git checkout: %s in %s"
msgstr ""
#: ./pkg/git/clone.go:64 ./pkg/git/clone.go:102
#: ./pkg/git/clone.go:63 ./pkg/git/clone.go:100
#, c-format
msgid "git clone %s: cancelled due to interrupt"
msgstr ""
@@ -3085,17 +3085,17 @@ msgstr ""
msgid "git clone: %s"
msgstr ""
#: ./pkg/git/clone.go:89
#: ./pkg/git/clone.go:87
#, c-format
msgid "git clone: %s already exists"
msgstr ""
#: ./pkg/git/clone.go:59 ./pkg/git/clone.go:78 ./pkg/git/clone.go:87
#: ./pkg/git/clone.go:58 ./pkg/git/clone.go:76 ./pkg/git/clone.go:85
#, c-format
msgid "git clone: %s cloned successfully"
msgstr ""
#: ./pkg/git/clone.go:68
#: ./pkg/git/clone.go:67
msgid "git clone: main branch failed, attempting master branch"
msgstr ""
@@ -3150,7 +3150,7 @@ msgstr ""
msgid "git.coopcloud.tech repo exists"
msgstr ""
#: ./pkg/recipe/git.go:384
#: ./pkg/recipe/git.go:390
#, c-format
msgid "git: opening repository in %s"
msgstr ""
@@ -4061,7 +4061,7 @@ msgstr ""
msgid "proceed?"
msgstr ""
#: ./pkg/recipe/git.go:404
#: ./pkg/recipe/git.go:410
#, c-format
msgid "processing %s for %s"
msgstr ""
@@ -4129,7 +4129,7 @@ msgstr ""
msgid "re"
msgstr ""
#: ./pkg/recipe/git.go:157
#: ./pkg/recipe/git.go:158
#, c-format
msgid "read %s as tags for recipe %s"
msgstr ""
@@ -4865,17 +4865,17 @@ msgstr ""
msgid "skipping secret (because it already exists) on %s: %s"
msgstr ""
#: ./pkg/recipe/git.go:413
#: ./pkg/recipe/git.go:419
#, c-format
msgid "skipping tag %s: checkout failed: %s"
msgstr ""
#: ./pkg/recipe/git.go:422
#: ./pkg/recipe/git.go:428
#, c-format
msgid "skipping tag %s: invalid compose config: %s"
msgstr ""
#: ./pkg/recipe/git.go:432
#: ./pkg/recipe/git.go:438
#, c-format
msgid "skipping tag %s: invalid image reference in service %s: %s"
msgstr ""
@@ -4978,7 +4978,7 @@ msgstr ""
msgid "succeeded"
msgstr ""
#: ./pkg/recipe/git.go:184
#: ./pkg/recipe/git.go:185
#, c-format
msgid "successfully checked %s out to %s in %s"
msgstr ""
@@ -5138,17 +5138,17 @@ msgstr ""
msgid "un"
msgstr ""
#: ./pkg/recipe/git.go:193
#: ./pkg/recipe/git.go:194
#, c-format
msgid "unable to check git clean status in %s: %s"
msgstr ""
#: ./pkg/recipe/git.go:262
#: ./pkg/recipe/git.go:263
#, c-format
msgid "unable to check out default branch in %s: %s"
msgstr ""
#: ./pkg/git/clone.go:100
#: ./pkg/git/clone.go:98
#, c-format
msgid "unable to clean up git clone of %s: %s"
msgstr ""
@@ -5222,7 +5222,7 @@ msgstr ""
msgid "unable to discover SSH remote for %s"
msgstr ""
#: ./pkg/recipe/git.go:268
#: ./pkg/recipe/git.go:274
#, c-format
msgid "unable to fetch tags in %s: %s"
msgstr ""
@@ -5232,7 +5232,7 @@ msgstr ""
msgid "unable to get container matching %s: %s"
msgstr ""
#: ./pkg/recipe/git.go:280
#: ./pkg/recipe/git.go:286
#, c-format
msgid "unable to git pull in %s: %s"
msgstr ""
@@ -5261,12 +5261,12 @@ msgstr ""
msgid "unable to look up server context for %s: %s"
msgstr ""
#: ./cli/recipe/fetch.go:77 ./pkg/git/read.go:26 ./pkg/lint/recipe.go:491 ./pkg/recipe/git.go:242
#: ./cli/recipe/fetch.go:77 ./pkg/git/read.go:26 ./pkg/lint/recipe.go:491 ./pkg/recipe/git.go:243
#, c-format
msgid "unable to open %s: %s"
msgstr ""
#: ./pkg/recipe/git.go:257
#: ./pkg/recipe/git.go:258
#, c-format
msgid "unable to open git work tree in %s: %s"
msgstr ""
@@ -5326,7 +5326,7 @@ msgstr ""
msgid "unable to read new env %s: %s"
msgstr ""
#: ./pkg/recipe/git.go:247
#: ./pkg/recipe/git.go:248
#, c-format
msgid "unable to read remotes in %s: %s"
msgstr ""
@@ -5361,7 +5361,7 @@ msgstr ""
msgid "unable to reset commit after failed release attempt: %s"
msgstr ""
#: ./pkg/recipe/git.go:166
#: ./pkg/recipe/git.go:167
#, c-format
msgid "unable to resolve '%s': %s"
msgstr ""
+3 -4
View File
@@ -7,7 +7,6 @@ import (
"os"
"path"
"coopcloud.tech/abra/pkg/formatter"
"coopcloud.tech/abra/pkg/i18n"
"coopcloud.tech/abra/pkg/log"
"coopcloud.tech/abra/pkg/recipe"
@@ -322,7 +321,7 @@ func LintAllImagesTagged(recipe recipe.Recipe) (bool, error) {
return false, err
}
for _, service := range config.Services {
img, err := reference.ParseNormalizedNamed(formatter.RemoveSha(service.Image))
img, err := reference.ParseNormalizedNamed(service.Image)
if err != nil {
return false, err
}
@@ -340,7 +339,7 @@ func LintNoUnstableTags(recipe recipe.Recipe) (bool, error) {
return false, err
}
for _, service := range config.Services {
img, err := reference.ParseNormalizedNamed(formatter.RemoveSha(service.Image))
img, err := reference.ParseNormalizedNamed(service.Image)
if err != nil {
return false, err
}
@@ -367,7 +366,7 @@ func LintSemverLikeTags(recipe recipe.Recipe) (bool, error) {
return false, err
}
for _, service := range config.Services {
img, err := reference.ParseNormalizedNamed(formatter.RemoveSha(service.Image))
img, err := reference.ParseNormalizedNamed(service.Image)
if err != nil {
return false, err
}
+1 -1
View File
@@ -140,7 +140,7 @@ func (r Recipe) UpdateTag(image, tag string) (bool, error) {
continue // may be a compose.$optional.yml file
}
img, _ := reference.ParseNormalizedNamed(formatter.RemoveSha(service.Image))
img, _ := reference.ParseNormalizedNamed(service.Image)
if err != nil {
return false, err
}
+8 -2
View File
@@ -16,6 +16,7 @@ import (
"coopcloud.tech/tagcmp"
"github.com/distribution/reference"
"github.com/go-git/go-git/v5"
gitCfg "github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
)
@@ -262,7 +263,12 @@ func (r Recipe) EnsureUpToDate() error {
return errors.New(i18n.G("unable to check out default branch in %s: %s", r.Dir, err))
}
fetchOpts := &git.FetchOptions{Tags: git.AllTags}
// the refspec is passed explicitly, because a repository cloned by an older abra has a
// single-branch refspec stored in its config and would otherwise never see other branches
fetchOpts := &git.FetchOptions{
Tags: git.AllTags,
RefSpecs: []gitCfg.RefSpec{"+refs/heads/*:refs/remotes/origin/*"},
}
if err := repo.Fetch(fetchOpts); err != nil {
if !strings.Contains(err.Error(), "already up-to-date") {
return errors.New(i18n.G("unable to fetch tags in %s: %s", r.Dir, err))
@@ -426,7 +432,7 @@ func (r Recipe) GetRecipeVersions() (RecipeVersions, []string, error) {
versionMeta := make(map[string]ServiceMeta)
for _, service := range config.Services {
img, err := reference.ParseNormalizedNamed(formatter.RemoveSha(service.Image))
img, err := reference.ParseNormalizedNamed(service.Image)
if err != nil {
log.Debug(i18n.G("failed to parse image for %s in %s: %s", service.Name, tag, err))
warnMsg = append(warnMsg, i18n.G("skipping tag %s: invalid image reference in service %s: %s", tag, service.Name, err))