I’m currently doing a POC where we are planning to utilize the Azure DevOps Server Release Pipeline to create and deploy an Octopus Release. During my testing I can hardcode the Release Number (default value is latest). But how can I pass a value to change the following Project variables in Octopus Deploy?
Thanks for getting in touch! Great to hear you’re working on a POC, and I hope the process has been smooth for you so far!
You can control which variable value is used in different deployment contexts by defining their scopes. Meaning if one variable has two different values, each scoped to a different environment (as an example), deployments to these environments will pick up the applicable value. Would this give you the control you’re needing?
Additionally, you can provide a value to a variable at deployment time by defining it as a prompted variable. When deploying via the Azure DevOps plugin, you can supply the value by passing
--variable=Label:Value in the additional arguments section of your Deploy step. You can reference the available arguments at the following doc page.
I hope this helps! Let me know how you go or if you have any further questions going forward.
Thank you for the quick response. My POC right now is not going well. So in my POC I have the two steps one is to create and one to deploy. For the create it looks like it went fine but in the screenshot the Version I pass is 22.214.171.124 which is the version of the package that I want the deployment to use. But as you can see the Version that it wants to use is 126.96.36.199, why? How can I override this value?
Now I look at the https://octopus.com/docs/octopus-rest-api/octo.exe-command-line/create-release link. I’m somewhat confuse with the following maybe you can help me.
–project=VALUE Name or ID of the project
Default version number of all packages to use
for this release. Override per-package using –
[Optional] Release number to use for the new
–package=VALUE [Optional] Version number to use for a package
in the release. Format: StepName:Version or
PackageID, and PackageName can be replaced with
Currently this is my Octo.exe arguments that I pass in the command line:
So in the log I see this:
2019-09-12T13:02:44.3664096Z ##[command]“F:\Agent_work_tasks\OctopusDeployRelease_8ca1d96a-151d-44b7-bc4f-9251e2ea6971\2.0.135\Octo.exe” deploy-release --project=“DevOps2019_Dev2” --releaseNumber=“188.8.131.52” --server=http://xxxx.com/ --apiKey=*** --variable=oTfsProjectName:PHLY.GW.BC.HOTFIXES --variable=packageversion=184.108.40.206 --progress --deployto=“Development”
In the screenshot below you will notice the package is PHLY.GW.BC.HOTFIXES.220.127.116.11. but in command line argument I did pass 18.104.22.168 so where is the 22.214.171.124 coming from and how to I change this at runtime?
Should I be supplying the following command line parameters to make it work?
If so would it be something like this?
–variable=oTfsProjectName:PHLY.GW.BC.HOTFIXES --variable=defaultpackageversion, packageversion:126.96.36.199 --variable=version, releaseNumber:188.8.131.52 --variable=package:PHLY.GW.BC.HOTFIXES.184.108.40.206
I appreciate your help. Thank you in advance.
In addition to my response, in the Azure DevOps release pipeline I first do a create release which I supply the Project Name and in the additiona Octo.exe Arguments section I entered the following: My thinking here is that the package id will be replace with the Package ID (see screenshot of the step). Is this possible? What is the proper way to accomplish this?
–variable=oTfsProjectName:$(Rel_Name) --variable=packageversion:$(Rel_Num) --variable=package:StepA:DevOpsDeployment:$(Rel_Num)
I apologize I should have done this from the beginning. So here is what I’m trying to accomplish and see if it make sense.
So our issue right now is as follows: Our development team has multiple ongoing projects, they also have numerous deployment targets for the sake of simplicity let me just call these targets as Dev1, Dev2, QA1, QA2, MO1(this is a UAT box), MO2 (this is a UAT box), Prod1, Prod2.
The task is to find a solution where depending on availability the deployment can go
Dev1 --> QA2 --> MO2 --> Prod1
Dev1 --> QA1 --> MO1 --> Prod2
Dev2 --> QA1 --> MO2 --> Prod1
So the permutations can be enormous and when using Octopus by itself you have to create a Project that has a linear approach so we cannot go from Dev1 to QA2 etc., this is my understanding without creating multiple projects. I could be wrong.
The question here is how can this be accomplish? The initial thinking is to create what you see in the screenshot and have it point to a Octopus project dedicated to a target machine (i.e. Dev1, Dev2, etc.)
Below is the current setup I have for this POC each project can only deploy per name (i.e. DevOps2019_Dev1 can only deploy to a Dev1 box) and it cannot be promoted.
The other question I have is what if the package id for example the initial deployment is called “PHLY.GW.BC.RELEASES” and then later on there is a hotfix so now the name is called “PHLY.GW.BC.HOTFIXES” per my testing this seems like not possible. I’m hoping to get some suggestions on how this can work. Or other alternative.
Thanks for following up and supplying all of that great comprehensive information. I’m sorry to hear your POC so far hasn’t been as smooth sailing as we would hope!
From how I’m understanding your requirements, you’d want to specify your package version value in your create-release step by passing
--package=VALUE, in your case it’d look something like
--package=DevOpsDeployment:220.127.116.11 (PackageID:Version). It looks like currently the latest package version is being selected by default for the release. Prompted variable values are supplied to them at deployment time, and not at release creation time. So passing the
--variable=Label:Value for the package version won’t work to specify the package version the release is created with.
There a couple of potential ways to address the need to deploy through any of these permutations of targets. You could split them up into separate environments and define your lifecycle(s) to include optional phases. Or maybe even use the channels feature which would allow you to create releases that progress through another lifecycle (which is often used for hotfixes that you mention in your next question). With channels, you can also define version rules to automate package versions being selected when creating releases. It might be worth having a read of our channels documentation, and I’d be interested to hear if it helps.
I hope this helps! Don’t hesitate to reach out if you have any questions or concerns moving forward.
Thank you Kenny, Octopus is somewhat new to me. I barely touch it until this POC. I will read through the documents you mentioned and if you do not mind maybe I will be reaching out to you for best practice approach.
That sounds good! We’ll be here to assist in any way we can if you have any questions or concerns in the future.
Good morning, ok I think I finally able to figure out the channels I do have a question regarding environments. I understand a deployment target can be set to a target roles which that target roles can contain multiple deployment targets. My question is, what is the best practice and is it possible to specify a deployment target during a release? For example a Target Role called “Dev1” has 2 machines but I want to only deploy to 1 or the 2 machines.
I found this variable from one of your reply from another post, the question I have is are you supplying the display name, the tentacle URL or the actual machine name? It is not clear from the guide. Can you give an example?
Per your site:
[Optional] A comma-separated list of machine
names to target in the deployed environment. If
not specified all machines in the environment
will be considered.
Thanks for following up! The
--specificmachines=VALUE argument expects the actual machine name(s) given to them in Octopus. These will be shown as the
Display Name in the web portal. This will then deploy the specified release only to the targets you’ve specified. You can also do the opposite by specifying machines to exclude in the deployment by using the
You can also do this same thing when deploying in the web portal while in the deployment page, as shown below.
I hope this helps! Let me know if you have any other questions or concerns moving forward.
Thank you, I actually figured it out through trial and error yesterday but it just confirmed by your response. Regarding the excludemachines that is a good to know. I did not realize it is available now in the command line argument.
Have a nice rest of the day and weekend.