Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/revyl/workflow_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ func runWorkflowConfigSet(cmd *cobra.Command, args []string) error {
}

ui.StartSpinner("Updating run config...")
err = client.UpdateWorkflowRunConfig(cmd.Context(), workflowID, cfg)
err = client.UpdateWorkflowRunConfig(cmd.Context(), workflowID, cfg, true)
ui.StopSpinner()

if err != nil {
Expand Down
17 changes: 15 additions & 2 deletions internal/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3577,6 +3577,7 @@ type Workflow struct {
BuildConfig map[string]interface{} `json:"build_config,omitempty"`
OverrideBuildConfig bool `json:"override_build_config,omitempty"`
RunConfig *WorkflowRunConfig `json:"run_config,omitempty"`
OverrideRunConfig bool `json:"override_run_config,omitempty"`
}

// CLIWorkflowLastExecution holds the last execution metadata returned by the
Expand Down Expand Up @@ -5447,12 +5448,24 @@ type WorkflowRunConfig struct {
// - ctx: Context for cancellation
// - workflowID: The workflow UUID
// - config: The run configuration to apply
// - override: Whether workflow-level run config overrides org defaults
//
// Returns:
// - error: Any error that occurred
func (c *Client) UpdateWorkflowRunConfig(ctx context.Context, workflowID string, config *WorkflowRunConfig) error {
func (c *Client) UpdateWorkflowRunConfig(ctx context.Context, workflowID string, config *WorkflowRunConfig, override bool) error {
runConfig := map[string]interface{}{}
if config != nil {
if config.Parallelism > 0 {
runConfig["parallelism"] = config.Parallelism
}
runConfig["max_retries"] = config.MaxRetries
}
body := map[string]interface{}{
"run_config": runConfig,
"override_run_config": override,
}
path := fmt.Sprintf("/api/v1/workflows/update_run_config/%s", workflowID)
resp, err := c.doRequest(ctx, "PUT", path, config)
resp, err := c.doRequest(ctx, "PUT", path, body)
if err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion internal/tui/workflow_mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ func saveWorkflowOverridesCmd(client *api.Client, workflowID string, wf *api.Wor
return WorkflowSettingsSavedMsg{Err: err}
}
if wf.RunConfig != nil {
if err := client.UpdateWorkflowRunConfig(ctx, workflowID, wf.RunConfig); err != nil {
if err := client.UpdateWorkflowRunConfig(ctx, workflowID, wf.RunConfig, wf.OverrideRunConfig); err != nil {
return WorkflowSettingsSavedMsg{Err: err}
}
}
Expand Down Expand Up @@ -1749,6 +1749,7 @@ func applySettingsEdit(m *hubModel) {
n := 0
fmt.Sscanf(val, "%d", &n)
wf.RunConfig.Parallelism = n
wf.OverrideRunConfig = true
m.wfSettingsDirty = true
case "max_retries":
if wf.RunConfig == nil {
Expand All @@ -1757,6 +1758,7 @@ func applySettingsEdit(m *hubModel) {
n := 0
fmt.Sscanf(val, "%d", &n)
wf.RunConfig.MaxRetries = n
wf.OverrideRunConfig = true
m.wfSettingsDirty = true
}
}
Expand Down