I have a sleep built into the PreDeploy.ps1 of the first package in my project. It waits for me to signal that the deployment may proceed by watching for a file. If I cancel the deployment during that sleep then create the file the Tentacle proceeds with execution of the package steps. I was expecting (and would like to see) one of the following:
- When I release my PreDeploy script from it’s loop and the PreDeploy script finishes, the Tentacle would not execute anymore scripts or action in the current package step and would abort execution of the rest of the package steps and fail the deployment.
Or (not preferred)
- The tentacle would finish executing the current package step but then abort all remaining and fail the deployment.
Any reason that the tentacle continues to execute package steps after I click Cancel in the UI?
This is down to the way deployment responsibilities are split between the Octopus and Tentacle. First, imagine a situation where one Octopus server is deploying to 10 Tentacles simultaneously.
After downloading and uploading packages, the Octopus server processes each ‘step’ sequentially. Since a step might need to be run against many machines, each step is deployed in parallel to them (but step 2 won’t begin until all machines finish step 1).
When you click ‘cancel’, it only affects the Octopus server, not the Tentacle. The Octopus server should recognize that you’ve clicked ‘cancel’ when step 1 was running, and it won’t bother running step 2.
However, if a package is in the middle of being installed on a Tentacle, it will continue being installed; the cancel button has no effect on that.
If (based on the file changing) your PreDeploy.ps1 script threw an exception or returned a non-zero exit code, the deployment would fail. Step 1 would continue being executed on other Tentacles, but step 2 would never be attempted because Step 1 failed.
An important note here is that Tentacle is quite simple - it gets a package, it installs it. It has no understanding or projects or steps. It is just fed packages sequentially by the Octopus and told to install them.
I hope that helps,
The behavior I saw was that I clicked Cancel while Step 1 was executing. When Step 1 finished, Steps 2 - 11 executed in sequence. Based on your description above, it seems like Step 1 should have finished but Steps 2 - 11 should not have even been started. Is this correct?
I think I found the bug:
I’ve fixed it now and it will work properly in the next release. I’m so sorry for misleading you.
This fix is available in version 1.1.6 on the downloads page. Sorry again.