fix: call ensureProjectJWTSecret in AddComponentBatch
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

AddComponent (single-component path) already calls ensureProjectJWTSecret,
but AddComponentBatch has its own parallel implementation that bypassed it.
Components added via the /batch endpoint never had JWT_SECRET provisioned,
causing CrashLoopBackOff on startup ("JWT_SECRET must be set").

Add the call before the createInitialComponentDeployment loop so the secret
is stored in the credential store before K8s Secrets are created.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jordan 2026-02-23 05:12:26 -07:00
parent ad1f19739d
commit a593605caa

View File

@ -297,12 +297,16 @@ func (s *ComponentService) AddComponentBatch(ctx context.Context, projectID stri
"components", componentNames,
)
// 9. Create initial K8s deployments for components that need one
// 9. Ensure a JWT_SECRET exists for this project (required by skeleton service startup).
// Generated once per project on the first code component; reused for all subsequent components.
s.ensureProjectJWTSecret(ctx, projectID)
// 10. Create initial K8s deployments for components that need one
for _, comp := range codeComponents {
s.createInitialComponentDeployment(ctx, projectID, projectDomain, comp)
}
// 10. Combine infrastructure and code component results
// 11. Combine infrastructure and code component results
results = append(results, codeComponents...)
return results, nil