Skip to content

Commit

Permalink
chore: fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Aug 20, 2024
1 parent 96cc73f commit 1a03365
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/generator/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
9 changes: 5 additions & 4 deletions internal/generator/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -1231,7 +1232,7 @@ func Test_composeToServiceValues(t *testing.T) {
Image: "uselagoon/fake-redis:7",
},
},
want: ServiceValues{},
want: nil,
wantErr: true,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1a03365

Please sign in to comment.