Create a build job for sample cucumber ruby project - ruby

I am trying to create a build job for my cucumber test in mac. However its throwing error. Not sure what i am doing wrong. I can run my tests using this in Terminal:
bundle exec cucumber -t #tests
in Jenkins "Execute Batch commands" section i have added below:
bundle install
bundle exec cucumber -t #tests
I am getting this below errors in my Jenkins Console Output:
Started by user anonymous
Building in workspace /Users/MacPro/.jenkins/workspace/build_job_name
[tests_build] $ cmd /c call /var/folders/fx/m8ltp5dx17lbmqpgpwlc9ps00000gn/T/hudson6634803463309653425.bat
FATAL: command execution failed
java.io.IOException: Cannot run program "cmd" (in directory "/Users/MacPro/.jenkins/workspace/tests_build"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
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:782)
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:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
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:184)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 15 more
Build step 'Execute Windows batch command' marked build as failure
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE
Need help to resolve this.

Related

Gradlew checkstyleMain command not using right directory

I'm trying to run ./gradlew checkstyleMain on my project, and I keep getting this error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':checkstyleMain'.
> Unable to create Root Module
when I run it with --stacktrace, I get
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module SuppressionFilter - Unable to find: .checks/checkstyle_suppressions.xml
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:477)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:198)
at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.createRootModule(CheckstyleAntTask.java:412)
... 140 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to find: .checks/checkstyle_suppressions.xml
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.getSuppressionLoader(SuppressionsLoader.java:279)
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.loadSuppressions(SuppressionsLoader.java:233)
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.loadSuppressions(SuppressionsLoader.java:220)
at com.puppycrawl.tools.checkstyle.filters.SuppressionFilter.finishLocalSetup(SuppressionFilter.java:81)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:194)
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:472)
... 142 more
Caused by: java.io.FileNotFoundException: /Users/Matthew.Hall/.gradle/daemon/7.4.2/.checks/checkstyle_suppressions.xml (No such file or directory)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:653)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:150)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:861)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
at com.puppycrawl.tools.checkstyle.XmlLoader.parseInputSource(XmlLoader.java:84)
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.getSuppressionLoader(SuppressionsLoader.java:275)
... 147 more
I've checked, and the file is in the my in my .checks folder in my project, however that last "caused by" makes it look like its checking a folder it shouldn't be.
I'm able to work around it by copying my .checks folder from the project into /Users/Matthew.Hall/.gradle/daemon/7.4.2/ but I shouldn't have to do that.
How can I fix this? (Can't figure out how to get it to check in my project folder instead of .gradle/daemon/7.4.2).

Jenkins Build Failure, is this a Path variable issue?

I am new to Jenkins and currently doing a course on Udemy, I am working on Windows.
I am trying to build a sample project using the Maven plugin.
I am getting the following error in the console output after the build failure.
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program " C:\Program Files\Java\jdk1.8.0_291/bin/java" (in directory "C:\Users\Shashank\AppData\Local\Jenkins\.jenkins\workspace\Time Tracker"): 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:252)
at hudson.Proc$LocalProc.<init>(Proc.java:221)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
at hudson.Launcher$ProcStarter.start(Launcher.java:508)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:802)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:513)
at hudson.model.Run.execute(Run.java:1906)
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: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:453)
at java.lang.ProcessImpl.start(ProcessImpl.java:140)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 12 more
Finished: FAILURE
I noticed a sudden change from \ to / in here
Cannot run program " C:\Program Files\Java\jdk1.8.0_291/bin/java"
is that the issue ? Any help will be appreciated.
Below is a screenshot of the configuration
It can be due to the space at the beginning of the command.
try "C:\Program Files\Java\jdk1.8.0_291/bin/java" instead of " C:\Program Files\Java\jdk1.8.0_291/bin/java"
even " C:\Windows\explorer.exe" won't work with the preceding space character when it is used with quotation marks...

WIndows Gitlab-runner: Failed to requeue the runner

I have a pipeline with 2 jobs.
I start user as super user on windows with debug mode and received next output:
Checking for jobs... received job=24173 repo_url=https://scm-01.oursite.com/theproject/theproject-tests.git runner=ub7wf5mg
Failed to requeue the runner builds=1 runner=ub7wf5mg
Running with gitlab-runner 12.8.0 (1b659122) job=24173 project=789 runner=ub7wf5mg
on vm14rkwEggplant ub7wf5mg job=24173 project=789 runner=ub7wf5mg
Shell configuration: environment: []
dockercommand:
- PowerShell
- -NoProfile
- -NoLogo
- -InputFormat
- text
- -OutputFormat
- text
- -NonInteractive
- -ExecutionPolicy
- Bypass
- -Command
- '-'
command: powershell
arguments:
- -noprofile
- -noninteractive
- -executionpolicy
- Bypass
- -command
passfile: true
extension: ps1
job=24173 project=789 runner=ub7wf5mg
Using Shell executor... job=24173 project=789 runner=ub7wf5mg
Waiting for signals... job=24173 project=789 runner=ub7wf5mg
No referees configured job=24173 project=789 runner=ub7wf5mg
Executing build stage build_stage=prepare_script job=24173 project=789 runner=ub7wf5mg
Executing build stage build_stage=get_sources job=24173 project=789 runner=ub7wf5mg
Feeding runners to channel builds=1
WARNING: Failed to parse "X-GitLab-Trace-Update-Interval" header error=strconv.Atoi: parsing "": invalid syntax header-value= job=24173 runner=ub7wf5mg
Appending trace to coordinator... ok code=202 job=24173 job-log=0-536 job-status=running runner=ub7wf5mg sent-log=0-535 status=202 Accepted update-interval=0s
Executing build stage build_stage=upload_artifacts_on_failure job=24173 project=789 runner=ub7wf5mg
Skipping referees execution job=24173 project=789 runner=ub7wf5mg
WARNING: Job failed: exit status 1 duration=4.9592837s job=24173 project=789 runner=ub7wf5mg
WARNING: Failed to parse "X-GitLab-Trace-Update-Interval" header error=strconv.Atoi: parsing "": invalid syntax header-value= job=24173 runner=ub7wf5mg
Appending trace to coordinator... ok code=202 job=24173 job-log=0-2526 job-status=running runner=ub7wf5mg sent-log=536-2525 status=202 Accepted update-interval=0s
Submitting job to coordinator... ok code=200 job=24173 job-status= runner=ub7wf5mg
WARNING: Failed to process runner builds=0 error=exit status 1 executor=shell runner=ub7wf5mg
Output of pipeline in gitlab is next:
Running with gitlab-runner 12.8.0 (1b659122)
on vm14rkwEggplant ub7wf5mg
Using Shell executor...
Running on KS-IDE-TS4...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in C:/GitLab-Runner/builds/ub7wf5mg/0/ourproject/ourproject-winappdriver-tests/.git/
From https://scm-01.ourproject.com/ourproject/ourproject-winappdriver-tests
* [new ref] refs/pipelines/5813 -> refs/pipelines/5813
Checking out c924c09b as master...
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/Microsoft.CodeAnalysis.CSharp.dll: Invalid argument
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/Microsoft.CodeAnalysis.dll: Invalid argument
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/Microsoft.CodeAnalysis.VisualBasic.dll: Invalid argument
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/Microsoft.DiaSymReader.Native.amd64.dll: Invalid argument
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/System.Buffers.dll: Invalid argument
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/System.Collections.Immutable.dll: Permission denied
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/System.Memory.dll: Permission denied
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/System.Numerics.Vectors.dll: Permission denied
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/System.Reflection.Metadata.dll: Permission denied
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/System.Runtime.CompilerServices.Unsafe.dll: Permission denied
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/System.Threading.Tasks.Extensions.dll: Permission denied
warning: failed to remove packages/Microsoft.Net.Compilers.Toolset.3.4.0/tasks/net472/VBCSCompiler.exe: Invalid argument
ERROR: Job failed: exit status 1
If I restart the runner the first job became succesefull, but the secound one fails again with very similiar error.
The git version is
git version 2.25.1.windows.1
Is there any workaround for this issue? If downgrade of runner could help me?
So the problem was that I had a running process with a location in my repository. First, I kill it manually and the job started to work properly. Then I deleted this package at all from my solution and started to use the same file but from outside of the repository.
It was VBCSCompiler.exe file.
To try, you can first kill it manually from runner or by the cmd command:
tasklist | find /i "VBCSCompiler.exe" && taskkill /im VBCSCompiler.exe /F \|| echo process "VBCSCompiler.exe" not running.
Then I delete the nuget package Microsoft.Net.Compilers.Toolset, therefore this process path was changed to the
C:\Program Files (x86)\Microsoft Visual
Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn

Sencha app getting failed because of Failed creating background process and error occured

Sencha app getting failed because of Failed creating background process and error occured.
My app was getting failed then on StackOverflow I found some answer which is all about change ruby. I tried couple of ruby versions but didn't get any luck with that.
I have ruby 2.2.2 installed and I am trying to build my app. I am getting following error. This is very annoying.
** This Failed after change ruby, and I change ruby because of the next error**
BUILD FAILED [ERR] com.sencha.exceptions.ExProcess: Failed
creating background process [ERR] java.io.IOException: Cannot run
program "ruby" (in directory
"C:\User\MasterBuild\trunk\1\1\1\1\AppName\build\temp\production\AppName\sass"):
CreateProcess error=2, The system cannot find the file specified
And these are the actual error.
[ERR] The following error occurred while executing this line:
C:\1\MasterBuild\trunk\1\1\1\1\AppName.sencha\app\build-impl.xml:284:
The following error occurred while executing this line:
C:\1\MasterBuild\trunk\1\1\1\1\AppName.sencha\app\sass-impl.xml:155:
The following error occurred while executing this line:
C:\1\MasterBuild\trunk\1\1\1\1\AppName.sencha\app\sass-impl.xml:176:
com.sencha.exceptions.ExProcess: Failed creating background process
Can anyone please give some suggestion how to fix that. Thanks for all help.

Gradle build fail with Cannot run program No such file or directory

I have a gradle build file with the following task which need to run sphinx-build, I'm running it on Mac OS X with the gradle information bellow.
task makeDocs(type:Exec) {
workingDir 'sphinx'
commandLine 'sphinx-build'
args = ["-b", "html", "-d", "build/doctrees", "-t", "$platformDir", "build/ppsource", "build/html"]
}
When I run this task I get the following exception:
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'sphinx-build'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:65)
... 1 more
Caused by: java.io.IOException: Cannot run program "sphinx-build" (in directory "/Users/idoran/Documents/Seebo/dev/SDK/seebosdk_docs/sphinx"): error=2, No such file or directory
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 3 more
Caused by: java.io.IOException: error=2, No such file or directory
When I run sphinx-build from the same terminal everything works fine.
$ gradle --version
------------------------------------------------------------
Gradle 2.2.1
------------------------------------------------------------
Build time: 2014-11-24 09:45:35 UTC
Build number: none
Revision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a
Groovy: 2.3.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_65 (Oracle Corporation 25.65-b01)
OS: Mac OS X 10.10.5 x86_64
Try stopping the gradle daemon with ./gradlew --stop
I had the same problem with something as simple as:
commandLine = [ "node", "--version"]
It came down to the gradle daemon having a cached location of node which no longer existed (I had updated node sometime before).
You shouldn't use commandLine + args together in a Gradle Exec task. Either use commandLine with executable and all arguments as the value, or executable + args which is the better alternative usually.
I had similar issue.. With Vampire's solution, I was able to step up.. However the issue seems to be the sh file not able to point to the exact file location.
Meaning, even with workingDir (wherein actual sh file resides) set properly, still was getting the following exception.
Caused by: java.io.IOException: error=2, No such file or directory
Finally, this post resolved the issue..
Though the original issue of this post's question is already resolved, thought of sharing this solution of adding the absolute file path to actual sh file would resolve the "No such file or directory" issue to someone in the future..
I ran into similar issue and got it resolved with absolute path reference to sh file.
Mine was,
workingDir = "path_to_the_actual_sh_file_to_be_executed"
executable = new File(workingDir, 'actual.sh')
args = ['configure', 'manageRepo', '-tenant', 'etc...']
This error can occur for a couple different reasons. Unfortunately it is not always clear from the error message which one is the problem.
workingDir does not exist. Make sure the specified directory exists before your task runs, or create it in a doFirst block like this:
task makeDocs(type: Exec) {
workingDir 'sphinx'
executable 'sphinx-build'
args = ["-b", "html", /* other args... */]
doFirst {
workingDir.mkdirs()
}
}
The specified executable does not exist or is not on the path. As other answers mention, make sure you are either specifying only commandLine, or both executable and args. So either:
commandLine "sphinx-build", "-b", "html"
or equivalently,
executable = "sphinx-build"
args = ["-b", "html"]
My gradle file contained a snippet to get the aws auth token and I was getting the same failure - Caused by: java.io.IOException: error=2, No such file or directory
In my case, the issue was not caused due to caching.
It was due to gradle not being able to find the aws binary.
What worked for me - Use the which aws command to find the absolute path to aws binary and use it for the binary as shown below. Hope this helps someone with similar issue.

Resources