fix(project_create): commit staging namespace directly to infra main
Drops the intermediate `staging/<name>` branch so Flux begins reconciling the namespace within ~60s of `project_create` instead of waiting on a human PR merge. Consistent with project-wide trunk-based development. Rationale: ADR 2026-05-18 in DECISIONS.md. Closes hyperguild#14 (item 1). Item 2 (GITEA_MCP_TOKEN in SOPS) verified already-present in infra@408a527 secrets.enc.yaml. Note: TestRoutingPodEndToEnd is failing on main pre-existing this commit (context deadline waiting for port 33310 in <5s). Not caused by this change; project skill tests pass. To track in a separate issue.
This commit is contained in:
@@ -97,8 +97,7 @@ func (s *Skill) handleCreate(ctx context.Context, raw json.RawMessage) (json.Raw
|
||||
|
||||
// Step 3: commit staging namespace manifest to infra repo. Done before
|
||||
// the issue so the staging env is reconciling by the time the issue lands.
|
||||
branch := fmt.Sprintf("staging/%s", args.Name)
|
||||
if err := s.callInfraCommit(ctx, args.Name, branch); err != nil {
|
||||
if err := s.callInfraCommit(ctx, args.Name); err != nil {
|
||||
if !isConflict(err) {
|
||||
return marshalPartial(res, stepInfraCommit, err)
|
||||
}
|
||||
@@ -171,17 +170,16 @@ func (s *Skill) callMirror(ctx context.Context, name string) error {
|
||||
}, nil)
|
||||
}
|
||||
|
||||
// callInfraCommit writes the staging namespace manifest into the infra repo
|
||||
// on a dedicated branch. Flux picks it up after merge.
|
||||
func (s *Skill) callInfraCommit(ctx context.Context, name, branch string) error {
|
||||
// callInfraCommit writes the staging namespace manifest directly to infra
|
||||
// main. Flux reconciles within ~60s. See DECISIONS.md 2026-05-18.
|
||||
func (s *Skill) callInfraCommit(ctx context.Context, name string) error {
|
||||
manifest := stagingNamespaceManifest(name, time.Now().UTC().Format(time.RFC3339))
|
||||
return s.cfg.Client.CallTool(ctx, "file_write_branch", map[string]any{
|
||||
"owner": s.cfg.GiteaOwner,
|
||||
"name": s.cfg.InfraRepo,
|
||||
"path": fmt.Sprintf("k3s/staging/%s/namespace.yaml", name),
|
||||
"content": manifest,
|
||||
"branch": branch,
|
||||
"base": "main",
|
||||
"branch": "main",
|
||||
"message": fmt.Sprintf("feat(staging): add namespace for %s\n\nGenerated by hyperguild project_create.", name),
|
||||
}, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user