Is there a consistent way to get the branch name of the package being deployed in a powershell step? The branch name is correctly sent via the build information API and shows up when looking at the package in the library.
I thought I would just touch base to let you know that we are currently investigating this issue, however probably won’t have an answer for you until tomorrow.
The short answer is, no, the array order is not guaranteed. We are looking for a solution at present and will let you know as soon as we have an answer.
The answer to this isn’t as simple as we would like. To remedy that, we will add a Branch property to the package information on the release (I have created an issue). This will allow you to do Octopus.Release.Package[Acme.Web].Branch
In the meantime, the way to get what you want is to iterate over the collection contained in the Octopus.Deployment.Changes variable and find the item with the Version that matches the release version currently being deployed. You then have to iterate over the collection in the BuildInformation property of that object, and find the package you are interested in (e.g. with ID of Acme.Web. If your deployment has only one package, then there will be only one). This object will then have a Branch property.
Hopefully the object structures documented here help with this, but if you have any problems with the script please feel welcome to reach out, and hopefully we can help.