@@ -247,10 +247,11 @@ func (impl *RepositoryManagerImpl) Fetch(gitCtx GitContext, url string, location
247247 res , errMsg , err := impl .gitManager .Fetch (gitCtx , location )
248248
249249 if err == nil && len (res ) > 0 {
250+ onlySSHWarning := IsOutputOnlySSHWarning (res )
250251 impl .logger .Infow ("repository updated" , "location" , url )
251252 //updated
252253 middleware .GitPullDuration .WithLabelValues ("true" , "true" ).Observe (time .Since (start ).Seconds ())
253- return true , r , "" , nil
254+ return ! onlySSHWarning , r , "" , nil
254255 } else if err == nil && len (res ) == 0 {
255256 impl .logger .Debugw ("no update for " , "path" , url )
256257 middleware .GitPullDuration .WithLabelValues ("true" , "false" ).Observe (time .Since (start ).Seconds ())
@@ -263,6 +264,19 @@ func (impl *RepositoryManagerImpl) Fetch(gitCtx GitContext, url string, location
263264
264265}
265266
267+ func IsOutputOnlySSHWarning (output string ) bool {
268+ outputSplit := strings .Split (output , "\n " )
269+ if len (outputSplit ) > 1 {
270+ return false
271+ }
272+ for _ , line := range outputSplit {
273+ if strings .Contains (line , "Warning: Permanently added" ) {
274+ return true
275+ }
276+ }
277+ return false
278+ }
279+
266280func (impl * RepositoryManagerImpl ) GetCommitForTag (gitCtx GitContext , checkoutPath , tag string ) (* GitCommitBase , error ) {
267281 var err error
268282 start := time .Now ()
0 commit comments