Skip to content

feat: add AgentRuntime setup script#730

Merged
zreigz merged 6 commits intomainfrom
lukasz/prod-4632-add-agentruntime-setup-script
Apr 15, 2026
Merged

feat: add AgentRuntime setup script#730
zreigz merged 6 commits intomainfrom
lukasz/prod-4632-add-agentruntime-setup-script

Conversation

@zreigz
Copy link
Copy Markdown
Member

@zreigz zreigz commented Apr 13, 2026

Add support for bash script that will be executed inside the cloned repository directory before the coding agent starts

Test Plan

Test environment: https://console.your-env.onplural.sh/

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • I have deployed the agent to a test environment and verified that it works as expected.
    • Agent starts successfully.
    • Service creation works without any issues when using raw manifests and Helm templates.
    • Service creation works when resources contain both CRD and CRD instances.
    • Service templating works correctly.
    • Service errors are reported properly and visible in the UI.
    • Service updates are reflected properly in the cluster.
    • Service resync triggers immediately and works as expected.
    • Sync waves annotations are respected.
    • Sync phases annotations are respected. Phases are executed in the correct order.
    • Sync hook delete policies are respected. Resources are not recreated once they reach the desired state.
    • Service deletion works and cleanups resources properly.
    • Services can be recreated after deletion.
    • Service detachment works and keeps resources unaffected.
    • Services can be recreated after detachment.
    • Service component trees are working as expected.
    • Cluster health statuses are being updated.
    • Agent logs do not contain any errors (after running for at least 30 minutes).
    • There are no visible anomalies in Datadog (after running for at least 30 minutes).
  • I have added tests to cover my changes.
  • If required, I have updated the Plural documentation accordingly.

@zreigz zreigz requested a review from a team as a code owner April 13, 2026 11:16
@linear
Copy link
Copy Markdown

linear bot commented Apr 13, 2026

@zreigz zreigz changed the title add AgentRuntime setup script feat: add AgentRuntime setup script Apr 13, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 13, 2026

Greptile Summary

This PR adds a BootstrapScript field to AgentRuntimeSpec that lets operators supply a bash script to run inside the cloned repository directory before the coding agent starts. The implementation stores the script in a per-run ConfigMap, mounts it as an executable file in the default container, and executes it in preExecHook via the existing exec.NewExecutable helper. The approach is consistent with how browser and DinD sidecars are wired today.

Confidence Score: 5/5

Safe to merge; all remaining findings are P2 style/robustness suggestions that do not block functionality.

No P0 or P1 issues found. The two P2 items in controller_hooks.go (swallowed os.Stat errors, duplicated mount-path constant) and the debug sleep in the sample file are minor quality improvements that don't affect correctness.

pkg/agentrun-harness/controller/controller_hooks.go — minor error-handling and path-duplication concerns.

Important Files Changed

Filename Overview
internal/controller/agentrun_controller.go Adds reconcileBootstrapConfigMap which creates a per-run ConfigMap from AgentRuntime.Spec.BootstrapScript and wires the owner ref to the pod; follows the existing secret reconciliation pattern correctly.
internal/controller/agentrun_pod.go Adds enableBootstrapScript which mounts the bootstrap ConfigMap as an executable file into the default container; volume / VolumeMount wiring is correct.
pkg/agentrun-harness/controller/controller_hooks.go Adds runBootstrapScript executed in preExecHook; has two minor issues: non-NotExist os.Stat errors are swallowed, and the mount path is duplicated from a separate package with no enforcement of synchrony.
config/samples/agentRuntime.yaml Sample updated with a bootstrap script example, but contains a sleep 5 debug artefact that users may copy-paste.
api/v1alpha1/agentruntime_types.go Adds optional BootstrapScript *string field to AgentRuntimeSpec with correct kubebuilder annotation.
api/v1alpha1/zz_generated.deepcopy.go Auto-generated deep copy for the new BootstrapScript pointer field; correct.
charts/deployment-operator/crds/deployments.plural.sh_agentruntimes.yaml CRD schema updated with the new optional bootstrapScript string field; matches the type definition.
config/crd/bases/deployments.plural.sh_agentruntimes.yaml Identical CRD update in the config bases directory; consistent with the charts CRD.

Reviews (1): Last reviewed commit: "add AgentRuntime setup script" | Re-trigger Greptile

Comment thread pkg/agentrun-harness/controller/controller_hooks.go Outdated
Comment thread pkg/agentrun-harness/controller/controller_hooks.go
Comment thread config/samples/agentRuntime.yaml Outdated
zreigz and others added 4 commits April 13, 2026 13:25
@zreigz zreigz merged commit 1024113 into main Apr 15, 2026
109 of 111 checks passed
@zreigz zreigz deleted the lukasz/prod-4632-add-agentruntime-setup-script branch April 15, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants