Skip to content

Commit 4f5c55a

Browse files
build: defer companion repo mutex unlock inside IIFE
Move companionRepoMu.Lock()/Unlock() inside the IIFE so the unlock is deferred and runs even if helmRepoAdd/helmRepoUpdate panic, while keeping the lock scoped to repo registration only — the long-running helm upgrade --install --wait still runs unlocked, preserving parallelism. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent eea5f6e commit 4f5c55a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • scripts/camunda-deployer/pkg/deployer

scripts/camunda-deployer/pkg/deployer/helm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,9 @@ func deployCompanionCharts(ctx context.Context, o types.Options) error {
244244
func deployCompanionChart(ctx context.Context, cc types.CompanionChart, o types.Options) error {
245245
// Ensure the Helm repo is registered when a repo-style chart ref is used.
246246
if cc.RepoName != "" && cc.RepoURL != "" {
247-
companionRepoMu.Lock()
248247
err := func() error {
248+
companionRepoMu.Lock()
249+
defer companionRepoMu.Unlock()
249250
if err := helmRepoAdd(ctx, cc.RepoName, cc.RepoURL); err != nil {
250251
return fmt.Errorf("companion chart %q: repo add failed: %w", cc.ReleaseName, err)
251252
}
@@ -254,7 +255,6 @@ func deployCompanionChart(ctx context.Context, cc types.CompanionChart, o types.
254255
}
255256
return nil
256257
}()
257-
companionRepoMu.Unlock()
258258
if err != nil {
259259
return err
260260
}

0 commit comments

Comments
 (0)