Hi @Zoren_Manteuffel ,
Thank you for reaching out to Octopus - with regards to updating a steps default values - Octopus tries as much as possible to give you the least amount of surprises. In other words, although you may have updated the default credentials, this will not filter through to all the projects where the step template is used if there are credentials already in the credentials field of those other steps.
I do understand that knowing this won’t help in your situation however, I mention it only to provide context on the thinking behind updating step template default values.
Looking at your specific issue, there are two options for you:
- Go through all the projects where the step is used and manually update the credentials.
- Use the Octopus REST API and write a script to scan the projects in a given Space and update the credentials.
With regards to option #2, there is a REST API script here, which could be tweaked to your requirements.
You’d need to follow it pretty much word-for-word all the way through until you got to the # Get steps section where instead of:
if (($null -ne $step.Properties.'Octopus.Action.TargetRoles') -and ($step.properties.'Octopus.Action.TargetRoles'.Split(',') -Icontains $roleName ))
You would iterate through the project steps looking for and updating the credentials in the relevant step, so maybe something like:
if ($steptemplate.Actions.Properties[0].'uc_Username')
{
$userName = "MyNewDefaultUsername"
}
Use your browser’s Developer Tools to find the relevant REST API parameters:
Finally, upload the changes to Octopus, e.g.
Invoke-RestMethod -Method Put -Uri "$octopusURL/api/$($space.Id)/deploymentprocesses/$($project.DeploymentProcessId)" -Headers $header -Body ($deploymentProcess | ConvertTo-Json -Depth 10)
Of course, it would be remiss of me not to also help you future-proof your scripting work, by recommending that you add the credentials as a variable to a named variable set; which can then be linked to all the projects where the credentials are used.
That way, if the creds ever change again, you only have one place to update them!
Regards
Mark