fix: only sync version label once
continuous-integration/drone/push Build is failing Details

Closes coop-cloud/organising#492
This commit is contained in:
decentral1se 2023-09-21 10:58:17 +02:00
parent 76035e003e
commit 8788558cf1
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 17 additions and 1 deletions

View File

@ -122,7 +122,7 @@ func UpdateLabel(pattern, serviceName, label, recipeName string) error {
discovered := false
for oldLabel, value := range service.Deploy.Labels {
if strings.HasPrefix(oldLabel, "coop-cloud") {
if strings.HasPrefix(oldLabel, "coop-cloud") && strings.Contains(oldLabel, "version") {
discovered = true
bytes, err := ioutil.ReadFile(composeFile)

View File

@ -111,3 +111,19 @@ setup(){
assert_success
assert_output --partial '[new tag]'
}
@test "output label sync only once" {
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input --minor
assert_success
run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" diff
assert_success
assert_output --regexp 'image: nginx:1.2.*'
run $ABRA recipe sync "$TEST_RECIPE" --no-input --minor
assert_success
assert_line --index 0 --partial 'synced label'
refute_line --index 1 --partial 'synced label'
_checkout_recipe
}