Skip to content

Commit 5248422

Browse files
author
gentele
committed
Merge branch 'master' into improve-config
2 parents 38ffb96 + b421ce9 commit 5248422

23 files changed

Lines changed: 651 additions & 272 deletions

File tree

Gopkg.lock

Lines changed: 143 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
source = "https://github.com/moby/moby"
1616
revision = "ae7016427f8cba4e4d8fcb979d6ba313ee2c0702"
1717

18+
[[constraint]]
19+
name = "github.com/docker/cli"
20+
version = "v18.06.1-ce"
21+
1822
[[constraint]]
1923
name = "github.com/rhysd/go-github-selfupdate"
2024
revision = "41c1bbb0804a2994dae69502a8c76e7c456ad45e"

cmd/up.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"github.com/covexo/devspace/pkg/util/log"
1414

15-
"github.com/covexo/devspace/pkg/devspace/kaniko"
15+
"github.com/covexo/devspace/pkg/devspace/builder/kaniko"
1616
"github.com/covexo/devspace/pkg/devspace/registry"
1717
synctool "github.com/covexo/devspace/pkg/devspace/sync"
1818

docs/docs/getting-started/installation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: 1. Installation
55
You can either use one of our install scripts or simply download the released binary for your platform manually.
66

77
## Install Scripts
8-
The following install scripts make it easy to install the DevSpace CLI. Simply copy the the commands into the recommended command line tool.
8+
The following install scripts make it easy to install the DevSpace CLI. Simply copy the the commands into the recommended command line tool. The script will install the devspace CLI and add it to the PATH environment variable.
99

1010
### For Windows
1111
1. Open CMD with **admin rights**.
@@ -16,7 +16,7 @@ curl -s "https://raw.githubusercontent.com/covexo/devspace/master/scripts/instal
1616
del "%Temp%\install-devspace.bat"
1717
```
1818

19-
**Note:** After running the install script, you should close the terminal window that you used to run the install script.
19+
**Note:** After running the install script, you should reopen the terminal window to refresh the environment variables.
2020

2121
### For Linux
2222
1. Run this install script with **root privileges**:
@@ -29,5 +29,5 @@ rm -r "$tmpdir"
2929

3030
## Binary Download
3131
An alternative to the install scripts is to:
32-
1. download the release yourself from the [GitHub releases page](https://github.com/covexo/devspace/releases)
33-
2. and run `PATH_TO_YOUR_RELEASE_FILE install` with admin/root priveleges
32+
1. download the latest release from the [GitHub releases page](https://github.com/covexo/devspace/releases)
33+
2. add the binary folder path to the PATH environment variable **OR** run `PATH_TO_YOUR_RELEASE_FILE install` with admin/root priveleges
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package docker
2+
3+
import (
4+
"context"
5+
"encoding/base64"
6+
"encoding/json"
7+
"fmt"
8+
9+
"github.com/covexo/devspace/pkg/util/log"
10+
"github.com/docker/docker/api/types"
11+
"github.com/docker/docker/client"
12+
"github.com/docker/docker/registry"
13+
)
14+
15+
func getOfficialServer(ctx context.Context, client client.CommonAPIClient) string {
16+
// The daemon `/info` endpoint informs us of the default registry being
17+
// used. This is essential in cross-platforms environment, where for
18+
// example a Linux client might be interacting with a Windows daemon, hence
19+
// the default registry URL might be Windows specific.
20+
serverAddress := registry.IndexServer
21+
if info, err := client.Info(ctx); err != nil {
22+
// Only report the warning if we're in debug mode to prevent nagging during engine initialization workflows
23+
fmt.Fprintf(log.GetInstance(), "Warning: failed to get default registry endpoint from daemon (%v). Using system default: %s\n", err, serverAddress)
24+
} else if info.IndexServerAddress == "" {
25+
fmt.Fprintf(log.GetInstance(), "Warning: Empty registry endpoint from daemon. Using system default: %s\n", serverAddress)
26+
} else {
27+
serverAddress = info.IndexServerAddress
28+
}
29+
30+
return serverAddress
31+
}
32+
33+
func encodeAuthToBase64(authConfig types.AuthConfig) (string, error) {
34+
buf, err := json.Marshal(authConfig)
35+
if err != nil {
36+
return "", err
37+
}
38+
return base64.URLEncoding.EncodeToString(buf), nil
39+
}
40+
41+
func getDefaultAuthConfig(client client.CommonAPIClient, checkCredStore bool, serverAddress string, isDefaultRegistry bool) (*types.AuthConfig, error) {
42+
var authconfig types.AuthConfig
43+
var err error
44+
45+
configfile, _ := loadDockerConfig()
46+
47+
if !isDefaultRegistry {
48+
serverAddress = registry.ConvertToHostname(serverAddress)
49+
}
50+
51+
if checkCredStore {
52+
authconfig, err = configfile.GetAuthConfig(serverAddress)
53+
} else {
54+
authconfig = types.AuthConfig{}
55+
}
56+
57+
authconfig.ServerAddress = serverAddress
58+
authconfig.IdentityToken = ""
59+
return &authconfig, err
60+
}

0 commit comments

Comments
 (0)