I am new to Jenkins, I recently want to schedule a task to run a local python script. I don’t have source control yet, so I selected “No” in “Source Control” when creating a job in the Jenkins user interface.
I did some research on how to execute python scripts in the Jenkins user interface, and I tried using Python Plugin to execute python scripts as build steps. But it failed. (But actually I do not want to use this plugin, since my script accepts input arguments, so I think I need to select something like "execute shell" in the BUILD field - I tried, but also failed). Can someone help me find how to run / call the local python script correctly?
PS: I also do not understand what Jenkins Workspace is and how it works? It will be appropriate if someone can clarify this for me.
Here is the console output I received after the build failed:
Started by user Yiming Chen [EnvInject] - Loading node environment variables. Building in workspace D:\Application\Jenkins\workspace\downloader [downloader] $ sh -xe C:\windows\TEMP\hudson3430410121213277597.sh The system cannot find the file specified FATAL: command execution failed java.io.IOException: Cannot run program "sh" (in directory "D:\Application\Jenkins\workspace\downloader"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.<init>(Proc.java:245) at hudson.Proc$LocalProc.<init>(Proc.java:214) at hudson.Launcher$LocalLauncher.launch(Launcher.java:846) at hudson.Launcher$ProcStarter.start(Launcher.java:384) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:108) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:65) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.Build$BuildExecution.build(Build.java:205) at hudson.model.Build$BuildExecution.doRun(Build.java:162) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1728) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 16 more Build step 'Execute shell' marked build as failure Finished: FAILURE
source share