Made sure to set my PATH environment variable on my node for those directories and I can ‘ls’ and see what the directories have in them within my pipeline. However I still get this error at the Import-PackageProvider run:
where did you do that? I don’t see that in the pipeline at all. Did you set it in the agent configuration?
how did you confirm it? Most of the time that means someone tested it with their local user, but not the user that runs jenkins. Best way to confirm is bat('echo %PATH%')
I set the environment variables on the agent configuration. To validate this, in testing prior I ran powershell ‘$env:path’.
When I said the same command I meant ‘Import-PackageProvider’. I did test this with my local user, but I can also test it with the user account that the jenkins service runs as.
I personally do linux and shell scripting, so i can’t be a lot of help. I’m just asking questions hoping it can spark something. I don’t think its a jenkins specific issue. It feels like some env variable is not making it into the pipeline.
I was denied posting for 22 hours, sorry about that.
I’ll use markdown in the future, thanks for the info. Get-PackageProvider -ListAvailable queries the internet but also queries the local machine, so it doesn’t need the internet but will warn if you’re not connected.
I did end up figuring this out.
32-bit PowerShell was being executed. Found this by running [Environment]::Is64BitProcess() within the PowerShell pipeline step. Which seems to be invoked by Java.
Mistakenly had a 32-bit version of Java installed, so while my server was 64-bit, the Jenkins-controller was seeing it as 32-bit.
I tried uninstalling the 32-bit version of Java, installed a 64-bit version, deleted the agent, and the service, but recreated the agent, connected and the agent showed up as 64-bit, still 32-bit PowerShell was getting executed.
Deploy an entirely new server. Installed 64-bit Java, created new agent, connected, agent showed as 64-bit.
That last bullet point got me past the original issue and with a lot of fiddling around with string interpolation I’m now able to use Publish-Module to Artifactory using the PowerShell pipeline step.
Not sure why the uninstall/re-install didn’t work and kept invoking 32-bit powershell but I assume it has to deal with a Java configuration not getting refreshed.