Skip to content

feat: smart GHA/GitLab generation via cigen (PR5/7)#18

Merged
intel352 merged 5 commits into
mainfrom
feat/cigen-smart-rewire
May 30, 2026
Merged

feat: smart GHA/GitLab generation via cigen (PR5/7)#18
intel352 merged 5 commits into
mainfrom
feat/cigen-smart-rewire

Conversation

@intel352
Copy link
Copy Markdown
Contributor

What

PR5 (final) of the wfctl secrets wizard + smart CI cascade. Rewires step.ci_generate's github_actions and gitlab_ci platforms to the new config-derived cigen engine (workflow v0.67.0), so the plugin step produces the same smart, deploy-ready output as wfctl ci generate. jenkins and circleci keep their existing template generators (smart support for those is future work).

Changes

  • build(deps): bump github.com/GoCodeAlone/workflow v0.64.0 → v0.67.0 (exports cigen).
  • feat(contract): additive from_plan + phase_config optional fields on CIGenerateInput (next free field numbers; no renumbering). pb.go regenerated with protoc.
  • feat: ExecuteCIGenerate routes github_actions/gitlab_ci through cigen.Analyze + cigen.RenderGitHubActions/RenderGitLabCI (or renders a from_plan CIPlan JSON directly); writes via the existing path-traversal-guarded writer. jenkins/circleci untouched.
  • chore: bump minEngineVersion 0.53.0 → 0.67.0 (cigen requires it).

Behavior delta

github_actions output now carries cigen-derived secret env bindings (${{ secrets.* }} from env_vars_secret), a functional wfctl migrations up step, and a healthz smoke job — none of which the old template produced. Verified by TestExecuteCIGenerateGitHubActions_CigenMarkers; jenkins/circleci confirmed unchanged by their template-unchanged tests.

Verification

  • GOWORK=off go build ./... && go test ./... → all 27 pass; golangci-lint → 0 issues.

Notes

  • Registry manifest sync (version + minEngineVersion) follows on merge+release.
  • Copilot review not requested (service down per operator).

🤖 Generated with Claude Code

intel352 and others added 5 commits May 30, 2026 18:22
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add optional from_plan (field 7) and phase_config (field 8) to both
CIGenerateConfig and CIGenerateInput. from_plan allows rendering from a
pre-computed CIPlan JSON; phase_config wires a prereq deploy phase.
Regenerated pb.go via protoc v35 + protoc-gen-go (paths=source_relative).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rcleci keep templates)

Route github_actions and gitlab_ci through cigen.Analyze → Render* instead of
the old template generators. from_plan (field 7) allows rendering from a
pre-computed CIPlan JSON. phase_config (field 8) injects a prereq deploy phase.
Jenkins and CircleCI continue to use the existing template generators.

TDD: add 4 targeted tests —
  CigenMarkers for github_actions (secrets env, wfctl migrations up, no old
  build.yml/deploy.yml split) and gitlab_ci (WFCTL_VERSION, migrations up, no
  image: golang line); TemplateUnchanged for jenkins + circleci.
testdata/app.yaml: representative config with env_vars_secret + ci.migrations.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ve CI paths

When infra_config is an absolute path (or outside the repo checkout),
cigen.Analyze's filepath.Rel(cwd, abs) can yield an absolute or "../"-escaping
path that lands in the generated `wfctl infra apply --config <path>` steps and
the `paths:` trigger filter, producing CI that never matches a checkout. Pass a
cleaned repo-relative alias via cigen.Options.ConfigPathAlias (and
PhaseConfigAlias when phase_config is set): cleanConfigAlias collapses absolute
or ".."-containing paths to the base filename, else filepath.Clean.

Tests: TestExecuteCIGenerateGitHubActions_AbsoluteConfigRendersRepoRelative
(absolute tmp config renders `--config 'deploy.yaml'` + relative paths entry,
no absolute/".." leak) and TestCleanConfigAlias unit cases.

Also annotate the retained NewGitHubActionsGenerator/NewGitLabCIGenerator as
template-reference fallbacks (those platforms now route through cigen) so the
unreferenced constructors don't read as dead code.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@intel352 intel352 merged commit 5fc83e7 into main May 30, 2026
3 checks passed
@intel352 intel352 deleted the feat/cigen-smart-rewire branch May 30, 2026 22:34
intel352 added a commit that referenced this pull request May 31, 2026
* chore: bump plugin to v0.3.0 — v0.2.0 tag already released for #18 (cigen GHA/GitLab); #804 extends config-derived to jenkins/circleci

* docs: pin example to v0.3.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant