@ -278,11 +278,15 @@ func (b *GitProviderBootstrapper) reconcileOrgRepository(ctx context.Context) (g
}
}
b . logger . Successf ( "repository %q created" , repoRef . String ( ) )
b . logger . Successf ( "repository %q created" , repoRef . String ( ) )
}
}
// Set default branch before calling Reconcile due to bug described
// Set default branch before calling Reconcile due to bug described
// above.
// above.
repoInfo . DefaultBranch = repo . Get ( ) . DefaultBranch
repoInfo . DefaultBranch = repo . Get ( ) . DefaultBranch
var changed bool
var changed bool
if repo , changed , err = b . provider . OrgRepositories ( ) . Reconcile ( ctx , repoRef , repoInfo ) ; err != nil {
if err = retry ( 1 , 2 * time . Second , func ( ) ( err error ) {
repo , changed , err = b . provider . OrgRepositories ( ) . Reconcile ( ctx , repoRef , repoInfo )
return
} ) ; err != nil {
return nil , fmt . Errorf ( "failed to reconcile Git repository %q: %w" , repoRef . String ( ) , err )
return nil , fmt . Errorf ( "failed to reconcile Git repository %q: %w" , repoRef . String ( ) , err )
}
}
if changed {
if changed {
@ -352,12 +356,16 @@ func (b *GitProviderBootstrapper) reconcileUserRepository(ctx context.Context) (
// above.
// above.
repoInfo . DefaultBranch = repo . Get ( ) . DefaultBranch
repoInfo . DefaultBranch = repo . Get ( ) . DefaultBranch
var changed bool
var changed bool
if repo , changed , err = b . provider . UserRepositories ( ) . Reconcile ( ctx , repoRef , repoInfo ) ; err != nil {
if err = retry ( 1 , 2 * time . Second , func ( ) ( err error ) {
return nil , err
repo , changed , err = b . provider . UserRepositories ( ) . Reconcile ( ctx , repoRef , repoInfo )
return
} ) ; err != nil {
return nil , fmt . Errorf ( "failed to reconcile Git repository %q: %w" , repoRef . String ( ) , err )
}
}
if changed {
if changed {
b . logger . Successf ( "repository %q reconciled" , repoRef . String ( ) )
b . logger . Successf ( "repository %q reconciled" , repoRef . String ( ) )
}
}
return repo , nil
return repo , nil
}
}