Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support runtime checks for incompatible Chocolatey CLI and Chocolatey Licensed Extension versions #2660

Closed
3 tasks
gep13 opened this issue Mar 25, 2022 · 0 comments · Fixed by #2667 or #2669
Closed
3 tasks
Assignees
Labels
5 - Released Improvement IN MANUAL TEST SUITE These are things that are documented to test as part of a release.
Milestone

Comments

@gep13
Copy link
Member

gep13 commented Mar 25, 2022

Description

We need to provide information, during execution of choco.exe, when it is known that the version being used "could" be incompatible with the version of the Chocolatey Licensed Extension that is installed. The information should contain links to additional information on how to resolve these incompatibilities, or recommendations on how to proceed if the installed package versions can not be changed, for example, in the case of perpetual licenses. These warning should appear both at the very start of the operation that is being performed, as well as at the end of the operation.

In addition, there should be a feature flag (and associated options) that allow these warning to be hidden. It is intended that this feature would be used by those using a perpetual version of Chocolatey Licensed Extension where an upgrade isn't possible, and that they are aware of the incompatibilities and are happy to proceed with them in place. The warning that is shown should mention how this feature can be enabled.

Why Is It Needed

When installing a Chocolatey package, Chocolatey can ensure that any dependencies on the package are installed prior to installing the package. The same is not true in the reference direction.

For example, let's say that Chocolatey Licensed Extension v4.0.0 requires Chocolatey v1.0.0. Installing the Chocolatey Licensed Extension package will result in v1.0.0 of Chocolatey being installed. However, there is nothing to stop someone directly installing v1.0.0 of the Chocolatey package, and not first installing the v4.0.0 version of the Chocolatey Licensed Extension package.

As a result of the above, it is possible that an older version of Chocolatey Licensed Extension is being used with a newer version of Chocolatey, or vice versa (in very extreme situations). We need to provide a warning to the user when this is the case, so that they can take informed action on how to move forward.

Related Issues and Tickets

Acceptance Tests

  1. Install newer version of Chocolatey with older version of Chocolatey Licensed Extension installed
  2. Perform any Chocolatey operation
  • See warning at start of operation
  • See warning at end of operation
  1. Enable feature to hide warnings
  2. Perform any Chocolatey operation
  • No warning at start of operation
  • No warning at end of operation
    1.. Repeat above having a newer version of Chocolatey Licensed Extension installed compared to installed version of Chocolatey. The installed version should be a major version difference compared to the minimum supported version of Chocolatey. It will likely be necessary to fudge the AssemblyInfo in order to test this out properly.

Done Checklist

  • Documentation has been updated.
  • Automated tests have been added to cover this bug.
  • Manual tests have been added to cover this bug.
@gep13 gep13 added this to the 1.1.0 milestone Mar 25, 2022
@gep13 gep13 self-assigned this Mar 25, 2022
@corbob corbob added the ADD AUTO TESTS Things that typically go to Test-Kitchen - once completed, IN REGRESSION TEST SUITE label added label Mar 25, 2022
gep13 added a commit to gep13/choco that referenced this issue Mar 28, 2022
In order to provide as much support to users of Chocolatey as possible,
we have added the concept of a minimum required Chocolatey version
attribute to the Chocolatey Licensed Assembly.  When reading this
assembly (if present), we will extract this attribute, and then use it
to make assertions about whether things are currently known to be
compatible.

When it is found that they are not compatible, a warning is shown
before and after the command execution to try to make it as clear as
possible that things might not work as expected.

A new feature flag has been introduced, disableCompatiblityChecks,
which a user can opt-in to, to prevent the warnings from showing, but
this is disabled by default.  The warning shows how this feature can be
turned on if they are sure that they know what they are doing.

In addition, a command line option has been added to allow by passing
these warnings without having to enable the feature, with the
skip-compatibility-checks option.

In addition, due to the fact that we can, and do, load the Chocolatey
Licensed Assembly from memory, the Location property can be null.  When
this is the case, and it hasn't been possible to extract the version
information, we reach into the custom attributes for the assembly to
pull out the information, as this is needed to assert on the
compatibility of the versions.
gep13 added a commit to gep13/choco that referenced this issue Mar 28, 2022
There are new options added in both CLI and Licensed Extension around
compatibility checks, and which packages to exclude during the choco
upgrade all command.

This commit adds these options into the PowerShell script, so that they
work as expected once installed.
gep13 added a commit to gep13/choco that referenced this issue Mar 28, 2022
In order to provide as much support to users of Chocolatey as possible,
we have added the concept of a minimum required Chocolatey version
attribute to the Chocolatey Licensed Assembly.  When reading this
assembly (if present), we will extract this attribute, and then use it
to make assertions about whether things are currently known to be
compatible.

When it is found that they are not compatible, a warning is shown
before and after the command execution to try to make it as clear as
possible that things might not work as expected.

A new feature flag has been introduced, disableCompatiblityChecks,
which a user can opt-in to, to prevent the warnings from showing, but
this is disabled by default.  The warning shows how this feature can be
turned on if they are sure that they know what they are doing.

In addition, a command line option has been added to allow by passing
these warnings without having to enable the feature, with the
skip-compatibility-checks option.

In addition, due to the fact that we can, and do, load the Chocolatey
Licensed Assembly from memory, the Location property can be null.  When
this is the case, and it hasn't been possible to extract the version
information, we reach into the custom attributes for the assembly to
pull out the information, as this is needed to assert on the
compatibility of the versions.
gep13 added a commit to gep13/choco that referenced this issue Mar 28, 2022
There are new options added in both CLI and Licensed Extension around
compatibility checks, and which packages to exclude during the choco
upgrade all command.

This commit adds these options into the PowerShell script, so that they
work as expected once installed.
gep13 added a commit to gep13/choco that referenced this issue Mar 28, 2022
In order to provide as much support to users of Chocolatey as possible,
we have added the concept of a minimum required Chocolatey version
attribute to the Chocolatey Licensed Assembly.  When reading this
assembly (if present), we will extract this attribute, and then use it
to make assertions about whether things are currently known to be
compatible.

When it is found that they are not compatible, a warning is shown
before and after the command execution to try to make it as clear as
possible that things might not work as expected.

A new feature flag has been introduced, disableCompatiblityChecks,
which a user can opt-in to, to prevent the warnings from showing, but
this is disabled by default.  The warning shows how this feature can be
turned on if they are sure that they know what they are doing.

In addition, a command line option has been added to allow by passing
these warnings without having to enable the feature, with the
skip-compatibility-checks option.

In addition, due to the fact that we can, and do, load the Chocolatey
Licensed Assembly from memory, the Location property can be null.  When
this is the case, and it hasn't been possible to extract the version
information, we reach into the custom attributes for the assembly to
pull out the information, as this is needed to assert on the
compatibility of the versions.
gep13 added a commit to gep13/choco that referenced this issue Mar 28, 2022
There are new options added in both CLI and Licensed Extension around
compatibility checks, and which packages to exclude during the choco
upgrade all command.

This commit adds these options into the PowerShell script, so that they
work as expected once installed.
vexx32 added a commit that referenced this issue Mar 28, 2022
(#2660) Add runtime check for compatibility with installed Chocolatey Licensed Extension
@corbob corbob added IN MANUAL TEST SUITE These are things that are documented to test as part of a release. and removed ADD AUTO TESTS Things that typically go to Test-Kitchen - once completed, IN REGRESSION TEST SUITE label added labels Mar 29, 2022
@gep13 gep13 linked a pull request Mar 29, 2022 that will close this issue
7 tasks
gep13 pushed a commit to corbob/choco that referenced this issue Mar 29, 2022
When running choco.exe with no Chocolatey Licensed Extension in play the
compatibility warnings were still showing when they shouldn't. Make sure
to initialize the ChocolateyLicense with IsCompatible defaulting to true
until found to be anything else, as well as to only show the warnings
when it is known that a licensed version is being used.
gep13 added a commit that referenced this issue Mar 29, 2022
(#2660) Check for valid license before checking for compatibility
@gep13 gep13 added 4 - Done and removed 3 - Review labels Mar 29, 2022
gep13 added a commit that referenced this issue Mar 30, 2022
* release/1.1.0: (22 commits)
  (#2659) Handle scenario where install has no buffer
  (version) v1.1.0-beta
  (maint) Remove unnecessary whitespace
  (#2660) Only show warnings when using license
  (#2659) Add licensed extension detection on install
  (maint) Tidy up existing script format
  (#2660) Expand Tab completion for new options
  (#2660) Add runtime check for compatible versions
  (maint) Remove whitespace and fix formatting
  (#2650) Upgrade 7z to 21.07
  (#2663) Check file signature on 6 bytes
  (version) 1.1.0-alpha
  (#2083) Use correct formatting
  (#2083) Support installation using PowerShell Core
  (#1896) Outdated with ignore-pinned use correct enhanced exit code
  (maint) typo outdated -> outdated
  (maint) Remove unnecessary using statement
  (#2525) Close config file before we try to copy
  (#2540) Python source disable all keyword on upgrade
  (maint) formatting
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Released Improvement IN MANUAL TEST SUITE These are things that are documented to test as part of a release.
Projects
None yet
2 participants