2
votes

We have are using the octopus-deploy build step in teamcity to deploy the latest successful builds from another build configuration.

My intent is to have release numbers tied to artifact numbers (which in turned are tied to SCM numbers).

When I deploy a new build, octopus would create a new release with that version, and deploy it.

If I run the teamcity deploy step again (for an artifact that's already been created), octopus should redeploy the same artifact using the same release number. (instead of failing with a "this release already exists").

From the octo.exe document, the --force option should allow me to do this. (Which I should be able to add to the "Additional command line arguments" in teamcity).

However I'm getting an Unrecognized command arguments: --force error.

How do I fix this? or what are some other options? (without changing the artifact / release numbering strategy).

The call:

octo.exe create-release --server octoServerHostName --apikey SECRET --project ProjectName --enableservicemessages --version 1.0.59356.0 --deployto showcase --waitfordeployment --force

Creating Octopus Deploy release [15:26:05]Octopus Deploy Command Line Tool, version 2.0.8.22 [15:26:05] [15:26:05]Unrecognized command arguments: --force

2
Hi, what version of the TeamCity Octopus plug-in do you have installed?SteveChapman
2.0.10.14 of the Teamcity Octopus plugin, 2.1.3.1223 of Octopus Servervicsz

2 Answers

3
votes

In octopus deploy 2.0+ you can use:

--ignoreexisting   If a release with the version number already 
                   exists, ignore it

--force [Optional] If a project is configured to skip
                   packages with already-installed versions,
                   override this setting to force re-deployment
                   (flag, default false).

To achieve exact what you want in a single teamcity step, you'll need both --ignoreexisting --force.

1
votes

The error posted shows that the build step is invoking the Octo.exe create-release command, on version 2.0.8.22 of Octo.exe. That version does not have a --force argument, so the error is to be expected.

Depending on the version of OctopusDeploy you're running, you can try upgrading the plug-in to a later version that supports --force on the create-release command.

With all that said, I'm not sure --force gives you what you want. --force enables you to force Octopus to re-install packages already installed, it doesn't force the creation of an Octopus release that already exists.

You may want to consider using a combination of the create-release and deploy-release commands to avoid issues with trying to create a release with a version that already exists - which is what I think you're trying to do using --force.

Hope that helps.