Deploy already created release automatically

Hello!

I have the following flow:

  1. Build the solution
  2. Create the nuget package
  3. Push the package to Octopus
  4. Create release

All these steps are built on the CI server

I would like to configure a scheduled trigger on Octopus which will check the latest release for the specific environment and deploy it if it hasn’t been deployed yet.

Is it possible to configure such flow using built-in Octopus features?
Or only Octopus REST API can be used?

Thank you in advance,
Nadiia

Hi Nadiia,

Thanks for getting in touch! If I understand what you’re after correctly, there are a couple potential options to keep your environment up to date with the latest release.

With the scheduled triggers feature (introduced in version 2018.4), you can configure it to Deploy latest release, which channel to select the latest release from, source and destination environments, interval, etc. In the following screenshot, I have an example which will deploy the latest release which was created in the Hotfix channel, and promote it from QA to Production for Tenant1.

However, perhaps an easier approach would be to configure the environment in this project’s lifecycle to automatically deploy once the release hits that phase. The following screenshot shows a lifecycle, where when a release is deployed to the Development environment, it hits the second phase which is set to automatically deploy to the environment within that phase.

Would one of these options help meet your requirements? Let me know what you think or if you have any further questions moving forward. :slight_smile:

Best regards,

Kenny

Hi Kenny,

Thank you for the reply.

Regarding the first option (Deploy latest release) - if I am not mistaken, it promotes last successful release to the next environment. But what if I want to deploy release which hasn’t been deployed yet?

Unfortunately, the second option doesn’t meet my requirements

Hi Nadiia,

Thanks for following up! You’re correct - the latest release which has been successfully deployed already will be promoted from one environment to the next with the scheduled trigger. Perhaps you could set the first phase of your lifecycle to automatically deploy to allow the scheduled trigger to promote it?

How are you currently deploying your releases? There may be a more out of the box solution (for example, setting initial environments as optional and triggering the deployment of a new release straight to the relevant environment). I’d like to hear more about your scenario and maybe we can come to a better solution. :slight_smile:

I look forward to hearing back!

Best regards,

Kenny

Hi Kenny,

Currently, our deployment flow is the following:

  1. We have only 2 environments - dev and qa
  2. We deploy Dev manually during the day (because we want to avoid the situation when deployments to Dev are too often and developers are not able to test their code on the environment)
  3. We deploy Dev nightly

The same situation with QA env - we can deploy it manually during the day (after Dev has been deployed) and nightly (promote release from Dev).

Currently we run nightly deployment from Jenkins using Octopus REST API. We are creating new release, deploying it, checking if it is successful, and promoting it to QA.

We would like to move this logic to Octopus.
The second part is ok - scheduled trigger works fine for us (QA deployment).

But, as currently we cannot deploy Dev env automatically after each commit to the specific Git branch, we would like to configure nightly deployments.

If you can provide us some advice regarding how to configure it on Octopus, it would be great!

Regards,
Nadiia

Hi Nadiia,

Thanks for following up, and I’m terribly sorry about the delay to get back to you! You can automate the release creation and deployment to Dev in Octopus all from Jenkins!

These two tools integrate very well together. We have a comprehensive doc page on Jenkins integration, outlining how you can push packages, create the relevant release from it, and deploy it to an environment. I think this may be quite helpful if you haven’t seen it yet. :slight_smile:

Does this help get you going? Let me know if you have any specific questions regarding this and I’ll be more than happy to assist in any way I can.

Best regards,

Kenny

Hi Kenny,

Thank you for the response. This link was very helpful and, actually, we use it for our purposes :slight_smile:

But is it possible to get the latest release which is undeployed yet using Octopus REST API?
Having only project name and environment name?

Thanks,
Nadiia

Hi Nadiia,

That’s great to hear that doc page was helpful. :slight_smile:

I’m unable to find a specific sample API script to find the latest undeployed release, however perhaps an easier solution could be to use the promote-release command via Octo.exe, where it can automatically select the latest release deployed to one environment, and promote it to the next. This is only if the release has already been deployed to an earlier environment, however.

We have a sample API script to find the latest release for project and environment, which may not be exactly what you’re needing to find, but maybe tweaking this could help? :slight_smile:

I hopet his helps! Don’t hesitate to reach out if you have any further questions or concerns moving forward.

Best regards,

Kenny

Hi Kenny,

Yes, thank you! My question has been solved.

Hi Nadiia,

You’re very welcome! That’s great to hear your question has been solved. Please don’t hesitate to reach out if you have any further questions in the future. :slight_smile:

Best regards,

Kenny

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.