Skip to content

Commit 4528e12

Browse files
Added Validation Regex and Message to the user provided registry username
Signed-off-by: Alexandra Dragodan <[email protected]>
1 parent 294a386 commit 4528e12

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/devspace/configure/image.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ func (m *manager) AddImage(imageName, image, projectNamespace, dockerfile string
172172
registryHostname = generator.GithubContainerRegistry
173173
} else {
174174
registryHostname, err = m.log.Question(&survey.QuestionOptions{
175-
Question: "Please provide the registry hostname without the image path (e.g. gcr.io, ghcr.io, ecr.io)",
176-
DefaultValue: "gcr.io",
175+
Question: "Please provide the registry hostname without the image path (e.g. gcr.io, ghcr.io, ecr.io)",
176+
DefaultValue: "gcr.io",
177+
ValidationRegexPattern: "^[^A-Z\\s]+\\.[^A-Z\\s]+$",
178+
ValidationMessage: "Error parsing registry username: must only include lowercase letters.",
177179
})
178180
if err != nil {
179181
return err
@@ -264,7 +266,8 @@ func (m *manager) addPullSecretConfig(dockerClient docker.Client, image string)
264266

265267
registryUsername, err = m.log.Question(&survey.QuestionOptions{
266268
Question: usernameQuestion,
267-
ValidationRegexPattern: "^.*$",
269+
ValidationRegexPattern: "^[^A-Z\\s]+\\.[^A-Z\\s]+$",
270+
ValidationMessage: "Error parsing registry username: must only include lowercase letters.",
268271
})
269272
if err != nil {
270273
return "", err

0 commit comments

Comments
 (0)