When creating a new release I have the option to deploy multiple packages.
First column is called “step package”
second column is called “latest”.
Step package row 1 says;
And latest row 1 is “3143184.108.40.206”
Step package row 2 says
And latest row 2 is “3143220.127.116.11”
- Dont worry, this is an example.
Once the release is created, I try to run a deploy. The deploy contains a powershell-script in which I try to obtain the values I just described.
$test1 = $OctopusParameters[“Octopus.Action[Deploy frontend].Package[frontend].PackageId”]
However next line is empty
How do i get this value?
Thanks for getting in touch!
Looking at your variable I think the step name and package name might be the wrong way around.
$test1 = $OctopusParameters[“Octopus.Action[stepName].Package[packageName].PackageId”]
It looks like your step name is
Deploy Frontend and your package is
So you’d want to use:
`$test1 = $OctopusParameters[“Octopus.Action[Deploy frontend].Package[frontend].PackageId”]
Thanks for answering, turned out that I had actually written as you suggested - sorry about that.
I fixed the description to avoid further confusion. It did however not fix the issue.
You might have any other ideas?
You could try temporarily adding the system variable
OctopusPrintEvaluatedVariables with a value of
True to your project.
When you create a new release and deploy, the task log will then include all variables available to each step. This might help you identify the correct variable to use.
Can you expand a little more on what you’re aiming to use this variable for?
The reason I ask is that the variable will return the package ID (which would be “frontend”), but that is already being supplied within the variable itself (
$OctopusParameters[“Octopus.Action[Deploy frontend].Package[frontend].PackageId”]) so it seems a little redundant.
Once Azure DevOps is finishing a build, Octopus automatically creates a release on each of our repositories (Lets call them Frontend, Backend & Database) in Octopus.
We cant run deploys on these repos in parallel because they for some reason inherit from eachother.
So they need to run one by one.
So we created a main-pipeline which makes the deploy of each repo await eachother.
But deploying the main, means that we use the latest build-package from Azure, but technically, people can still build older branches, so to get around that, I thought of making an Octopus-variable called ExpectedReleaseVersion (call it “2.0.1”)
Then in the powershell-script i just check whether the ExpectedReleaseVersion is contained in the variable Octopus.Action[Deploy frontend].Package[frontend].PackageVersion.
If the last built version is then 2.0.0, then it wont deploy that repo
I dont which of the following variables would actually containt what i need, but thats a problem for later. Right now i just need one of them to output something:
That was the best tip ever!
Turned out the package-identifier should just be left empty! But it works now.
I ended with:
Have an awesome day!