Make sure we reconcile with the right reconciliation method

Signed-off-by: Soule BA <soule@weave.works>
pull/3085/head
Soule BA 2 years ago
parent c921cf0d54
commit ec2aa13165
No known key found for this signature in database
GPG Key ID: 4D40965192802994

@ -298,11 +298,8 @@ func (b *GitProviderBootstrapper) reconcileOrgRepository(ctx context.Context) (g
var changed bool var changed bool
if b.reconcile { if b.reconcile {
// Set default branch before calling Reconcile due to bug described
// above.
repoInfo.DefaultBranch = repo.Get().DefaultBranch
if err = retry(1, 2*time.Second, func() (err error) { if err = retry(1, 2*time.Second, func() (err error) {
repo, changed, err = b.provider.OrgRepositories().Reconcile(ctx, repoRef, repoInfo) changed, err = repo.Reconcile(ctx)
return return
}); err != nil { }); 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)
@ -373,12 +370,9 @@ func (b *GitProviderBootstrapper) reconcileUserRepository(ctx context.Context) (
} }
if b.reconcile { if b.reconcile {
// Set default branch before calling Reconcile due to bug described
// above.
repoInfo.DefaultBranch = repo.Get().DefaultBranch
var changed bool var changed bool
if err = retry(1, 2*time.Second, func() (err error) { if err = retry(1, 2*time.Second, func() (err error) {
repo, changed, err = b.provider.UserRepositories().Reconcile(ctx, repoRef, repoInfo) changed, err = repo.Reconcile(ctx)
return return
}); err != nil { }); 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)

Loading…
Cancel
Save