diff --git a/cmd/revyl/workflow_settings.go b/cmd/revyl/workflow_settings.go index f69a688..935c2ed 100644 --- a/cmd/revyl/workflow_settings.go +++ b/cmd/revyl/workflow_settings.go @@ -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 { diff --git a/internal/api/client.go b/internal/api/client.go index c73ebba..a8be895 100644 --- a/internal/api/client.go +++ b/internal/api/client.go @@ -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 @@ -5447,12 +5448,26 @@ type WorkflowRunConfig struct { // - ctx: Context for cancellation // - workflowID: The workflow UUID // - config: The run configuration to apply +// - override: Whether to override inherited run config from project 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 + } + if config.MaxRetries >= 0 { + 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 } diff --git a/internal/tui/workflow_mgmt.go b/internal/tui/workflow_mgmt.go index 4c3b07c..69c4ac0 100644 --- a/internal/tui/workflow_mgmt.go +++ b/internal/tui/workflow_mgmt.go @@ -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} } }