Skip to content

Improve speed to huge mono repo with different target branch #961

@yuyuvn

Description

@yuyuvn

Is your feature request related to a problem? Please describe.
We using a huge monorepo with multi argocd application.
Each application has a different git write back branch.
There are case that 1 image change create more than 300 application update. Each update need to wait for each other because we have a mutex for same git repo url.

Describe the solution you'd like
From #177 , we have a mutex when pushing to git. But the key is base on git url. I think we can change mutex key to something like gitUrl:targetBranch

func commitChangesLocked(app *v1alpha1.Application, wbc *WriteBackConfig, state *SyncIterationState, changeList []ChangeEntry) error {
	if wbc.RequiresLocking() {
-		lock := state.GetRepositoryLock(wbc.GitRepo)
+               lock := state.GetRepositoryLock(fmt.Sprintf("%s:%s", wbc.GitRepo, wbc.GitBranch))
		lock.Lock()
		defer lock.Unlock()
	}

	return commitChanges(app, wbc, changeList)
}

Additional context
We don't directly push to master branch because of our company audit policy, which need approve from CODEOWNER to push any change into production.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions