Release triggered from TeamCity is being deployed twice

I’ve got a weird issue whereby my Release (generated from teamCity) is being deployed to my CI tentacle twice.

2016-03-02 16:03:21.6055     59  INFO  https://xxx.xxx.xxx.xxx:10933/     59  Opening a new connection
2016-03-02 16:03:21.6211     59  INFO  https://xxx.xxx.xxx.xxx:10933/     59  Performing TLS handshake
2016-03-02 16:03:21.6680     59  INFO  https://xxx.xxx.xxx.xxx:10933/     59  Secure connection established. Server at [::ffff:xxx.xxx.xxx.xxx]:10933 identified by thumbprint: 327...A3F9, using protocol Tls12
2016-03-02 16:03:21.7149     64  INFO  https://xxx.xxx.xxx.xxx:10933/     64  Opening a new connection
2016-03-02 16:03:21.7149     64  INFO  https://xxx.xxx.xxx.xxx:10933/     64  Performing TLS handshake
2016-03-02 16:03:21.7149     64  INFO  https://xxx.xxx.xxx.xxx:10933/     64  Secure connection established. Server at [::ffff:xxx.xxx.xxx.xxx]:10933 identified by thumbprint: 327...A3F9, using protocol Tls12

on my tentacle, i can see the artefacts being replicated with a _1 extension and the deployment journal looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Deployments>
  <Deployment Id="a7540aa9-6303-45e7-afe4-04db5291171c" EnvironmentId="Environments-1" ProjectId="Projects-1" PackageId="TEST.WebApp" PackageVersion="1.0.53" InstalledOn="2016-03-02 15:28:33" ExtractedFrom="E:\Octopus\Files\TEST.WebApp.1.0.53.nupkg-ba4a5f72-6000-434a-9679-00be3cd6a311" ExtractedTo="E:\Octopus\Applications\CI\TEST.WebApp\1.0.53" RetentionPolicySet="Environments-1/Projects-1/Step-Deployment Web Application/Machines-1/&lt;default&gt;" CustomInstallationDirectory="E:\Octopus\Applications\CI\TEST.WebApp\1.0.53" WasSuccessful="True" />
  <Deployment Id="c5211882-f6af-49b6-9d2e-b6e06c0a8af5" EnvironmentId="Environments-1" ProjectId="Projects-1" PackageId="TEST.Repository" PackageVersion="1.0.53" InstalledOn="2016-03-02 15:28:34" ExtractedFrom="E:\Octopus\Files\TEST.Repository.1.0.53.nupkg-a739c4e9-90e7-45f4-b22d-7cbe43948dd0" ExtractedTo="E:\Octopus\Applications\CI\TEST.Repository\1.0.53" RetentionPolicySet="Environments-1/Projects-1/Step-Deploy Migrations/Machines-1/&lt;default&gt;" CustomInstallationDirectory="E:\Octopus\Applications\CI\TEST.Repository\1.0.53" WasSuccessful="True" />
  <Deployment Id="496e543f-3795-4040-a39c-bd46ad402db5" EnvironmentId="Environments-1" ProjectId="Projects-1" PackageId="TEST.WebApp" PackageVersion="1.0.53" InstalledOn="2016-03-02 15:29:02" ExtractedFrom="E:\Octopus\Files\TEST.WebApp.1.0.53.nupkg-ba4a5f72-6000-434a-9679-00be3cd6a311" ExtractedTo="E:\Octopus\Applications\CI\TEST.WebApp\1.0.53_1" RetentionPolicySet="Environments-1/Projects-1/Step-Deployment Web Application/Machines-1/&lt;default&gt;" CustomInstallationDirectory="E:\Octopus\Applications\CI\TEST.WebApp\1.0.53_1" WasSuccessful="True" />
  <Deployment Id="d33ef936-b6b7-4543-aa54-c973814f5eb5" EnvironmentId="Environments-1" ProjectId="Projects-1" PackageId="TEST.Repository" PackageVersion="1.0.53" InstalledOn="2016-03-02 15:29:03" ExtractedFrom="E:\Octopus\Files\TEST.Repository.1.0.53.nupkg-a739c4e9-90e7-45f4-b22d-7cbe43948dd0" ExtractedTo="E:\Octopus\Applications\CI\TEST.Repository\1.0.53_1" RetentionPolicySet="Environments-1/Projects-1/Step-Deploy Migrations/Machines-1/&lt;default&gt;" CustomInstallationDirectory="E:\Octopus\Applications\CI\TEST.Repository\1.0.53_1" WasSuccessful="True" />
  <Deployment Id="245ba573-b101-470e-9416-e75215e2eaf3" EnvironmentId="Environments-1" ProjectId="Projects-1" PackageId="TEST.WebApp" PackageVersion="1.0.54" InstalledOn="2016-03-02 16:03:32" ExtractedFrom="E:\Octopus\Files\TEST.WebApp.1.0.54.nupkg-ae210bcf-a43e-4776-9ff7-ddcaddb14132" ExtractedTo="E:\Octopus\Applications\CI\TEST.WebApp\1.0.54" RetentionPolicySet="Environments-1/Projects-1/Step-Deployment Web Application/Machines-1/&lt;default&gt;" CustomInstallationDirectory="E:\Octopus\Applications\CI\TEST.WebApp\1.0.54" WasSuccessful="True" />
  <Deployment Id="c4a44b84-8261-4cd7-afaa-88fccd82e04e" EnvironmentId="Environments-1" ProjectId="Projects-1" PackageId="TEST.Repository" PackageVersion="1.0.54" InstalledOn="2016-03-02 16:03:34" ExtractedFrom="E:\Octopus\Files\TEST.Repository.1.0.54.nupkg-2129035e-f9aa-456b-952c-a067340e2961" ExtractedTo="E:\Octopus\Applications\CI\TEST.Repository\1.0.54" RetentionPolicySet="Environments-1/Projects-1/Step-Deploy Migrations/Machines-1/&lt;default&gt;" CustomInstallationDirectory="E:\Octopus\Applications\CI\TEST.Repository\1.0.54" WasSuccessful="True" />
  <Deployment Id="593bff75-0813-420e-8270-1ff8d37834f7" EnvironmentId="Environments-1" ProjectId="Projects-1" PackageId="TEST.WebApp" PackageVersion="1.0.54" InstalledOn="2016-03-02 16:04:02" ExtractedFrom="E:\Octopus\Files\TEST.WebApp.1.0.54.nupkg-ae210bcf-a43e-4776-9ff7-ddcaddb14132" ExtractedTo="E:\Octopus\Applications\CI\TEST.WebApp\1.0.54_1" RetentionPolicySet="Environments-1/Projects-1/Step-Deployment Web Application/Machines-1/&lt;default&gt;" CustomInstallationDirectory="E:\Octopus\Applications\CI\TEST.WebApp\1.0.54_1" WasSuccessful="True" />
  <Deployment Id="903682c0-ad8d-458b-bd0f-fd1cd8a322f6" EnvironmentId="Environments-1" ProjectId="Projects-1" PackageId="TEST.Repository" PackageVersion="1.0.54" InstalledOn="2016-03-02 16:04:03" ExtractedFrom="E:\Octopus\Files\TEST.Repository.1.0.54.nupkg-2129035e-f9aa-456b-952c-a067340e2961" ExtractedTo="E:\Octopus\Applications\CI\TEST.Repository\1.0.54_1" RetentionPolicySet="Environments-1/Projects-1/Step-Deploy Migrations/Machines-1/&lt;default&gt;" CustomInstallationDirectory="E:\Octopus\Applications\CI\TEST.Repository\1.0.54_1" WasSuccessful="True" />
</Deployments>

I can’t see how the items are being requested to be deployed twice.

Hi,

Thanks for reaching out. Is it possible that you have your Environment configured as “Deploy automatically” on your lifecycle? That would explain why you are getting 2 deploments:

  1. From your TeamCity server.
  2. As soon as Octopus realizes a release was created (from TeamCity in this cse), It triggers a deployment to the environments set as “deploy automatically”.

You can check which environments are set to “deploy automatically” on your lifecycle. They will show up with a tiny lightning icon as shown on the attached screenshot.

If you want to avoid having automatic deployments triggered for this environment, just remove it from the lifecycle and add it back again selecting the "manual " option (see attached screenshot).

Regards,
Dalmiro

automaticdeploy.jpg

Yes, the environment was set to automatically deploy in the Lifecycle. I have changed this now.

Thank you very much

Stu