Skip to content

Commit 03bc190

Browse files
FIX: error out if no base image provided in config (#17)
FIX: error out if no base image provided in config
1 parent b1dcecf commit 03bc190

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

v2/config/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func LoadConfig(dir string, configName string, includeTemplates bool, templatesD
6767
config := &Config{
6868
Name: configName,
6969
Boot_Command: defaultBootCommand,
70-
Base_Image: utils.DefaultBaseImage,
7170
}
7271

7372
matched, _ := regexp.MatchString("[[:upper:]/ !@#$%^&*()+~`=]", configName)
@@ -122,6 +121,10 @@ func LoadConfig(dir string, configName string, includeTemplates bool, templatesD
122121
config.Env[k] = val
123122
}
124123

124+
if config.Base_Image == "" {
125+
return nil, errors.New("No base image specified in config! Set base image with `base_image: {imagename}`")
126+
}
127+
125128
return config, nil
126129
}
127130

v2/config/config_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,9 @@ var _ = Describe("Config", func() {
5858
Expect(config.DockerHostname("asdf!@#")).To(Equal("asdf---"))
5959
})
6060
})
61+
It("should error if no base config LoadConfig to load yaml configuration", func() {
62+
_, err := config.LoadConfig("../test/containers", "test-no-base-image", true, "../test")
63+
Expect(err).ToNot(BeNil())
64+
Expect(err.Error()).To(Equal("No base image specified in config! Set base image with `base_image: {imagename}`"))
65+
})
6166
})

v2/test/containers/test-no-base-image.yml

Whitespace-only changes.

v2/test/templates/web.template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
base_image: discourse/base:2.0.20250226-0128
12
env:
23
# You can have redis on a different box
34
RAILS_ENV: 'production'

v2/utils/consts.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import (
77
"time"
88
)
99

10-
const Version = "v2.0.4"
10+
const Version = "v2.0.5"
1111

1212
const DefaultNamespace = "local_discourse"
13-
const DefaultBaseImage = "discourse/base:release"
1413

1514
// Known secrets, or otherwise not public info from config so we can build public images
1615
var KnownSecrets = []string{

0 commit comments

Comments
 (0)