Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #424 from hhellyer/no_docker_login_on_che_0.11.0
Browse files Browse the repository at this point in the history
[0.11.0] Check if the installer is running in Che before doing docker login.
  • Loading branch information
tobespc authored Apr 3, 2020
2 parents 25318ee + d1a6140 commit 212554c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/actions/registrysecrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ func AddRegistrySecret(c *cli.Context) {
// Log in to local docker to support extensions such as appsody.
// Do this first as it will validate the credentials.
// Otherwise we have to undo everything else if they are wrong.
dockerErr := docker.LoginToRegistry(address, username, password)
if dockerErr != nil {
HandleDockerError(dockerErr)
os.Exit(1)
_, foundChe := os.LookupEnv("CHE_API_EXTERNAL")
if !foundChe {
dockerErr := docker.LoginToRegistry(address, username, password)
if dockerErr != nil {
HandleDockerError(dockerErr)
os.Exit(1)
}
}

// If this is a local connection we need to persist the details in the
Expand All @@ -60,7 +63,7 @@ func AddRegistrySecret(c *cli.Context) {
if conInfo.ID == "local" {

// Add the credentials to the local keyring.
dockerErr = docker.AddDockerCredential(conInfo.ID, address, username, password)
dockerErr := docker.AddDockerCredential(conInfo.ID, address, username, password)
if dockerErr != nil {
HandleDockerError(dockerErr)
os.Exit(1)
Expand Down

0 comments on commit 212554c

Please sign in to comment.