Skip to content

feat: add workspace sources for seeding files from ConfigMaps and Git repos#222

Draft
xcoulon wants to merge 2 commits into
codeready-toolchain:masterfrom
xcoulon:agent-sources
Draft

feat: add workspace sources for seeding files from ConfigMaps and Git repos#222
xcoulon wants to merge 2 commits into
codeready-toolchain:masterfrom
xcoulon:agent-sources

Conversation

@xcoulon

@xcoulon xcoulon commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Extend WorkspaceSpec with inlineSources, configMapSources, and
gitSources to seed agent configuration files (SOUL.md, AGENTS.md,
TOOLS.md, etc.) from inline content, ConfigMap keys, or Git repositories
with HTTPS token auth for private repos.

  • Add SeedMode type (overwrite/seedIfMissing) with three-tier
    cascade: item → source → global default (overwrite)
  • Add InlineSource, ConfigMapSource, ConfigMapRef, ConfigMapItem,
    GitSource, GitItem API types to api/v1alpha1/claw_types.go
  • Deprecate spec.workspace.files; controller normalizes entries to
    InlineSources with seedIfMissing mode for backward compatibility
  • Add validateAllWorkspacePaths() to reject duplicate target paths
    across source types
  • Add validateConfigMapSources() to verify referenced ConfigMaps exist
    and contain specified keys
  • Generate a seeding manifest (_seed_manifest.json) describing all file
    sources, targets, and modes — consumed by init-seed container
  • Add injectConfigMapSourceVolumes() for ConfigMap volume mounting
  • Add injectGitSyncInitContainer() with alpine/git clone script,
    proxy routing, and HTTPS token injection via secretKeyRef
  • Add injectSeedInitContainer() with mode-aware copy logic
  • Refactor merge.js to remove file seeding (moved to init-seed);
    builtin files (AGENTS.md, SOUL.md, BOOTSTRAP.md) now flow through the
    seed manifest
  • Add GIT_SYNC_IMAGE env var to cmd/main.go and
    config/manager/manager.yaml
  • Extract enrichWorkspaceSources() to reduce cyclomatic complexity

Assisted-by: Claude Opus 4.6 (1M context)
Signed-off-by: Xavier Coulon xcoulon@redhat.com

… repos

Extend `WorkspaceSpec` with `inlineSources`, `configMapSources`, and
`gitSources` to seed agent configuration files (SOUL.md, AGENTS.md,
TOOLS.md, etc.) from inline content, ConfigMap keys, or Git repositories
with HTTPS token auth for private repos.

- Add `SeedMode` type (`overwrite`/`seedIfMissing`) with three-tier
  cascade: item → source → global default (`overwrite`)
- Add `InlineSource`, `ConfigMapSource`, `ConfigMapRef`, `ConfigMapItem`,
  `GitSource`, `GitItem` API types to `api/v1alpha1/claw_types.go`
- Deprecate `spec.workspace.files`; controller normalizes entries to
  `InlineSources` with `seedIfMissing` mode for backward compatibility
- Add `validateAllWorkspacePaths()` to reject duplicate target paths
  across source types
- Add `validateConfigMapSources()` to verify referenced ConfigMaps exist
  and contain specified keys
- Generate a seeding manifest (`_seed_manifest.json`) describing all file
  sources, targets, and modes — consumed by `init-seed` container
- Add `injectConfigMapSourceVolumes()` for ConfigMap volume mounting
- Add `injectGitSyncInitContainer()` with `alpine/git` clone script,
  proxy routing, and HTTPS token injection via `secretKeyRef`
- Add `injectSeedInitContainer()` with mode-aware copy logic
- Refactor `merge.js` to remove file seeding (moved to `init-seed`);
  builtin files (AGENTS.md, SOUL.md, BOOTSTRAP.md) now flow through the
  seed manifest
- Add `GIT_SYNC_IMAGE` env var to `cmd/main.go` and
  `config/manager/manager.yaml`
- Extract `enrichWorkspaceSources()` to reduce cyclomatic complexity

Assisted-by: Claude Opus 4.6 (1M context)
Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 25164526-249a-4383-a791-02c650ae4e2b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@alexeykazakov alexeykazakov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@pavelanni

Copy link
Copy Markdown

Will it be possible to mark certain workspace files as "readOnly"?

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.31118% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.16%. Comparing base (a0cb5ba) to head (efb70af).

Files with missing lines Patch % Lines
internal/controller/claw_workspace.go 92.25% 13 Missing and 10 partials ⚠️
internal/controller/claw_resource_controller.go 44.11% 12 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #222      +/-   ##
==========================================
+ Coverage   78.54%   79.16%   +0.61%     
==========================================
  Files          33       33              
  Lines        4382     4704     +322     
==========================================
+ Hits         3442     3724     +282     
- Misses        598      622      +24     
- Partials      342      358      +16     
Files with missing lines Coverage Δ
internal/controller/claw_resource_controller.go 63.95% <44.11%> (-0.91%) ⬇️
internal/controller/claw_workspace.go 89.91% <92.25%> (+10.97%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

4 participants