argocd-image-updater icon indicating copy to clipboard operation
argocd-image-updater copied to clipboard

Improve speed to huge mono repo with different target branch

Open yuyuvn opened this issue 11 months ago • 0 comments

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 https://github.com/argoproj-labs/argocd-image-updater/pull/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.

yuyuvn avatar Dec 05 '24 03:12 yuyuvn