I've got a project that looks like this:
project
|
├───src
│ Utility.groovy
│
└───vars
pipeline.groovy
script.ps1
In pipeline.groovy I have utility object:
def util = new Utility(this)
and a step that calls util.scriptCall(arg1: "1", arg2: "2", arg3: "3"), which is defined as:
this.context.powershell returnStdout: true, script: ".\\script.ps1 -Arg1 ${args.arg1} -Arg2 ${args.arg2} -Arg3 ${args.arg3} -Workspace ${this.context.env.workspace}"
From everything I've found I'm supposedly invoking this correctly, however I'm getting the following error:
.\script.ps1 : The term '.\script.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I've got the Powershell plugin installed but the lack of documentation for anything related to Jenkins isn't helping. I've moved script.ps1 into the src folder and even tried making a scripts folder for this with the same results.
Any idea why my invoking a script is getting interpreted as a cmdlet?
.). Do you know what the current working directory is when you run that command? If not, maybe you can throw in apwdorlsor something and try to see the output. Maybe the directory you're in isprojectand you'll need to call./src/script.ps1(PowerShell works fine with forward slashes/btw, in case you want to avoid having to escape backslashes all the time)/info! i was assuming that the workspace for jenkins would have been thevarsdirectory but i'll mess around with the path and see if i can get anything.