Skip to content

Commit

Permalink
Simplify image name from registry (#1457)
Browse files Browse the repository at this point in the history
* Simplify image name from registry

Signed-off-by: Javier López Barba <javier@okteto.com>

* Call to registry instead of using regex

Signed-off-by: Javier López Barba <javier@okteto.com>
  • Loading branch information
jLopezbarb committed Apr 28, 2021
1 parent 9212a96 commit aec4f85
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/up/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/okteto/okteto/pkg/k8s/volumes"
"github.com/okteto/okteto/pkg/log"
"github.com/okteto/okteto/pkg/model"
"github.com/okteto/okteto/pkg/okteto"
"github.com/okteto/okteto/pkg/registry"
appsv1 "k8s.io/api/apps/v1"
apiv1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -310,7 +311,7 @@ func (up *upContext) waitUntilDevelopmentContainerIsRunning(ctx context.Context)
case "Killing":
return errors.ErrDevPodDeleted
case "Pulling":
message := strings.Replace(e.Message, "Pulling", "pulling", 1)
message := getPullingMessage(e.Message, up.Dev.Namespace)
spinner.Update(fmt.Sprintf("%s...", message))
if err := config.UpdateStateFile(up.Dev, config.Pulling); err != nil {
log.Infof("error updating state: %s", err.Error())
Expand Down Expand Up @@ -340,3 +341,12 @@ func (up *upContext) waitUntilDevelopmentContainerIsRunning(ctx context.Context)
}
}
}

func getPullingMessage(message, namespace string) string {
registry, err := okteto.GetRegistry()
if err != nil {
return message
}
toReplace := fmt.Sprintf("%s/%s", registry, namespace)
return strings.Replace(message, toReplace, "okteto.dev", 1)
}

0 comments on commit aec4f85

Please sign in to comment.