Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func getBranchCommitAndURL() (branch, commit, url string) {
}
log.Printf("repo=%q / commit=%q / branch=%q", repo, commit, branch)
url = "github.com/" + repo
return
return branch, commit, url
}

func DockerGitRepo(url string, commit string, branch string) string {
Expand Down
28 changes: 14 additions & 14 deletions pkg/buildcontext/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ func TestGetGitPullMethod(t *testing.T) {
testName: "noEnv",
setEnv: func() (expectedValue string) {
expectedValue = gitPullMethodHTTPS
return
return expectedValue
},
},
{
testName: "emptyEnv",
setEnv: func() (expectedValue string) {
_ = os.Setenv(gitPullMethodEnvKey, "")
expectedValue = gitPullMethodHTTPS
return
return expectedValue
},
},
{
Expand All @@ -54,23 +54,23 @@ func TestGetGitPullMethod(t *testing.T) {
} else {
expectedValue = gitPullMethodHTTP
}
return
return expectedValue
},
},
{
testName: "httpsEnv",
setEnv: func() (expectedValue string) {
_ = os.Setenv(gitPullMethodEnvKey, gitPullMethodHTTPS)
expectedValue = gitPullMethodHTTPS
return
return expectedValue
},
},
{
testName: "unknownEnv",
setEnv: func() (expectedValue string) {
_ = os.Setenv(gitPullMethodEnvKey, "unknown")
expectedValue = gitPullMethodHTTPS
return
return expectedValue
},
},
}
Expand All @@ -92,23 +92,23 @@ func TestGetGitAuth(t *testing.T) {
testName: "noEnv",
setEnv: func() (expectedValue transport.AuthMethod) {
expectedValue = nil
return
return expectedValue
},
},
{
testName: "emptyUsernameEnv",
setEnv: func() (expectedValue transport.AuthMethod) {
_ = os.Setenv(gitAuthUsernameEnvKey, "")
expectedValue = nil
return
return expectedValue
},
},
{
testName: "emptyPasswordEnv",
setEnv: func() (expectedValue transport.AuthMethod) {
_ = os.Setenv(gitAuthPasswordEnvKey, "")
expectedValue = nil
return
return expectedValue
},
},
{
Expand All @@ -117,7 +117,7 @@ func TestGetGitAuth(t *testing.T) {
_ = os.Setenv(gitAuthUsernameEnvKey, "")
_ = os.Setenv(gitAuthPasswordEnvKey, "")
expectedValue = nil
return
return expectedValue
},
},
{
Expand All @@ -126,7 +126,7 @@ func TestGetGitAuth(t *testing.T) {
username := "foo"
_ = os.Setenv(gitAuthUsernameEnvKey, username)
expectedValue = &http.BasicAuth{Username: username}
return
return expectedValue
},
},
{
Expand All @@ -135,7 +135,7 @@ func TestGetGitAuth(t *testing.T) {
pass := "super-secret-password-1234"
_ = os.Setenv(gitAuthPasswordEnvKey, pass)
expectedValue = &http.BasicAuth{Password: pass}
return
return expectedValue
},
},
{
Expand All @@ -146,7 +146,7 @@ func TestGetGitAuth(t *testing.T) {
_ = os.Setenv(gitAuthUsernameEnvKey, username)
_ = os.Setenv(gitAuthPasswordEnvKey, pass)
expectedValue = &http.BasicAuth{Username: username, Password: pass}
return
return expectedValue
},
},
{
Expand All @@ -155,7 +155,7 @@ func TestGetGitAuth(t *testing.T) {
token := "some-other-token"
_ = os.Setenv(gitAuthTokenEnvKey, token)
expectedValue = &http.BasicAuth{Username: token}
return
return expectedValue
},
},
{
Expand All @@ -168,7 +168,7 @@ func TestGetGitAuth(t *testing.T) {
_ = os.Setenv(gitAuthPasswordEnvKey, pass)
_ = os.Setenv(gitAuthTokenEnvKey, token)
expectedValue = &http.BasicAuth{Username: token}
return
return expectedValue
},
},
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/buildcontext/https.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ func (h *HTTPSTar) UnpackTarFromBuildContext() (directory string, err error) {
tarPath := filepath.Join(directory, constants.ContextTar)
file, err := util.CreateTargetTarfile(tarPath)
if err != nil {
return
return directory, err
}

// Download tar file from remote https server
// and save it into the target tar file
resp, err := http.Get(h.context) //nolint:noctx
if err != nil {
return
return directory, err
}
defer func() {
if closeErr := resp.Body.Close(); err == nil && closeErr != nil {
Expand All @@ -69,7 +69,7 @@ func (h *HTTPSTar) UnpackTarFromBuildContext() (directory string, err error) {
logrus.Info("Retrieved https tar file")

if err = util.UnpackCompressedTar(tarPath, directory); err != nil {
return
return directory, err
}

logrus.Info("Extracted https tar file")
Expand Down
4 changes: 2 additions & 2 deletions pkg/filesystem/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func ResolvePaths(paths []string, wl []util.IgnoreListEntry) (pathsToAdd []strin
if e != nil {
if !os.IsNotExist(e) {
logrus.Errorf("Couldn't eval %s with link %s", f, link)
return
return pathsToAdd, err
}

logrus.Tracef("Symlink path %s, target does not exist", f)
Expand All @@ -94,7 +94,7 @@ func ResolvePaths(paths []string, wl []util.IgnoreListEntry) (pathsToAdd []strin

// Also add parent directories to keep the permission of them correctly.
pathsToAdd = filesWithParentDirs(pathsToAdd)
return
return pathsToAdd, err
}

// filesWithParentDirs returns every ancestor path for each provided file path.
Expand Down
Loading