Open OraDotNetDev opened 1 year ago
Sorry for the delay, it was holiday season here. I've removed the version check - could you try with your setup again?
Hi @yetanotherchris,
Thanks very much for getting back to me and for the code changes you've made to the package.
Apologies for my delay in responding, I was away last week.
Removing the version check, means an error is no longer thrown by the Package Internalizer. Unfortunately, due to this Internalizer issue the archive payload is not incorporated into the recompiled package, just the json manifest (see output below.)
Would it be possible to modify the logic further, parsing the json manifest at build time and embed the specific URI for ChromeDriver archive into the chocolateyinstall.ps1
Thanks
OraDotNetDev
PS C:\> choco download chromedriver --source='C:\Temp\Source' --internalize -i
Chocolatey v2.2.2 Business
Downloading existing package(s) to C:\download
chromedriver v116.0.5845.96
Found internalizable Chocolatey functions. Inspecting values for remote resources.
Found 'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json' for replacement.
Downloading: 100% - 349.28 KB
Download of 'known-good-versions-with-downloads.json' completed.
Replacing 'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json' with '$(Split-Path -parent $MyInvocation.MyCommand.Definition)\files\known-good-versions-with-downloads.json'
Adding -UseOriginalLocation to Install-ChocolateyPackage (if found).
You can also turn off the feature 'internalizeAppendUseOriginalLocation' to not append
Updating chocolateyInstall.ps1 with local resources.
Recompiling package.
Recompiled package files available at 'C:\download\chromedriver'
Recompiled nupkg available in 'C:\'
Hi @yetanotherchris,
Thanks very much for updating (#10) the ChromeDriver package to work with 116+.
Unfortunately, the new logic appears to break the Chocolatey Package Internalizer. This functionality is a paid C4B (Chocolatey for Business) feature, which incorporates external installer payloads into Chocolatey packages for internal enterprise distribution.
When the
choco download
command is called with the appropriate switches, the package is recompiled to use local, instead of remote resources.When the Internalizer parses ChocolateyInstall.ps1 for the
if
statement in the ChocolateyInstall the variable substitution for$url
is carried out, combining the "old" (<115) payload location plus the$chromedriverVersion
building an invalid urlhttps://chromedriver.storage.googleapis.com/116.0.5845.96/chromedriver_win32.zip.
The Internalizer then attempts to download the non-existent package and fails.As far I understand things the "old style fetch" will never be run, if an older version is being installed eg
choco upgrade chromedriver --version="114.x"
Chocolatey will download the 114.x version of the package rather than the current one.I was wondering if you'd consider taking a PR to remove the "old style fetch" logic, as this should resolve the issue we're experiencing with the Package Internalizer.
Thanks
OraDotNetDev
After further investigation/testing using the modified logic above, it appears that Package Internalizer doesn't capture the dynamic URL extracted from the json manifest downloaded from the googlechromelabs site.