Skip to content

Commit 73f7b33

Browse files
authored
Merge pull request #296 from covexo/private-registry
Fix issue with private registries
2 parents 4b04f9d + 2ac7a65 commit 73f7b33

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

pkg/devspace/image/build.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ func Build(client *kubernetes.Clientset, generatedConfig *generated.Config, imag
176176
log.Info("Image pushed to registry (" + displayRegistryURL + ")")
177177

178178
// Update config
179+
if registryURL != "" {
180+
imageName = registryURL + "/" + imageName
181+
}
182+
179183
generatedConfig.ImageTags[imageName] = imageTag
180184

181185
log.Done("Done building and pushing image '" + imageName + "'")

pkg/devspace/registry/registry.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,30 @@ func waitForRegistry(registryNamespace, registryReleaseDeploymentName string, cl
135135
// GetImageURL returns the image (optional with tag)
136136
func GetImageURL(generatedConfig *generated.Config, imageConfig *v1.ImageConfig, includingLatestTag bool) string {
137137
image := *imageConfig.Name
138+
registryURL := ""
138139

139140
if imageConfig.Registry != nil {
140141
registryConfig, registryConfErr := GetRegistryConfig(imageConfig)
141142
if registryConfErr != nil {
142143
log.Fatal(registryConfErr)
143144
}
144145

145-
registryURL := *registryConfig.URL
146+
registryURL = *registryConfig.URL
146147
if registryURL != "" && registryURL != "hub.docker.com" {
147148
image = registryURL + "/" + image
148149
}
149150
}
150151

152+
fullImageName := *imageConfig.Name
153+
if registryURL != "" {
154+
fullImageName = registryURL + "/" + fullImageName
155+
}
156+
151157
if includingLatestTag {
152158
if imageConfig.Tag != nil {
153159
image = image + ":" + *imageConfig.Tag
154160
} else {
155-
image = image + ":" + generatedConfig.ImageTags[*imageConfig.Name]
161+
image = image + ":" + generatedConfig.ImageTags[fullImageName]
156162
}
157163
}
158164

0 commit comments

Comments
 (0)