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

(release) 2.4.0 #3559

Merged
merged 117 commits into from
Nov 12, 2024
Merged

(release) 2.4.0 #3559

merged 117 commits into from
Nov 12, 2024

Conversation

vexx32
Copy link
Member

@vexx32 vexx32 commented Nov 12, 2024

Description Of Changes

This is the finalization of the CLI v2.4.0 release.

This includes the milestone 69.

Motivation and Context

Finalizing release.

Testing

N/A / already completed.

Operating Systems Testing

N/A

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.
  • Finalising release changes

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v3 compatibility checked?

Related Issue

N/A

gep13 and others added 30 commits May 29, 2024 01:55
It was found that some builds are failing due to picking up the wrong
build agent, and as a result, some required applications were not
installed, so the build failed.

This commit makes the Build Agent requirements more specific to ensure
that the Agent Name is taken into consideration.  This was done as an
additional check, rather than replacing the existing requirements, as
they are simply being more explicit about the requirement, the existing
requirements are still valid.
Turns out that the comparison that is done on TeamCity is
case-sensitive, so with the previous commit the Agent Requirement was
still being ignored.

This commit switches from docker to Docker.
* master: (37 commits)
  (#310) Fix path to chocolatey.lib files
  (maint) Corrected casing of file
  (#23) Move call to SetRemotePackageNamesIfAllSpecified
  (#1901) Revert commit to display location
  (maint) Update Authenticode Signature
  (tests) Some minor tweaks for test consistency
  (#310) Set-EnvironmentVariable: delete values properly
  (tests) Remove v2 import tests
  (#310) Fix test issues
  (#310) Fixup v2 compatibility
  (tests) Working on tests during pairing session
  (#2050) Add Pester test for --ignore-pinned option
  (#3381) Add Pester tests for rule command
  (#1144) Add Pester test to cover hash validation
  (#72) Add Pester tests to cover new functionality
  (test) Update assertions for push commands
  (#1310) Add Pester test to validate output
  (#23) Add tests to handle install all
  (#2200) Add test for new enhanced exit code
  (#1764) Add test for new enhanced exit code
  ...
The MSI was erroneously creating the C:\ProgramData\Chocolatey
directory. This caused the install script to fail silently and not
actually install Chocolatey. This removes the directory from the install
and just lets the install script install to the default location.
The MSI was generating a C:\Tools directory, but never actually using
it. This commit removes the Tools directory from the install so it is
never created.
The GenerateDocs.ps1 file has been modified to support the Astro
framework that docs.chocolatey.org will be using.

- Frontmatter keys are lowercase
- import the Xref Component
- Switch links to use the Xref Component
- Ensure all code is within code blocks and not 4 spaces
  (.mdx does not recognize code blocks as 4 spaces)
- Ensure NOTE and WARNINGS are formatted correctly
- Update comments to use `{/* stuff */}`  instead of `<!-- stuff -->`
- Change file format to `.mdx`
Strip out some things platyps falls over on, and add some things back
in after platyPS is done that we want/need the docs site to have.
Use xml to process xref nodes in the document.
(#3446) (ENGTASKS-3631) Update GenerateDocs.ps1
Since these files are not copied to the output folder, and instead
are added to the choco.exe as resources, we need to additional verify
each script file from the source location, in the same way that they
are selected when they are being signed.
(build) Add templated notifications to all build configurations
This is an attempt to ensure that any changes to our dependencies,
whether that is:

* changes to NuGet packages through packages.config files
* updates to custom assemblies which are not tracked through NuGet
packages
* updates to custom executables/assemblies which are added directly to
the Chocolatey CLI Chocolatey Packages

Are trakced and updated properly.  By making these files/folder owned
by the new @chocolatey-credits-reviewers group, it means that a member
of that group will be flagged on any PR's that we raised that contain
these files.
Updated from 4.4.2 to 4.5.0
During a review, it was found that the CREDITS.md file, which contains
information about all the 3rd party dependencies that Chocolatey CLI
takes, was not up to date.

This commit addresses this by updating all version numbers, both in the
table of contents, and the main body of the document, to match what is
actually being used.  In addition, the license that is in place for the
Microsoft.Web.Xdt dependency is updated to reflect that correct one, as
this was recently updated.

Finally, a small typo was fixed:
Licensed Terms -> License Terms
This extension is useful when editing Markdown files, especially when
it contains a Table Of Contents. This extension will update the TOC
simply by making changes to the main body.

In order to get this new file to be included, it was necessary to add
another exclusion to the rules in the .gitignore file.
(doc) Update CREDITS.md file to match what is actually being used
We'll be replacing it with an editorconfig from a nuget package, but
need to remove the individual one here first.
So we don't accidentally commit an editorconfig file that's being
maintained by the nuget package.
This replaces the editorconfig file removed in earlier commits.
(maint) Replace .editorconfig with nuget package
This updates the dependency handling of packages to use
availablePackages when a package from the same source satisfies the
dependency.  This improves packages that have dependencies with many
versions available, and allows less data being requested from servers
in the case we have already have available packages from the source.

Without this fix, the installation will be delayed with repeated
resolution of the same package dependencies.

Use parentPackage version when finding the parent package.
This commit adds pester tests and files required for the pester tests.
The tests include ensuring that installing a package that contains a
dependency tree that spans lots of versions does not take unnecessarily
long. As well as duplicating an integration test into the pester tests
to provide us with some belt and suspenders to help us catch issues at
both the integration and the pester test levels.
(#3451) Use availablePackages in GetPackageDependencies
(maint) synced file(s) with chocolatey/.github
The MarkPackagePending method is used to create a .chocolateyPending
file in the package folder to indicate that there is a pending
operation that needs to be completed.

However, during an upgrade operation, the package folder is moved to
the lib-bkp folder, and as a result, doesn't exist anymore in the lib
folder.

If during the upgrade operation, something fails, for example, an
exception when trying to download the nupkg file, a process of
returning the package folder to the correct place begins.  The first
thing that is attempted is to create the .chocolateyPending file in the
package folder.  However, as mentioned, this folder no longer exists in
the expected location.  As a result, it is possible for an exception to
be thrown, as the file cannot be created in the package folder.

This problem can lead to another related problem in that the package is
now "lost" from lib folder, and will not show up when doing for example
choco list.

Imagine you were attempting the following command, and an exception
happened during the downloading of the nupkg:

choco upgrade audacity

Chocolatey CLI would start the upgrade operation, and then it would
fail downloading the package.  It would attempt to create the
.chocolateyPending file, and another exception would be thrown.  The
package folder is not returned to the lib folder, and now the package
is "lost".  If you attempt to run choco upgrade audacity again, the
operation would succeed, as it would see that the package is not
installed and it would be installed, however, if this happened during
the process of running choco upgrade all, then the underlying audacity
application would not be upgraded, as Chocolatey CLI is no longer
managing the package.

This commit addresses the issue by first checking to see if the package
folder exists.  If it doesn't, then it doesn't attempt to create the
.chocolateyPending file, and simply returns early.  This then allows
the remaining operations, i.e. returning the package folder from the
lib-bkp folder, back to the lib folder.
In order to fully test out the code path where the attempt to write the
.chocolateyPending file was failing, we needed to be able to return a
503/504 error from the server.  Realistically, this isn't feasible,
since it would mean having a server in place, that would be able to
respond with the right responses, at the right time.

After digging around for a little bit, I found the WireMock.Net
project, which seemed to do exactly what was needed, namely:

> WireMock.Net is a flexible product for stubbing and mocking web HTTP
responses using advanced request matching and response templating.

I took this for a spin, and was able to start/stop the server within
our test harnesses, and then was able to mock the required HTTP
requests, to get to the point during an Upgrade scenario, to then send
a 503 response.  This then started the code path for the
.chocolateyPending file, and I was able to make assertions that the
lib/lib-bad/lib-bkp folders worked as expected.

The only "change" that was needed to a normal test scenario, was to
change this line:

Configuration.Sources = "http://localhost:24626/api/v2/";

to force Chocolatey CLI to direct requests to the WireMock.Net server.

There is likely LOTS of things that we could start doing with this
server, and there is likely some code that needs to be added to
encapsulate the creation of the responses, to make them more re-usable,
but for now, the required responses for this code path has been
hard-coded into the responses.

NOTE: There are a LOT of packages added in this commit, and all of them
came in as a result of installing the WireMock.Net package.  Since this
is a test project, i.e. we are not shipping any of these, I don't
believe this to be a concern.
corbob and others added 24 commits November 6, 2024 13:46
Update the 7-zip binaries to the latest version (24.08). Also updates
the corresponding tests to ensure the correct version is shipped with
Chocolatey CLI. Due to changes in the way we run these tests, the gates
on Chocolatey versions have been removed.
(#3505) Update 7-zip binaries included with Chocolatey CLI
Work the ProcessTree into a service that can be pulled in to the
NugetCommon library in order to provide a more informative user agent
when querying repositories.
The primary method is quickest, but as it is an unstable API, we have a
need to provide a fallback that will be able to be used if the DLL is
missing/removed, or if the entry point is later removed.

Of the stable options, this p/invoke method seems to be the next best
option to work with.

Crucially, these p/invokes need to be provided by different types, so
that if there is a TypeLoadException from a failed p/invoke, we can
still attempt the fallback.

Also, added a couple more exclusions for the choco.exe shim and for
winlogon, which are not useful to include.
We need to define values for ReleaseOfficial for the benchmark project
or the Cake build complains.

Also added Chocolatey.PowerShell to the slnf in the repo, since that was
missing.
RuntimeInformation is shadowed by Mono which means that build breaks and
because all of the namespaces are the same under Mono's version, that
name is not usable in our build currently.

We can reuse our existing Platform.GetPlatform() helper here instead,
rather than trying to disentangle exactly why this build configuration
is not particularly functional.
These processes are not particularly useful to note as they are common
terminal emulators, so we can exclude them when looking at the process
tree.
Simplify some naming, also add a constant (and comment) to clarify what
some of the p/invoke nonsense is doing.
(ENGTASKS-3693) Prototype updating user agent with process information
A couple of small errors in the -WhatIf tests showed up on teamcity, so
this should hopefully fix those.
The Test Kitchen environment has both `hermes` and `hermes-all` enabled.
This results in a duplication of the warning message. This disables all
the sources and then enables just the `hermes` source. # Please enter
the commit message for your changes. Lines starting
This updates the tests to validate that the version number is not
output in the Info log messages only. There are some debug log messages
that may contain a similar version number as they report the user agent
being used, this prevents them from being erroneously picked up.
The debug log is used in a lot of places when we don't want the user to
see the output, but we want it available. At the moment it is not
consistent about what we do when they select debug and limit output. It
has been decided at the moment to remove these tests as they are now
breaking by us emitting the user agent to the debug log. A follow up
issue #3555 has been created to determine what we want for behaviour
when limit output and debug is selected.
Update the MSI build configuration to only build the MSI instead of
building unnecessary projects.
(maint) Remove chocolatey.benchmark and chocolatey.powershell from MSI build
Licensed does queries in the background before / while normal commands
are running, so we can end up with multiple user-agent debug lines.

Resolve this by just looking at the most recently-outputted user agent,
as these should all look the same (and if not, the last one should be
the one from the actual command run).
Automatic update from the current latest docs in the docs repo.
@vexx32 vexx32 requested a review from gep13 November 12, 2024 16:39
@vexx32 vexx32 changed the base branch from develop to master November 12, 2024 16:40
@vexx32 vexx32 requested a review from a team as a code owner November 12, 2024 16:40
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gep13 gep13 merged commit c704807 into master Nov 12, 2024
9 checks passed
@gep13 gep13 deleted the release/2.4.0 branch November 12, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants