Execute script into Jenkins file system from the job - jenkins

I am a Jenkins newbie, so I am sorry if this question looks so. I would like to execute batch command from Jenkins master, which can execute script stored into Jenkins file system, so NOT into workspace created by Jenkins into my local D:/... .
I am trying from Execute Windows batch command field:
start https://our.jenkins.in.company.cz/var/jenkins_home/HELLO/hello.py
but Jenkins cannot find the file:
HTTP ERROR 404 Not Found
URI: /var/jenkins_home/HELLO/hello.py
STATUS: 404
MESSAGE: Not Found
SERVLET: Stapler
R/W/X rights for the script are allowed.
Please let me know how to achieve the right way.
Thank you very very much.

I assume the python was installed on the machine.
May you can run the script with the following command:
python /home/some-user/mount/HELLO/hello.py
But I am little bit confused, because you wrote about an Windows batch command and "D:/" path which assume you work on windows system but /home/some-user/mount/HELLO/hello.py assume something is linux based system.
The start as I see works with .exe runnable, you need to tell exactly to run a script with python, this is the first part of the command.
If you using windows with linux subsystem, may you can run something like this as I remember correctly:
python D:\windowspath_to_subsytem\home\some-user\mount\HELLO\hello.py

Related

How to use Rhapsody from Jenkins to generate code - Facing License issue

I am trying to generate code from RhapsodyCL using a batch script. When I run this batch script using cmd, the code is generated just fine but when I try to generate code via Jenkins I am getting error in the Jenkins build output which I think is because of trying to start RhapsodyCL due to 'license not found'.
The error in Jenkins console output looks like:
11:33:10 C:\Test>rhapsodyCL.exe -f C:\Test1\Test-BitBucket\script.bat
11:33:13
11:33:13 C:\Test>exit -1
-1 is the rhapsody return code for license not found.
So is this a Jenkins issue that it can not find the Rhapsody license ? Or is it something else ?
There are not many details in your question but rhapsody code generation via jenkins has worked for me in the past so:
Is it rhapsody installed for All Users in the jenkins machine?

NUnit3 with SpecFlow runs in VS and as batch command but not in Jenkins

I have my selenium tests written using SpecFlow(+SpecRun) and NUnit framework (v.3.8.1.0). I've configured Jenkins to run these tests. My Jenkins Windows Batch Command is as follows:
"C:\Program Files (x86)\NUnit.ConsoleRunner\3.7.0\tools\nunit3-console.exe"
C:\Projects\Selenium\ClassLibrary1\PortalTests\bin\Debug\PortalTests.dll
--test=TransactionTabTest;result="%WORKSPACE%\TestResults\TestR.xml";format=nunit3
When I trigger build test seems to start running as I'm getting as far as end of NUNIT3-CONSOLE [inputfiles] [options] with spinner indicating that test is running but it actually never ends and estimated remaining time is: N/A.
Now, when I run this script with windows cmd.exe:
"[PATH to Console.exe]\nunit3-console.exe" PortalTests.dll -- test=TransactionTabTest
this test pass successfully and so does in VS.
Now, I know this is very generic question but any clues will be much appreciated.
As you are using SpecFlow+Runner/Specrun, you can find the documentation how to configure it for the different build servers here: http://specflow.org/plus/documentation/SpecFlowPlus-and-Build-Servers/

Jenkins + CasperJS

I have a series of frontend tests written in CasperJS that I need to run in Jenkins. Here is command I run from the command line: casperjs test ./src/tests/**/ts_*.js --xunit=xunit.xml. This runs the tests and saves the xunit file. Ok. When I have Jenkins run the same command it gets through loading the first test page and spits out this error: "Process leaked file descriptors" and directs me to: https://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build
It provides an explanation and a few OS specific work arounds. The environment this will be run on will eventually be linux however my development environment is Windows and I don't understand the workaround they provide. What kind of file is that and how does it fit with Jenkins?
Does anyone have experience running CasperJS tests using Jenkins?
I installed jenkins as a service and use default settings.
I solved same issue on windows.
if you are running as a service and default home directory ( c:/program files(x86)/jenkins/ )
you have to change path to other normal folder(ex.c:/jenkins/").
SET JENKINS_HOME=c:\jenkins\
What I do with jenkins and casper:
I create a job with string parameter 'tests', which takes *.js or specified test
and try to run casper tests via Build -> Execute shell
cd ~/test_directory
casperjs test ${tests}

execute shell step skipped completely in jenkins

I can't seem to run a build execute shell step in Jenkins. I've worked with Hudson in the past on windows and I was able to create shell/batch steps without a problem but I seem to be be missing something here.
It's a fresh jenkins install and I go to "add build step", "execute shell" and enter "echo hi" in the command. I run the build and when I look in the console output, nothing happens.
I've also tried executing a test.sh file which also just echoes hi. I've tested this in both a linux install and an os X installed Jenkins server.
What am I missing in the configuration to run a shell script?
The console output shows that the shell script steps were skipped completely
Started by user admin
Finished: SUCCESS
It looks like Jenkins is not being able to redirect the output from the system. What version of Java are you using? If you're using OpenJDK, could you try with Sun Java/Sun JDK?
First test to try to check if anything is executing at all: add the following to your "Execute Shell"
#!/bin/bash
echo "HELLO WORLD" > /tmp/testfile
Run this and check if there is a /tmp/testfile in on your Linux system, and if it contains the HELLO WORLD text, it means your script is in fact executing.
Which version of Jenkins do you have?
The last good version that I can attest to (last one I know works well at least for us) is 1.447. If you're not using that one, would you be able to try with it?
Also, could you add #!/bin/sh or #!/bin/bash before echo hi on your "Execute Shell" for the Linux system and see if that works.
Also, try running a script using source /path/to/script and see if that works. The script should contain #!/bin/sh or #!/bin/bash as the first line, just to see if that makes a difference.
Note: none of this should be required, but is helpful just to get more information on what's going on. Couldn't fit all this into a comment. I'll update my answer based on your answers to the above, or delete if I can't get anything..
Putting this here for posterity.
I had a Jenkins project configured with Maven running clean test and a execute shell in the pre steps. The logs from Maven where not coming through and the script was not executing. Once I unchecked Build modules in parallel under the Maven build options my logs and scripts started working.
Make sure its in a location where Jenkins can see it, check permissions.

CruiseControl: Run from Command Line = Success, as Windows Service = Failure

Really hope you can help. I've configured CruiseControl to build a java project on a spare Windows XP machine in the office, but am finding it errors out with a ClassDefNotFound when CruiseControl is invoked via a Windows Service.
The exact error is: java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
I understand this to be in the ant-launcher.jar file.
I've placed this file (and all the other Ant 1.8.2 jars) in the lib subdirectory of CruiseControl. When run on the commandline from the CruiseControl directory with the following command, I don't get any classpath errors:
cruisecontrol --configfile config.xml
I'm really hoping this is either trivial to a fresh pair of eyes, or rings a bell with someone who's trodden this path before.
Thanks!
Ben
Your environment variables are probably defined as user variables rather than system variables. Services will not be run as a normal user.
Try to invoke the cruisecontrol-launcher.jar file from your cruise control installation path & also ensure that cruise control process has been started as a service.
eg:-
java -jar C:\Program Files\CruiseControl\lib\cruisecontrol-launcher.jar

Resources