Hey, again @kevin.petit,
I’ve confirmed that what you’re seeing is indeed happening on my end!
I’ll get a bug report sorted out ASAP, and I’ll pin it to this thread for anyone else to see and for yourself to follow.
In the meantime, I’ve configured a workaround that I’ve tested and worked on the cloud instance I was testing on.
# Create Script Variables
$octopusUrl = "https://octopusURL"
$octopusAPIKey = "API-XXXXXXXXXXXXXXXXXXXXXXXX"
$header = @{ "X-Octopus-ApiKey" = $octopusAPIKey }
$spaceId = "Spaces-ID"
$projectName = "project name"
$packageName = "package name"
# Obtain Project data
$projectData = Invoke-RestMethod -Method Get "$($octopusUrl)/api/$($spaceId)/projects/$($projectName.Replace(" ", "-").ToLower())" -Headers $header
# Obtain Deployment Settings
$depSettings = Invoke-RestMethod -Method Get "$($octopusUrl)/$($projectData.Links.DeploymentSettings)" -Headers $header
# Set New Package Reference
$depSettings.VersioningStrategy.DonorPackage.PackageReference = $packageName
# API PUT New Settings
Invoke-RestMethod -Method Put "$($octopusUrl)/$($projectData.Links.DeploymentSettings)" -Body ($depSettings | ConvertTo-JSON -Depth 10) -Headers $header
Before running this script, be sure that the current package selected for versioning is one in the same step as what you’re planning to set it to.
Example:
Squirrel/Nuget is the package “Nuget” from the step ‘Squirrel’. If this was selected, you can run the script below to change to any package located within the step ‘Squirrel’, such as “Package”.
In your situation, as shown in the video above, you could place:
“Package”, “PsExec”, “SendTokenPin” in the packageName
field.
The projectName
field is turned into slugs for the API to use, so typing this as it appears in the UI is fine.
Please make sure that you read and understand the script before using it, as incorrectly putting the wrong data into these fields can cause nasty “Resource Not Found” errors.
Running the above script allowed me to set the correct package for versioning, but there was a weird interaction in the UI.
It shows the correct package is selected upon opening Deployment Settings, but when you click on “Release Versioning”, it shows the first package again - this is simply visual as querying the API endpoint shows the correct package, and when creating a release, the correct version is selected.
I hope this helps! As I mentioned, I’ll log the bug and post it back to this thread. If you have any questions or concerns, please reach out, and I’ll do my best to assist.
Kind Regards,
Adam