@@ -120,7 +120,7 @@ func (impl *GitManagerBaseImpl) Fetch(gitCtx GitContext, rootDir string) (respon
120
120
}
121
121
defer commonLibGitManager .DeleteTlsFiles (tlsPathInfo )
122
122
output , errMsg , err := impl .runCommandWithCred (cmd , gitCtx .Username , gitCtx .Password , tlsPathInfo )
123
- if strings .Contains (output , LOCK_REF_MESSAGE ) {
123
+ if strings .Contains (output , util . LOCK_REF_MESSAGE ) {
124
124
impl .logger .Info ("error in fetch, pruning local refs and retrying" , "rootDir" , rootDir )
125
125
// running git remote prune origin and retrying fetch. gitHub issue - https://github.com/devtron-labs/devtron/issues/4605
126
126
pruneCmd , pruneCmdCancel := impl .createCmdWithContext (gitCtx , "git" , "-C" , rootDir , "remote" , "prune" , "origin" )
@@ -176,7 +176,7 @@ func (impl *GitManagerBaseImpl) LogMergeBase(gitCtx GitContext, rootDir, from st
176
176
177
177
func (impl * GitManagerBaseImpl ) runCommandWithCred (cmd * exec.Cmd , userName , password string , tlsPathInfo * commonLibGitManager.TlsPathInfo ) (response , errMsg string , err error ) {
178
178
cmd .Env = append (os .Environ (),
179
- fmt .Sprintf ("GIT_ASKPASS=%s" , GIT_ASK_PASS ),
179
+ fmt .Sprintf ("GIT_ASKPASS=%s" , util . GIT_ASK_PASS ),
180
180
fmt .Sprintf ("GIT_USERNAME=%s" , userName ),
181
181
fmt .Sprintf ("GIT_PASSWORD=%s" , password ),
182
182
)
@@ -205,9 +205,10 @@ func (impl *GitManagerBaseImpl) runCommand(cmd *exec.Cmd) (response, errMsg stri
205
205
if ! ok {
206
206
return output , errMsg , err
207
207
}
208
- if strings .Contains (output , AUTHENTICATION_FAILED_ERROR ) {
209
- impl .logger .Errorw ("authentication failed" , "msg" , string (outBytes ), "err" , err .Error ())
210
- return output , "authentication failed" , errors .New ("authentication failed" )
208
+ customErrMsg := util .GetErrMsgFromCliMessage (output )
209
+ if customErrMsg != "" {
210
+ impl .logger .Errorw (customErrMsg , "msg" , string (outBytes ), "err" , err .Error ())
211
+ return output , customErrMsg , errors .New (customErrMsg )
211
212
}
212
213
if exErr .Stderr == nil {
213
214
return output , errMsg , err
0 commit comments