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?
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.
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
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.
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)
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!
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.
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.
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?
I hopet his helps! Don’t hesitate to reach out if you have any further questions or concerns moving forward.
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.