From 1a033658702ba2442fa55e0042b6bbfd6a189e74 Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Tue, 20 Aug 2024 16:11:53 +1000 Subject: [PATCH] chore: fix after rebase --- internal/generator/services.go | 4 ++-- internal/generator/services_test.go | 9 +++++---- .../cronjob-cronjob-node-some-other-drush-cron.yaml | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/internal/generator/services.go b/internal/generator/services.go index 05b66046..ba264c6d 100644 --- a/internal/generator/services.go +++ b/internal/generator/services.go @@ -286,11 +286,11 @@ func composeToServiceValues( } } - baseimage := lagoon.CheckServiceLagoonLabel(composeServiceValues.Labels, "lagoon.base.image") + baseimage := lagoon.CheckDockerComposeLagoonLabel(composeServiceValues.Labels, "lagoon.base.image") if baseimage != "" { // First, let's ensure that the structure of the base image is valid if !reference.ReferenceRegexp.MatchString(baseimage) { - return ServiceValues{}, fmt.Errorf("the 'lagoon.base.image' label defined on service %s in the docker-compose file is invalid ('%s') - please ensure it conforms to the structure `[REGISTRY_HOST[:REGISTRY_PORT]/]REPOSITORY[:TAG|@DIGEST]`", composeService, baseimage) + return nil, fmt.Errorf("the 'lagoon.base.image' label defined on service %s in the docker-compose file is invalid ('%s') - please ensure it conforms to the structure `[REGISTRY_HOST[:REGISTRY_PORT]/]REPOSITORY[:TAG|@DIGEST]`", composeService, baseimage) } buildValues.ForcePullImages = append(buildValues.ForcePullImages, baseimage) } diff --git a/internal/generator/services_test.go b/internal/generator/services_test.go index 5954a308..f262b137 100644 --- a/internal/generator/services_test.go +++ b/internal/generator/services_test.go @@ -2,13 +2,14 @@ package generator import ( "encoding/json" + "reflect" + "testing" + "time" + composetypes "github.com/compose-spec/compose-go/types" "github.com/uselagoon/build-deploy-tool/internal/dbaasclient" "github.com/uselagoon/build-deploy-tool/internal/helpers" "github.com/uselagoon/build-deploy-tool/internal/lagoon" - "reflect" - "testing" - "time" ) func Test_composeToServiceValues(t *testing.T) { @@ -1231,7 +1232,7 @@ func Test_composeToServiceValues(t *testing.T) { Image: "uselagoon/fake-redis:7", }, }, - want: ServiceValues{}, + want: nil, wantErr: true, }, } diff --git a/internal/testdata/basic/service-templates/service7/cronjob-cronjob-node-some-other-drush-cron.yaml b/internal/testdata/basic/service-templates/service7/cronjob-cronjob-node-some-other-drush-cron.yaml index 225aa2ce..5133d082 100644 --- a/internal/testdata/basic/service-templates/service7/cronjob-cronjob-node-some-other-drush-cron.yaml +++ b/internal/testdata/basic/service-templates/service7/cronjob-cronjob-node-some-other-drush-cron.yaml @@ -7,7 +7,9 @@ metadata: lagoon.sh/version: v2.7.x creationTimestamp: null labels: + app.kubernetes.io/instance: cronjob-node app.kubernetes.io/managed-by: build-deploy-tool + app.kubernetes.io/name: cronjob-basic lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production @@ -31,7 +33,9 @@ spec: lagoon.sh/version: v2.7.x creationTimestamp: null labels: + app.kubernetes.io/instance: cronjob-node app.kubernetes.io/managed-by: build-deploy-tool + app.kubernetes.io/name: cronjob-basic lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production