Trigger not deploying latest release

Scenario:

In below screenshot you may find the latest release by filter:

As you can see the latest release for today us is say 20220530.x till 8 am in morning(typically when we want to deploy). Now we want this release to get deployed to Dev Environment.

Also we have only one environment in this project which is dev.

Currently I am trying the available option as below which is not working for me.

Note: We don’t want to create new release , we just want to deploy the latest release available at the time of trigger.
Please help as soon as possible.


Thanks

Good morning Rahul,

Thank you for getting in touch!

To answer your query there are a few things you can do. It looks like you already have a scheduled deployment trigger on your project, however, the deployment trigger won’t fire if the release hasn’t already been successfully deployed to the environment, which is the issue you are seeing.

You have a few options here to get this project working as you expect it to:

  • Enable automatic deployment for the Dev environment within the relevant Lifecycle. This would, however, mean that every Release created will auto-deploy to Dev - possibly more than you want.
  • Create a Runbook that deploys the latest release and set the Runbook to run on a scheduled trigger.

For your scenario, the easiest option which I think will work well is to create a Runbook that deploys the latest release and set the Runbook to run on a scheduled trigger, we have some documentation on this if you are not familiar with runbook triggers, this way your latest release will always be run at 08.00 when you want it to.

Regards,

Paul

1 Like

@paul.calvert Will look into the runbook as this will new for me. Will work on your suggestion and get back to you

1 Like

No problem.

For the Runbook option, you’ll likely want to take a look at the Chain Deployment and Deploy Child Octopus Deploy Project steps.
They both perform similar actions but have slightly different options available in the step configuration.

I got confused. How can i connect a deployment process with a runbook in same octopus project. Also runbooks are very similar to deployments. How can configure a runbook such that it picks the the latest release created in Deployment and executes it.
Also will this be available in overview that the latest release created is deployed.

Runbooks are similar to deployments with the main difference being that they are designed to be run over and over.

If you use the Chain Deployment step within the Runbook it runs an API script to perform the deployment within the project.
So, it has fields for things like project name and release. If you leave the Release blank it should select the latest one.
e.g.

The runbook itself won’t show in the overview, but because you’re triggering the deployment within the project, the latest release that you deploy via the Runbook will be displayed in the overview.

I was trying to find this chain template but couldnot find it. Is this still available in version
image
This is my current octopus version.

If possible please share link to this template

It is a community step. It may be that your instance has these steps disabled?

If so, you can import this single step by going to Library > Step Templates and using the Import button.
Then copy the content of the attached txt file into the box that appears and save it.
After that, the Chain Deployment step should be available in your list.
Chain Deployment.txt (58.7 KB)

Thanks … I got that working now. I have another challenge , since this is tenanted deployment and i have multiple tenants . For some reasons some of the tenant will fail for sure (past experience). I want those tenants to be retriggered automatically(at least once) without any manual intervention.
Now i saw guided failure option in the runbook steps as below:


I wanted to use either of the variables * Octopus.Action.StepRetryCount

  • Octopus.Action.DeploymentRetryCount but the link is redirecting to below page

I can’t see those variables within our list of system variables, so, it may be that they have since been deprecated.

You could try adding them to the target project with the desired value and test whether they perform as expected though.

Otherwise, you may be limited to the options available in the drop-down.

Is there a way to handle the automatic release failure now since the variables are not available. there must have been an alternative better solution for this before it got deprecated

There is no built-in retry functionality. When a Guided Failure occurs the software is designed to require a user to check the deployment and manually action it.

This step was created by our community and added this functionality by leveraging the REST API.

From what I can see, I would expect this step to perform at least one retry without needing to use those variables.
And if you test it with those variables you may find that they still work.

Thanks paul. I have used below option to get the retry feature on failure and its working fine.

I am having another problem which i think might be a bug. So i have multi tenant where i am trying to deploy . I have tagged one tenant Test2 as DevDB/DB_Dev

Rest all tenants are not tagged by this . but to my surprise all other tenants are appearing while execution and Test2 tenant is occuring twice which results in double queue of Test2 for execution.

Also when i try to run by keeping the individual names of all tenant(space or comma separated). i get below error:


Even with * i got the same

Now my ideal situation would be i want all these tenants(first screenshot) to be deployed without being queued twice.
Please suggest

Hi Rahul,

Thanks for following up with your additional questions. I’m not quite sure what might be causing the Test2 tenant to show twice, but I have a few questions to work with you in investigating this.

When you attempt a deployment, what do you see in the Tenant Preview, and could you provide me with a screenshot of this? You can see an example screenshot of this in our documenation here: Tenant tags - Octopus Deploy.

In the full log from the snippet you’ve provided where Test2 is shown twice under the Tenants, do you see that Test2 is executed twice (i.e. are the targets it’s associated with actually deployed to twice, or is it just showing as queued twice)? If you’re able to provide me with the full task log, that might help me better understand why this is occurring. You can use the following link to send this to us securely: Support - Octopus Deploy

Lastly, just to confirm, are you initiating this deployment from the Octopus portal manually or via a trigger, and are you using the community step template (Chain Deployment) mentioned earlier?

Best,
Patrick

I will share the logs asked by patrick in some time. Just to resolve my issues is there a way to get all the tenants to be included by just including their names or is it necessary to use the tags feature. Say suppose i have 3 tenants Test1, Test2, Test3 . how should i place my tenants (comma separated or space ) or can we use " *" to include all the tenants

Hi Patrick
Please find the answers inline below:
When you attempt a deployment, what do you see in the Tenant Preview, and could you provide me with a screenshot of this:

Only Test2 is tagged with DevDB/DB_Dev rest are not .for eg

Yes it deploys it twice . u can see in that in logs . In addition the pls find below screenshot

one is queued and first one got triggered

Last point. I am running it manually and yes i am using community step template(chain deployement).

Please help me here. Also while you are looking into this .Please do let me know if there is a way of executing this runbook on multiple tenants without using tag by just simply using the names of tenant for eg tenant Test1 , Test2 and Test3 . how can we deploy all these at once

++ @paul.calvert

The Chain Deployment step does state that it can accept Tenant Names or Tags.

Have you tested listing several tenant names with commas?
e.g.
Test1,Test2, Test3

Hi Rahul,

Sorry for the ongoing issues with this Rahul, but thanks for all of the information.

As for the Multiple Tenants, the “Tenants” section is a “Multi-Line Text Box” and accepts entries as 1 Tenant (or Tenant Group) per line.

Entering the Tenants like the following should work:

Test2
Automation

As for “Test2” occurring twice, what Tags do you have set on the “Test2” Deployment target?

  • What is your Tenanted Deployments set to? “Include in Both tenanted and untenanted deployments”?
  • What is your associated tenants set to? Do you have “Test2” selected as a Tenant as well as a Tenant Tag Group that contains the “Test2” Tenant as well?

I would guess that there might be a inclusive “AND” set, so that all matches are just added to the list, without doing any de-duplication of the results.

Please, let me know how you go.

Regards,