-
Notifications
You must be signed in to change notification settings - Fork 18
feat: support multiple job agent configs for a deployment #807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
08ff21e
c3ebebb
050a392
fd3ebe7
4d10f38
1e00c9c
4d18faa
27bfb7f
63eda58
38e43be
0838c02
6593730
63e336a
80dcbed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,11 +11,22 @@ local openapi = import '../lib/openapi.libsonnet'; | |||||||||||||||||||||||||||||||||||||
| description: { type: 'string' }, | ||||||||||||||||||||||||||||||||||||||
| jobAgentId: { type: 'string' }, | ||||||||||||||||||||||||||||||||||||||
| jobAgentConfig: openapi.schemaRef('JobAgentConfig'), | ||||||||||||||||||||||||||||||||||||||
| jobAgents: { type: 'array', items: openapi.schemaRef('DeploymentJobAgent') }, | ||||||||||||||||||||||||||||||||||||||
| resourceSelector: openapi.schemaRef('Selector'), | ||||||||||||||||||||||||||||||||||||||
| metadata: { type: 'object', additionalProperties: { type: 'string' } }, | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| DeploymentJobAgent: { | ||||||||||||||||||||||||||||||||||||||
| type: 'object', | ||||||||||||||||||||||||||||||||||||||
| required: ['ref', 'config', 'selector'], | ||||||||||||||||||||||||||||||||||||||
| properties: { | ||||||||||||||||||||||||||||||||||||||
| ref: { type: 'string' }, | ||||||||||||||||||||||||||||||||||||||
| config: openapi.schemaRef('JobAgentConfig'), | ||||||||||||||||||||||||||||||||||||||
| selector: { type: 'string', description: 'CEL expression to determine if the job agent should be used' }, | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+28
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Check the current state of deployments.jsonnet schema
cd apps/workspace-engine && cat -n oapi/spec/schemas/deployments.jsonnet | sed -n '1,50p'Repository: ctrlplanedev/ctrlplane Length of output: 2007 🏁 Script executed: # Look for the DeploymentJobAgent definition and surrounding context
cd apps/workspace-engine && rg -n "DeploymentJobAgent" oapi/spec/schemas/deployments.jsonnet -A 10 -B 2Repository: ctrlplanedev/ctrlplane Length of output: 802 🏁 Script executed: # Check the generated Go type for DeploymentJobAgent
cd apps/workspace-engine && rg -n "type DeploymentJobAgent struct" pkg/oapi/oapi.gen.go -A 15Repository: ctrlplanedev/ctrlplane Length of output: 694 🏁 Script executed: # Find the test mentioned in the review
cd apps/workspace-engine && rg -n "AllAgentsNoCondition" . --type go -B 3 -A 15Repository: ctrlplanedev/ctrlplane Length of output: 1414 🏁 Script executed: # Check if there are other uses of DeploymentJobAgent in tests
cd apps/workspace-engine && rg -n "DeploymentJobAgent{" . --type go -B 2 -A 5Repository: ctrlplanedev/ctrlplane Length of output: 167 🏁 Script executed: # Search for DeploymentJobAgent struct construction
cd apps/workspace-engine && rg -n "DeploymentJobAgent" test/e2e/engine_deployment_test.go -A 5 -B 2Repository: ctrlplanedev/ctrlplane Length of output: 7519 🏁 Script executed: # Check the specific test to see how it uses DeploymentJobAgent
cd apps/workspace-engine && sed -n '1013,1100p' test/e2e/engine_deployment_test.goRepository: ctrlplanedev/ctrlplane Length of output: 3056 🏁 Script executed: # Search for where Selector is being set (or not set) in deployments
cd apps/workspace-engine && rg -n "Selector" test/e2e/engine_deployment_test.go | grep -i "agent\|deployment"Repository: ctrlplanedev/ctrlplane Length of output: 1989 🏁 Script executed: # Look for all test cases that construct DeploymentJobAgent
cd apps/workspace-engine && rg -n "jobAgents" test/e2e/engine_deployment_test.go -B 5 -A 10Repository: ctrlplanedev/ctrlplane Length of output: 48 🏁 Script executed: # Check how selector is evaluated in the deployment job agent logic
cd apps/workspace-engine && rg -n "selector" pkg/ --type go -i | grep -i "agent\|deployment" | head -20Repository: ctrlplanedev/ctrlplane Length of output: 3337 🏁 Script executed: # Look for where DeploymentJobAgent.Selector is actually evaluated/used
cd apps/workspace-engine && rg -n "\.Selector" pkg/ --type go -B 3 -A 3 | grep -i agent -A 5 -B 5Repository: ctrlplanedev/ctrlplane Length of output: 5529 🏁 Script executed: # Get the full context of the deployment_agent_selector.go logic
cd apps/workspace-engine && sed -n '85,105p' pkg/workspace/jobagents/deployment_agent_selector.goRepository: ctrlplanedev/ctrlplane Length of output: 866 🏁 Script executed: # Check if there are other places where DeploymentJobAgent.Selector is evaluated
cd apps/workspace-engine && rg -n "DeploymentJobAgent" pkg/workspace/jobagents/ --type go -A 8 | grep -i "selector"Repository: ctrlplanedev/ctrlplane Length of output: 17722
The tests (e.g., Making ♻️ Proposed fix DeploymentJobAgent: {
type: 'object',
- required: ['ref', 'config', 'selector'],
+ required: ['ref', 'config'],
properties: {
ref: { type: 'string', description: 'Job agent ID to use for this configuration' },
config: openapi.schemaRef('JobAgentConfig'),
- selector: { type: 'string', description: 'CEL expression to determine if the job agent should be used' },
+ selector: { type: 'string', description: 'CEL expression to determine if the job agent should be used. Omit or leave empty to always use this agent.' },
},
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| DeploymentWithVariablesAndSystems: { | ||||||||||||||||||||||||||||||||||||||
| type: 'object', | ||||||||||||||||||||||||||||||||||||||
| required: ['deployment', 'variables', 'systems'], | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 48932
🏁 Script executed:
# First, examine the deployment agent selector implementation head -150 apps/workspace-engine/pkg/workspace/jobagents/deployment_agent_selector.goRepository: ctrlplanedev/ctrlplane
Length of output: 3431
🏁 Script executed:
# Check the jsonnet schema definition cat apps/workspace-engine/oapi/spec/schemas/deployments.jsonnetRepository: ctrlplanedev/ctrlplane
Length of output: 3342
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 48
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 3631
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 620
🏁 Script executed:
Repository: ctrlplanedev/ctrlplane
Length of output: 437
🏁 Script executed:
# Check if the file is using Prettier formatting head -20 apps/workspace-engine/oapi/openapi.jsonRepository: ctrlplanedev/ctrlplane
Length of output: 653
Make
DeploymentJobAgent.ifoptional and documentref.Line 87 of
deployment_agent_selector.goshows that emptyifexpressions are treated as valid (the agent is included). The current schema requiresif, but JSON clients that omit it will default to an empty string—which works fine in the implementation. Similarly,refhas no description. Align the schema with actual behavior by removingiffrom the required array, adding a default value, and documenting whatrefreferences.🧭 Suggested schema tweaks
"if": { "description": "CEL expression to determine if the job agent should be used", - "type": "string" + "type": "string", + "default": "true" }, "ref": { - "type": "string" + "description": "Reference to the job agent (JobAgent.id)", + "type": "string" } ... "required": [ "ref", - "config", - "if" + "config" ],📝 Committable suggestion
🤖 Prompt for AI Agents