Get latest package, filtered by pre-release tag

When using octo.exe to create a release, I can’t rely on it just using the latest version of the package in the repository, as I’m using tags. I’d rather not specify a specific version number as an argument, and looking at the octo.exe options, there is an argument “–packageprerelease=VALUE”. Am I right in saying I could use this to, say, pick the latest version of a package that has a ‘beta’ or ‘rc’ tag in its version? It gives me the following error, sadly:

2016-02-25T12:51:04.1340071Z Finding latest NuGet package with pre-release ‘beta’ for step: Deploy Web Files
2016-02-25T12:51:04.1965082Z Could not find any packages with ID ‘’ in the feed ‘octopus://’

Hi James,

Thanks for getting in touch. You are correct, you should be able to use the --packageprerelease argument to select package versions that match the specified tag.

All of the packages must have a special version that matches the tag. For example if you are using --packageprerelease=beta you should have packages:

MyWebApp.1.0.0-beta.nupkg
MyService.1.0.0-beta.nupkg

I hope this helps, please let me know if you have any questions.

Cheers,
Shane

Thanks for the reply Shane. I’ve tried this but it doesn’t seem to work for me. Here is my Octo.exe output:

Handshake successful. Octopus version: 3.2.20; API version: 3.0.0
Authenticated as: Team Foundation Server <> (a service account)
Finding project: MyProject
Finding channel
Finding deployment process for project: MyProject
Finding release template...
Resolving NuGet package versions...
Finding latest NuGet package with pre-release 'beta' for step: Deploy Web Files
Could not find any packages with ID 'MyProject.Web' in the feed 'octopus://'
Using version number from package step.
The step 'Deploy Web Files' provides the release version number but no package version could be determined from it.

I can confirm that I have a number of packages in my library with the right tag, e.g.:

MyPackage.Web.0.12.0-beta2.nupkg
MyPackage.Web.0.12.0-beta1.nupkg

FYI, I’m using channels with this project. I am passing in the following additional arguments to octo.exe:
--channel="Beta" --packageprerelease=beta

Hi James,

I’ve just double checked that specifying “beta” will match “beta1” and “beta2” and it should so we can rule that out.

Would you mind providing a screenshot of the “beta” channel being sure to include the version rules.

Cheers,
Shane

Hi Shane

Please see attached. The ‘Betas’ lifecycle allows deployment to the Development environment only, and does this automatically upon release creation.

Hi James,

Just by deploying to the “beta” channel you should only get releases for packages that have the “beta” tag.

If you do no specify --channel or ‘–packageprerelease’ when you call octo.exe are you able to create a release?

In one of the logs you sent it can’t find the package “MyProject.Web” and you have indicated that you have the packages “MyPackage.Web” in your feed. They are not the same package. Could that be what is causing the error?

Are your packages in the built-in Octopus NuGet feed?

Cheers,
Shane

The mismatch in names between MyProject and MyPackage is just a typo by me, apologies.

A good example of this not working for me is as follows:

octo.exe create-release --project="CourseSight" --server=http://mk-octopus/ --apiKey=API-1234 --channel="Beta"
Octopus Deploy Command Line Tool, version 3.2.0.91

Handshaking with Octopus server: http://mk-octopus/
Handshake successful. Octopus version: 3.3.0; API version: 3.0.0
Authenticated as: Team Foundation Server <> (a service account)
Finding project: CourseSight
Finding channel
Finding deployment process for project: CourseSight
Finding release template...
Resolving NuGet package versions...
Finding latest NuGet package for step: Deploy Web Files
Finding latest NuGet package for step: Deploy Database
Using version number from package step.
Release plan for release:    0.14.0-rc1
Steps:
  #   Name               Version         Source
  --- ------------------ --------------- ------------------------------------
  1   Deploy Web Files   0.14.0-rc1      Latest available in NuGet repository
  2   Deploy Database    0.14.0-rc1      Latest available in NuGet repository

Creating release...
Error from Octopus server (HTTP 400): There was a problem with your request.

 - Release '0.14.0-rc1' already exists for this project. Please use a different version, or look at using a mask to auto-increment the number.

Exit code: -7

Before I executed this step, I had current releases of 0.14.0-beta4 in the Beta channel and 0.14.0-rc1 in the RC channel.

Here I am specifying the creation of a release in the beta channel (0.14.0-beta5 exists as a package), yet it is looking at rc-tagged packages to try and create the release.

I’ve attached some images for reference.

Hi James,

I think that last log you sent through holds the key. I tried creating a release to a channel with Octo.exe version 3.2.0.91 and had the same result you are getting.

The --channel parameter was not added until 3.2.13: https://github.com/OctopusDeploy/Issues/issues/2235

Hopefully updating Octo.exe to latest will get the appropriate package for the channel.

Cheers,
Shane

Sorted. Thanks so much for getting to the bottom of this.

As an FYI, the version of octo.exe I was using is the one bundled in to the TF Build vNext “Create Octopus Release” task - you might want to push out a new version of this.