Skip to content

Commit

Permalink
Adding verbose logging regarding SHUTTLE_GIT_TOKEN (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsBogeskov authored Nov 27, 2024
1 parent dd19e9f commit 345857d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,19 @@ func GetGitPlan(
}

var cloneArg string
cloneToken := os.Getenv("SHUTTLE_GIT_TOKEN")
if parsedGitPlan.Protocol == "https" {
cloneToken := os.Getenv("SHUTTLE_GIT_TOKEN")
if cloneToken == "" {
cloneArg = "https://" + parsedGitPlan.Repository
} else {
cloneArg = fmt.Sprintf("https://%s@%s", cloneToken, parsedGitPlan.Repository)
uii.Verboseln("Found clone token in env. Overriding clone path to %s", cloneArg)
}
} else if parsedGitPlan.Protocol == "ssh" {
if cloneToken != "" {
uii.Verboseln("Found clone token in env, but shuttle path was ssh-based. This override will not work.")
}

cloneArg = parsedGitPlan.User + "@" + parsedGitPlan.Repository
} else {
panic(fmt.Sprintf("Unknown protocol '%s'", parsedGitPlan.Protocol))
Expand Down

0 comments on commit 345857d

Please sign in to comment.