mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-21 11:18:33 +02:00
Provide full path to Docker config file
Add tests. The tests assume a POSIX file system, but it seems many other tests assume Linux, so perhaps this is not a problem, or at least does not add a new problem. Fixes #1235
This commit is contained in:
@@ -55,14 +55,16 @@ const (
|
||||
UpstreamClientUaKey = "UPSTREAM_CLIENT_TYPE"
|
||||
)
|
||||
|
||||
// DockerConfLocation returns the file system location of the Docker configuration
|
||||
// from the DOCKER_CONFIG environment variable. If that variable is not set, it
|
||||
// returns "/kaniko/.docker/config.json".
|
||||
// DockerConfLocation returns the file system location of the Docker
|
||||
// configuration file under the directory set in the DOCKER_CONFIG environment
|
||||
// variable. If that variable is not set, it returns the OS-equivalent of
|
||||
// "/kaniko/.docker/config.json".
|
||||
func DockerConfLocation() string {
|
||||
if dockerConfLocation := os.Getenv("DOCKER_CONFIG"); dockerConfLocation != "" {
|
||||
return dockerConfLocation
|
||||
configFile := "config.json"
|
||||
if dockerConfDir := os.Getenv("DOCKER_CONFIG"); dockerConfDir != "" {
|
||||
return filepath.Join(dockerConfDir, configFile)
|
||||
}
|
||||
return "/kaniko/.docker/config.json"
|
||||
return string(os.PathSeparator) + filepath.Join("kaniko", ".docker", configFile)
|
||||
}
|
||||
|
||||
func (w *withUserAgent) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
|
||||
Reference in New Issue
Block a user