Skip to content

Commit cdbc756

Browse files
authored
Merge pull request #34 from wunderio/feature/oauth2l-exists
check if oauth2l binary exists before using it
2 parents 286cbcd + 3f98175 commit cdbc756

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/common/ciAuthFunctions.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ func GetGCPOAuth2Token() string {
2828
if !exists {
2929
log.Fatalln("GOOGLE_APPLICATION_CREDENTIALS is not set.")
3030
}
31+
// check if oauth2l binary exists
32+
_, err := exec.LookPath("oauth2l")
33+
if err != nil {
34+
log.Fatalln("oauth2l binary is not found in $PATH. Install it first.")
35+
}
36+
37+
// get oauth2 token
3138
command := "oauth2l fetch --credentials " + gcp_sa_path + " --scope cloud-platform.read-only --cache=\"\""
3239
out, err := exec.Command("bash", "-c", command).CombinedOutput()
3340
if err != nil {

0 commit comments

Comments
 (0)