TeamCity create release with latest version available for one package only

Hi Fellas,

I’ve failed to find the correct syntax to do this after scouring the docs and the forum…

In Octopus I have added additional script step at the end to an existing project to run a script from a utility package that is published to the internal repository from another build.

TeamCity normally creates automatically a release at each build for that project that I modified and is automatically creating a release with the following Octo parameters:

--packageversion %releasever%-%teamcity.build.branch%

after introducing that last step in the Octopus I had to specify the version of the package used in the newly added step since it is not part of the TeamCity build so changed it to the following which also works as expected:

--packageversion %releasever%-%teamcity.build.branch% --package LastStepPkgId:1.0.12

My question is How to change the package id version to latest version for that new package I use in the newly added last step?

in other words what is the syntax for something like this:

--package LastStepPkgId:<LATEST-Available>

I tried leaving the version blank and using the word ‘latest’ and wild cards like ‘1.*.*’ but nothing worked… I guess I am missing something obvious?!

Thanks,
Emil

Hi Emil,

Thanks for reaching out! If you don’t pass the --package parameter at all, It’ll always pick the latest version available for that package ID. Could you try this and let me know if it has the desired result?

If it doesn’t, please send me your full TeamCity build log so I can check what’s going on.

I have made this thread private so only you and our staff can see its contents.

Best regards,
Dalmiro

Hi Dalmiro,

Now, I realized the whole issue for me started with the presence of:

--packageversion %releasever%-%teamcity.build.branch%

which tells Octopus to use the current build which version that is also being published to the Octopus repository. Since the last step I added included a package that is not part of this build I got a failure creating the release because Octopus was looking for --packageversion instruction for all packages including the one from last step I added let’s call it LastStepPkgId which is not part of this build so the error was: Coudn’t find LastStepPkgId-<%releasever%-%teamcity.build.branch%>

That is why, I decided to use a specific version by adding --package LastStepPkgId:1.0.12 and it worked but I had to hard code the version here.

I guess my question is Can I still explicitly use --packageversion ... and also explicitly ask for latest version of --package LastStepPkgId:<LatestVersion>?

However following your suggestion I removed both --packageversion and --package everything works as expected - using the latest packages available - THANK YOU!

I guess my question still stands as I want to know if I can specify a version for all packages and use --package to assign latest version for one package in my case…

Thanks for you help!

I’m glad to hear things are working as expected now :slight_smile:

The parameter --packageVersion is an alias of --DefaultPackageVersion, which has a more helpful name to understand its usage.

Lets say you are using 3 packages, but you want to use the fixed version 1.0.0 of 2 pacakges for all your releases, and the latest for the 3rd package. In that case you should combine --DefaultPackageVersion and --package like this:

Octo.exe create-release --DefaultPackageVersion 1.0.0 --package="StepNameOf3rdPackage: %releasever%-%teamcity.build.branch%"

the TC variable that comes after stepname: might be wrong as I didn’t test it. But you get my point :slight_smile:

Thanks, yes I get your point, however my actual usage is two packages of release build version and I want the third package to be latest available:

Octo.exe create-release --DefaultPackageVersion %releasever%-%teamcity.build.branch% --package="StepNameOf3rdPackage: <??latest??>"

Is it possible to say “latest available version” in package parameter after stepname: instead of specifying version?
--package="StepNameOf3rdPackage: ????"

Hi Emil,

The way to approach this would be to pass --package=name:%releasever%-%teamcity.build.branch% for each package that you want to use the current build package, and don’t pass any other parameters. This would mean that all the other packages would simply use their latest version available.

Thanks,
Dalmiro

Thanks Dalmiro!

That makes sense, so basically I can pass multiple --package=... parameters…

Thanks,
Emil

That’s correct, you can pass as many --package as you need