You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless I'm mistaken, a new runbook can never be created when using the runbook repositories CreateOrModify method because a retention policy is required but there's no means to supply one.
[OctopusValidationException]
There was a problem with your request.
Please assign a run retention policy to the Runbook.
Here's an extension method I've created to replace the broken CreateOrModify(…) method:
publicstaticclassOctopusClientExtensions{/// <summary>/// This is analogous to the out-of-the-box CreateOrModify method, which seems to be broken at the moment./// This version supports modifying the resource prior to being saved./// The shipped implementation of the method fails to create a new runbook because retention policy is required,/// but there's no means of supplying one.////// The delegate is provided a tuple with the runbook resource and a boolean indicating if the runbook is being created/// for the first time./// </summary>publicstaticasyncTask<RunbookResource>CreateOrModify(thisIRunbookRepositoryrepository,ProjectResourceproject,stringname,Action<(RunbookResourceRunbook,boolIsNew)>mutate){varrunbook=awaitrepository.FindByName(project,name).ConfigureAwait(false);if(runbook==null){runbook=newRunbookResource{ProjectId=project.Id,Name=name};mutate?.Invoke((runbook,true));returnawaitrepository.Create(runbook);}mutate?.Invoke((runbook,false));returnawaitrepository.Modify(runbook);}}
Please let me know if I'm simply using the client incorrectly!
The text was updated successfully, but these errors were encountered:
Unless I'm mistaken, a new runbook can never be created when using the runbook repositories
CreateOrModify
method because a retention policy is required but there's no means to supply one.Example
Error:
Here's an extension method I've created to replace the broken CreateOrModify(…) method:
Please let me know if I'm simply using the client incorrectly!
The text was updated successfully, but these errors were encountered: