Build step 'Windows PowerShell' marked build as failure in jenkins - jenkins

I am trying to run a simple powershell script as a post build windows powershell step.
the command I have given is powershell -File test.ps1.
the test.ps1 file has a simple write-host that says: Write-Host "Hello how are you doing"
the build is a maven project and runs fine with out the inclusion of the windows powershell post step. However, with the inclusion of the powershell script it fails and throws the following error-
[JENKINS] Archiving C:\Jenkins\workspace\WLR3\pom.xml to aBILLity/NxTier/1.0-SNAPSHOT/NxTier-1.0-SNAPSHOT.pom
[WLR3] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Users\TEST_R~1\AppData\Local\Temp\jenkins9080398754273983665.ps1'"
The system cannot find the file specified
FATAL: command execution failed
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>(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
Caused: java.io.IOException: Cannot run program "powershell.exe" (in directory "C:\Jenkins\workspace\WLR3"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:249)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
at hudson.Launcher$ProcStarter.start(Launcher.java:449)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.build(MavenModuleSetBuild.java:939)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:890)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1794)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Windows PowerShell' marked build as failure
channel stopped
any help would be much appreciated!
thanks a lot!

Related

Run testSuite in katalon using Jenkins throwing "Access denied"

When I build My KatalonTestSuite using Jenkins in windows 10 I am getting below error message.
Started by user Forough Omidvar
Running as SYSTEM
Building in workspace C:\Program Files (x86)\Jenkins\workspace\KatalonTestSuiteRun
[KatalonTestSuiteRun] $ "C:\Program Files\Git\bin" -xe C:\Windows\TEMP\jenkins7833660586059993479.sh
Access is denied
FATAL: command execution failed
java.io.IOException: CreateProcess error=5, Access is denied
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
Caused: java.io.IOException: Cannot run program "C:\Program Files\Git\bin" (in directory "C:\Program Files (x86)\Jenkins\workspace\KatalonTestSuiteRun"): CreateProcess error=5, Access is denied
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:250)
at hudson.Proc$LocalProc.<init>(Proc.java:219)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:937)
at hudson.Launcher$ProcStarter.start(Launcher.java:455)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1853)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:427)
Build step 'Execute shell' marked build as failure
Finished: FAILURE
It seems Jenkin users don’t have the right permission to access the files but I have permission via windows/Security.

Selenide test in Jenkins:

i have tests written in Selenide.
On localhost Jenkins - they run successfully, but if i want put them on my company Jenkins - problems starts
My first attemp, without Xvfb:
Logs:
Failed scenarios:
src/test/resources/features/Login.feature:6 # Scenario: Login to programs with invalid credentials
src/test/resources/features/Login.feature:10 # Scenario: Login to programs with valid credentials
2 Scenarios (2 failed)
6 Steps (2 failed, 4 skipped)
0m3.089s
java.lang.IllegalStateException: No webdriver is bound to current thread: 1. You need to call open(url) first.
I dont know why, on local jenkins there's no error like You need to call open(url) first.
Second attemp, i read that xvfb is requied
configuration of xvfb in jenkins:
https://i.imgur.com/zFkcPFZ.png
https://i.imgur.com/BHCwDBS.png
Logs:
Xvfb starting$ Xvfb :3 -screen 0 1024x758x16 -fbdir /var/lib/jenkins/xvfb-8-..fbdir5500835804021266071
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "Xvfb": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:249)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
at hudson.Launcher$ProcStarter.start(Launcher.java:449)
at org.jenkinsci.plugins.xvfb.Xvfb.launchXvfb(Xvfb.java:587)
at org.jenkinsci.plugins.xvfb.Xvfb.setUp(Xvfb.java:697)
at jenkins.tasks.SimpleBuildWrapper.setUp(SimpleBuildWrapper.java:146)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:667)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1794)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 13 more
Finished: FAILURE
Also if i uncheck on xvfb installation 'install automatically' and if i try set 'Directory in which to find Xvfb executable' to default /usr/bin - i see error
Home path does not contain Xfvb executable: /usr/bin
Do You ever have problem like that with Jenkins?
What i should to do?
I can't use install automatically and should talk to Jenkins admin about path to xvfb executable?

Build Grails project (2.5) with jenkins

I try to build my grails project with jenkins, i'm newbie on jenkins.
first step i get my project from bitbucket,
after i used the grail plugin to build but i have this error :
What's wrong with my configuration, it's not a jenkins user right issue as i could see in several tickets
[mycj] $ /var/jenkins_home/workspace/mycj/grailsw -Dgrails.work.dir=mycj cl
ean --non-interactive --plain-output
FATAL: command execution failed
java.io.IOException: Cannot run program "/var/jenkins_home/workspace/mycj/grailsw" (in directory "/var/jenkins_home/workspace/mycj"): error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
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.Launcher$ProcStarter.join(Launcher.java:395)
at com.g2one.hudson.grails.GrailsBuilder.perform(GrailsBuilder.java:266)
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: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 15 more
Build step 'Build With Grails' marked build as failure
Finished: FAILURE
It looks like the Jenkins user doesn't have write permission on the working directory.

Jenkins - FileName Extensions error

I am using Jenkins for my work where I am trying to JMeter through Jenkins build option to run a batch file, but blocked with the below error.
Started by user admin
Building in workspace D:\
[] $ cmd /c call C:\Users\XXXX\AppData\Local\Temp\hudson4481668363865698547.bat
The filename or extension is too long
FATAL: command execution failed
java.io.IOException: Cannot run program "cmd" (in directory "D:\"): CreateProcess error=206, The filename or extension is too long
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:243)
at hudson.Proc$LocalProc.<init>(Proc.java:212)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64)
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:1720)
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=206, The filename or extension is too long
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 Windows batch command' marked build as failure
Finished: FAILURE
I have tried different option of invoking the build but always getting the same error.
Request you to please help in this issue, as I am not able to proceed.

sonar not generating reports with jenkins

I have jenkins installed and integrated with sonar but I get the following error during sonar analysis:
send-mail: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory
[workspace] $ mvn -f /root/.jenkins/jobs/test_4.9/workspace/pom.xml -e -B sonar:sonar -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.url=jdbc:mysql://xx.xx.xx.xx:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true -Dsonar.host.url=http://xx.xx.xx.xx:8080/sonar
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn" (in directory "/root/.jenkins/jobs/test/workspace"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:709)
at hudson.Launcher$ProcStarter.start(Launcher.java:338)
at hudson.Launcher$ProcStarter.join(Launcher.java:345)
at hudson.tasks.Maven.perform(Maven.java:263)
at hudson.plugins.sonar.utils.SonarMaven.executeMaven(SonarMaven.java:138)
at hudson.plugins.sonar.SonarPublisher.executeSonar(SonarPublisher.java:300)
at hudson.plugins.sonar.SonarPublisher.perform(SonarPublisher.java:261)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:685)
at hudson.model.Build$RunnerImpl.post2(Build.java:162)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:632)
at hudson.model.Run.run(Run.java:1463)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:239)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
... 18 more
Sonar analysis completed: FAILURE
Build step 'Sonar' changed build result to FAILURE
Build step 'Sonar' marked build as failure
Follow the instructions correctly in the URL to make sonar works with jenkins.

Resources