Closed JamieMagee closed 5 years ago
Try without UBP param to Invoke-WebRequest or use some other way to download file in this case.
I tried without -UseBasicParsing
, and I got the same error message. I tried with System.Net.Webclient
, and I get the error message
Cannot bind argument to parameter 'Path' because it is null. (3.20s)
Is there anything obvious that's wrong with my package, or update script?
You cant use links without iwr.
Test this locally, you must change the parsing with web client to use text searching instead.
Solo update.ps1 will also show this err
Okay, I've updated it to parse the HTML text correctly, but now I'm back to the original error message
Job returned no object, Vector smash ?
@JamieMagee looking at the logs you have as artifacts on appveyor, it seems like the failure happens during the automated checksum grabbing.
I would suggest testing to calculate the hash manually instead (well semi-manually).
Change your update.ps1 script to the following (I'm using the version you used iwr)
import-module au
$releases = 'https://www.eclipse.org/jetty/download.html'
function global:au_BeforeUpdate {
$Latest.ChecksumType32 = 'sha256' # You can change this to whatever you want
$Latest.Checksum32 = Get-RemoteChecksum -Url $Latest.URL32 -Algorithm $Latest.ChecksumType32
}
function global:au_SearchReplace {
@{
".\tools\chocolateyInstall.ps1" = @{
"(?i)(^\s*url\s*=\s*)('.*')" = "`$1'$($Latest.URL32)'"
"(?i)(^\s*checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'"
}
}
}
function global:au_GetLatest {
$download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing
$url = $download_page.links | Where-Object href -match '^.*.zip$' | ForEach-Object href | Select-Object -First 1
$zip = ((Split-Path $url -Leaf) -split "-")[2]
$version = $zip.Substring(0, $zip.Length - 4).Replace('v', '')
@{
URL32 = $url
Version = $version
}
}
update -ChecksumFor none # Remember to change this to 'none'
If that doesn't work, you really shouldn't use COM objects but just parse the text for URL :) There are few examples out there I can dig up if you need some help with that.
@AdmiringWorm Calculating the hash manually works. I'm not sure what the root cause is, but if it works...
@majkinetor & @AdmiringWorm thank you for all your help :)
@JamieMagee I believe the root of the cause is the installation of the environment variable in the install script (I'm not 100% sure about that though).
Anyways, glad you managed to get it working though
I'm having issues creating a new AU package for jetty. These are my chocolatey/au scripts and this is the relevant output from my Appveyor build.
I'm struggling a little bit to see what the error is, as it works locally, but not on Appveyor, and the error message is a little bit cryptic.