Error Response-
{
“ErrorMessage”: “There was a problem with your request.”,
“Errors”: [
“Changes to this deployment process could not be saved, because another user has made changes to the deployment process between when you started editing and when you saved your changes. Please reload or open a new tab to make your changes.”
],
“ParsedHelpLinks”:
}
Similar type of post has exist but i cant find the proper resolution here.
Thanks for getting in touch. That error often occurs if the script is modifying a part of a step without including all required fields. The best practice when changing steps in this way is:
Do a GET on your template deployment process and assign that value to a variable
Modify the values of that variable according to the needs of your new projects
PUT the modified template on your new project.
The below sample script amends the role on a specific step. Hopefully, it will help provide a starting point for you. You can find other script samples here:
# You can this dll from your Octopus Server/Tentacle installation directory or from
# https://www.nuget.org/packages/Octopus.Client/
Add-Type -Path 'C:\Program Files\Octopus Deploy\Octopus\Octopus.Client.dll'
$apikey = '<API KEY>' # Get this from your profile
$octopusURI = 'http://localhost' # Your server address
$projectId = "Projects-1" # Get this from /api/projects
$stepName = "Run a script test" # The name of the step
$role = "demo-role" # The machine role to run this step on
$endpoint = New-Object Octopus.Client.OctopusServerEndpoint $octopusURI,$apikey
$repository = New-Object Octopus.Client.OctopusRepository $endpoint
$project = $repository.Projects.Get($projectId)
$process = $repository.DeploymentProcesses.Get($project.DeploymentProcessId)
$step = $process.Steps | Where-Object Name -Match $stepName
$step.Properties.'Octopus.Action.TargetRoles' = $roleName
$repository.DeploymentProcesses.Modify($process)
Please let me know if this helps or if there is any further advice I can offer.