Prevent using latest available package

Hi,

We use TeamCity Octopus add on to create releases getting the information from many builds. We’re getting package information from these builds and passing on package version to octo.exe via --package PackageName:version. Sometimes a misconfiguration on one of the builds is creating the release with the wrong version, and Octopus defaults to latest available.

We would like to fail that step if any “latest” version is used. Is there a way we can set this at the project level? Octo.exe seems to be unable to do so.

Hi @pazrodrigo,

Thank you for contacting Octopus Support.

It looks like you are running into a known bug. You may find additional details and subscribe to the issue here: Octo Create-Release will not error when the package parameter has an invalid package id · Issue #6912 · OctopusDeploy/Issues · GitHub

It does not appear we have a workaround available at this time. However, I have reached out internally to confirm that this is still the case.

I appreciate your patience while I look into this.

Regards,
Donny

hi Donny,

It may be the same, but the issue is slightly different. When a build fails with a special kind of failure, sometimes version is not passed along, and we’re getting this message:

|[08:18:48]|The package version for some steps was not specified. Going to try and resolve those automatically
|[08:18:48]|Finding latest package for step: StepN

What I want to do is fail the release creation if a version is not specified. You think it will be addressed as part of the bug you mentioned? Is there any way to force specifying a package value?

Hi @pazrodrigo,

Thank you for getting back to me.

You may explicitly define the package version by using --package=VALUE:

You will likely need to account for this in your build if this is currently being set by a variable.

Let me know if you think that will work for you.

Regards,
Donny

@donny.bell we do (at least for successful builds), but sometimes build failures miss the package version and we don’t pass “–package” for certain packages. Is there a way to fail the package creation if the process has one package reference not included on the “–package” parameters?

Hi @pazrodrigo,

Thank you for getting back to me.

There may be a way to do this in TeamCity if you are using a variable to populate the value for package version in the build. However, there isn’t a way to fail this on the Octopus side since this is an optional value.

I did have a thought, though. This is not something I have tested. However, perhaps you could use a purposely different version number as a fallback in the event a version is not generated normally so that it would fail the Channel Version Rules in Octopus:

Let me know if you have any additional questions or if I can assist with anything else.

Regards,
Donny

Hi @donny.bell, we haven’t implemented channels yet, and due to the size of the deployments it will be a hard change. We might do it, since it was discussed many times.

About the TeamCity variable, we use variables for that, but only a single %octoParameters% value where all of the “–package:Package:Version” strings. What would be your thought here?

In any case, this is currently not supported and I guess we’ll have to implement something on our build server

Hi @pazrodrigo,

Thank you for getting back to me.

You are correct, this would need to fail on the build server side as this is not functionality that the Octopus CLI offers at this time.

If you have any additional questions or if I can assist with anything else, please let me know.

Regards,
Donny