Force package version not available on git connected projects

We switched a few our projects to git repository. After that when creating channel release we no longer can override package version. If I try to select package version for release which doesn’t match version rules, get error message “The requested package versions for the following steps violate the channel version rules: DB,API. Please specify a different package version, channel or provide the ignoreChannelRules parameter to override this check.” But “force package version” not available like it is in projects not connected to git repo.

Hi @nkomlichenko,

Thanks for reaching out, that’s a great question!

I’d just like to double check if you are creating the release in the UI or are you using our CLI? Could you also please confirm which Octopus version you are using?

I’ll confirm exactly what’s going on with this flag with the devs however from a quick look it seems that it might be getting phased out with the opinion being that “rules shouldn’t be broken”.

Configuring another channel that doesn’t have any rules looks to be our recommendation but I’ll double check on this and keep you posted if I have any updates.

Feel free to reach out with any questions at all!

Best Regards,

We are trying to use UI - version 2023.1.9767
From cli I can create it fine using --ignoreChannelRules flag, it is kind of workaround for now.

Hi @nkomlichenko,

Cheers for confirming that, great to hear you’re able to workaround it!

I’ve tried to reproduce this using that same version but I haven’t been successful and the Force Package Selection is still present for my version controlled project:

However I did notice an open issue we have which sounds exactly like what you are experiencing: Creating a release that violates package version rules doesn't always show the Force Version Selection checkbox · Issue #7455 · OctopusDeploy/Issues · GitHub

The issue mentions that the Force Version Selection should re-appear after manually editing the Specific Version field for a package and provides a GIF indicating how to get into this state and how to resolve it.

Let me know if that does help and I’d be more than happy to keep looking into this!

Best Regards,

I think it is present on your screen because you don’t have channels on that Test project. Attached screenshot how it is not present on our end. I also saw the ticket you referenced, but wasn’t able to appear “Force…” doesn’t matter what I did.

If it helps, the project was converted from normal one to git based. Maybe it somehow impact that.

Hi @nkomlichenko,

Cheers for that extra info, I’ve just tried adding Channels to my repro but unfortunately still no luck getting the same behaviour you’re seeing, even after converting my projects to Git.

I’ve only been able to get the Force Version Selection option to disappear by using an invalid Package Version which logs an error in the console indicating a bad request was made to the rule-test endpoint: /api/Spaces-1/channels/rule-test. Could you please confirm if you are able to spot any errors in the console?

It looks like the NikoHealth.Epic.DB package might be missing based on the icon next to it’s name. Could you please confirm the error message shown when hovering over it? This doesn’t appear to effect my reproduction so it might not be relevant.

Could you please confirm the Package Version Rule you have configured? I’m interested in if you are using a pre-release tag rule or just a version range.

Looking forward to getting to the bottom of this, feel free to reach out with any questions!

Best Regards,

The rule is: ^$|^beta.\d+$
I don’t see any errors in console, rule-test returns 200 (see screenshot).
I also don’t know why it says package missing as package available and I can select specific package version.

Hi @nkomlichenko,

Cheers for confirming that, could you please confirm what the latest rule-test response content was?

My testing is showing that rule-test will still return 200 response, however there could still be an error. It looks like the Force Version Selection will fail to appear if the version specified follows the version and pre-release rules, or if there is an error in the response indicating an Invalid Version Number is being used:

To make the Force Version Selection appear using a pre-release tag rule like ^$|^beta.\d+$ then the response content should be:

{
  "Errors": [],
  "SatisfiesVersionRange": true,
  "SatisfiesPreReleaseTag": false
}

If you remove the specified version completely, does specifying any incorrect version, e.g. slowly building the version up to something like 1.1.1-test.123 allow for the Force Version Selection to appear? If it shows up for an incorrect version, then selecting the checkbox should keep the setting if you change it to the correct version after.

I’d be happy to check over a HAR file of the requests being made if you’d like to send it through to our Secure Upload Portal, otherwise feel free to reach out with any questions at all!

Best Regards,

Sorry for some delay was out for few days. When I select pre release version - rule-test returns the following:
{
“Errors”: [],
“SatisfiesVersionRange”: true,
“SatisfiesPreReleaseTag”: true
}
I simply try to select pre release package version like 1.30.0-net6.66330.
If i try to enter version 1.1.1-test.123 like you mentioned - I get responses on rule-test like:
{
“Errors”: [
“Invalid Version Number”
],
“SatisfiesVersionRange”: false,
“SatisfiesPreReleaseTag”: false
}
or
{
“Errors”: [],
“SatisfiesVersionRange”: true,
“SatisfiesPreReleaseTag”: true
}
and force version never appear.

btw on any other project which is not connected to git, with the same rule, just selecting pre release package version like 1.30.0-net6.66330 force version appear at once and rule-test returns
{
“Errors”: [],
“SatisfiesVersionRange”: true,
“SatisfiesPreReleaseTag”: false
}

I also noticed that on any project not connected to git, when select package I have 3 choices - pre release packages, only this channel, release notes but on git connected ones only 2 - pre release packages and release notes.


Hi @nkomlichenko,

No problem at all, sorry I missed this yesterday!

Your last message about the “Only this channel” not being present for Version Controlled Projects is a clue as that UI element requires a channel rule in order to appear!

Could you please share the JSON api data for the CI channel and as well as any others with this issue? E.g.
https://octopusurl.domain.local/api/Spaces-1/projects/Projects-1/channels/Channels-1

I have a feeling the Rules section will be empty, but it’s not clear why this would have changed as it’s not stored in version control:
https://octopus.com/docs/projects/version-control/config-as-code-reference#project-resources-saved-to-sql-server

Looking forward to hearing how you get on, feel free to reach out with any questions!

Best Regards,

{
  "Id": "Channels-1230",
  "Name": "Hotfix",
  "Description": "",
  "ProjectId": "Projects-822",
  "LifecycleId": "Lifecycles-382",
  "IsDefault": false,
  "Rules": [
    {
      "Id": "868ef663-01b7-4442-b052-1ed3de805e97",
      "VersionRange": "",
      "Tag": "^$|^beta\\.\\d+$",
      "ActionPackages": [
        {
          "DeploymentAction": "db",
          "PackageReference": "DB"
        },
        {
          "DeploymentAction": "api",
          "PackageReference": null
        }
      ],
      "Links": {},
      "Actions": [
        "db",
        "api"
      ]
    }
  ],
  "TenantTags": [],
  "SpaceId": "Spaces-2",
  "Slug": "hotfix",
  "Links": {
    "Self": "/api/Spaces-2/projects/Projects-822/channels/Channels-1230",
    "Releases": "/api/Spaces-2/projects/Projects-822/channels/Channels-1230/releases{?skip,take,searchByVersion}",
    "Project": "/api/Spaces-2/projects/Projects-822"
  }
}
{
  "Id": "Channels-1327",
  "Name": "Hotfix",
  "Description": "",
  "ProjectId": "Projects-861",
  "LifecycleId": "Lifecycles-382",
  "IsDefault": false,
  "Rules": [
    {
      "Id": "868ef663-01b7-4442-b052-1ed3de805e97",
      "VersionRange": "",
      "Tag": "^$|^beta\\.\\d+$",
      "ActionPackages": [
        {
          "DeploymentAction": "db",
          "PackageReference": "DB"
        },
        {
          "DeploymentAction": "api",
          "PackageReference": null
        }
      ],
      "Links": {},
      "Actions": [
        "db",
        "api"
      ]
    }
  ],
  "TenantTags": [],
  "SpaceId": "Spaces-2",
  "Slug": "hotfix",
  "Links": {
    "Self": "/api/Spaces-2/projects/Projects-861/channels/Channels-1327",
    "Releases": "/api/Spaces-2/projects/Projects-861/channels/Channels-1327/releases{?skip,take,searchByVersion}",
    "Project": "/api/Spaces-2/projects/Projects-861"
  }
}

JSON is the same for both non working and working projects

One thing I notice - on project where force check appear, rule-test is called with preReleaseTag payload like this:

{"version":"1.36.9-30779.88","preReleaseTag":"^alpha\\.\\d+$","feedType":"BuiltIn"}

on projects where it is not working it is called without preReleaseTag:

{"version":"1.30.0-net6.66163","feedType":"BuiltIn"}

Just want to follow up if anything else I can provide for that issue ?

Hi @nkomlichenko,

Sorry for the delay, I was out sick yesterday but I’m back on deck today!

That info is great thanks, however I’ve still not been able to reproduce the behaviour you are seeing unless I am creating a Release in a Channel that doesn’t have any Package Version Rules configured.

From an earlier screenshot I noticed the Channel being used is CI however the JSON looks to be for the Hotfix channels. Does the CI channel have a Package Version Rule or does using the Hotfix channel allow for it to appear?

Feel free to reach out with any questions at all!

Best Regards,

Hotfix channel has the same rule ^$|^beta.\d+$. See screenshot.