failure to launch exe from ant - jenkins

I am using Jenkins to run an Ant script which in turn launches an exe. The exe fails to launch. I get no results at all. The exe opens fine on the server without Jenkins via Ant. Other exe files do seem to launch OK. The only thing I can see that is different is that my problematic exe opens a dialog which then automatically closes. Does anyone have an idea how to get Jenkins to launch my exe? Is there some setting or parameter I am missing?
I am calling the exe with the exec task and passing in arguments.
If I try to run the exe directly from Jenkins using "Execute Windows Batch Command" I also get no results.

Thanks for your help.
once I set the Jenkins service to run under a real login instead of just using the system account, the application runs.

Related

TFS Build: stuck when running .exe

I run BUILD in TFS, and one of the steps contains executing the .exe file.
If i run this .exe file separately, on the remote PC where BUILD is running, it operates correctly and successfully.
But when it is being called from BUILD, it simply gets stuck on this stage.
I used debug mode, copied exactly the command it is running of this type:
C:\Windows\system32\cmd.exe /c "C:\Agents\Agent2.....<my path>...\my_file.exe"
Copied it, used the Win+R (run), pasted - it works perfectly.
When can't the BUILD run the .exe file?
Thanks.
I suppose because the application is trying to do something UI-y. The agent is running as a service and any application running during the build should not use the UI in any way. Anything that relies on Windows Forms, WPF or the Message Pump won't work as long as the agent isn't running Interactively.
Try running the exact command from a scheduled task, that should also allow you to test non-interactively.

launch a .bat in TFS2015 build

I have a problem trying to launch a server via a .bat file during a TFS build.
I usually launch the server via a cmd window and it works fine.
When I set it in the TFS build, I end up with the following message :
"'..\server_common.bat' is not recognized as an internal command or external, an executable or a command file".
I also have the following line:
"java -Dsun.lang.ClassLoader.allowArraySyntax=true -Xbootclasspath/a:..\..\..\lib\framework\serverjvm15.jar; -cp ..\..\..\lib\framework\fwtime.jar;" indicating a java syntax error (? I'm not skilled in java)
This batch calls other .bat files and sets java VM-related environment variables
From my research, it is probably a problem of rights as I don't have admin rights when I use TFS. However, all the other steps in the build work fine (installing and launching an appli through command lines, or launching a python script via command lines).
However I also tried to launch a basic script with the same kind of step and it works.
First, suggest you to follow the tutorial in Batch script. Make sure you have meet the requirements of Arguments and used correctly. Such as
Path
Specify the path to the .bat or .cmd script you want to run. The path
must be a fully qualified path or a valid path relative to
the default working directory. In Team Foundation Build, this
directory is $(Build.SourcesDirectory).
Also RDP to your build agent and use your build service account manually run the server_common.bat to narrow down if the account have enough permission.

Running a Windows batch file in Jenkins

I trying to run my Tests cases for a project in Jenkins through DOS Command line on Windows server . I am using Jenkins ver. 1.559.
I am trying to run a Windows batch file through a Jenkins job that has the java command.
Under the "Build" section >> "Execute Windows Batch command" >> Command: call E:\Jenkins\App\UnitTests\App_UnitTests.bat
Save and Build the job.
I am getting an error and here is my Console Output
C:\Program Files (x86)\Jenkins\jobs\App Test Cases\workspace>java.exe -cp "E:\Jenkins\App\PPS\App\bin\;E:\Jenkins\App\PPS\App\lib\junit-4.10.jar;E:\Jenkins\App\PPS\App\lib\*.jar;" org.junit.runner.JUnitCore com.omnitracs.fra.junit.EventTests
'java.exe' is not recognized as an internal or external command, operable program or batch file.
C:\Program Files (x86)\Jenkins\jobs\App Test Cases\workspace>PAUSE
Press any key to continue . . .
C:\Program Files (x86)\Jenkins\jobs\App Test Cases\workspace>EXIT
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
The java command runs fine outside Jenkins.
I have set the JAVA_HOME for the local user and also the PATH variable to point to where java.exe is.
What am I doing wrong? Please help.
For a windows environment, there is some extra configuration needed for more advanced builds. Ultimately you have two options
From Jenkins, The Definitive Guide:
This basic installation will work fine in a simple context, but you
will often need to fine-tune your service. For example, by default,
the Jenkins service will be running under the local System account.
However, if you are using Maven, Jenkins will need an .m2 directory
and a settings.xml file in the home directory. Similarly, if you
are using Groovy, you might need a .groovy/lib directory. And so on.
To allow this, and to make testing your Jenkins install easier, make
sure you run this service under a real user account with the correct
development environment set up. Alternatively, run the application as the
system user, but use the System Information page in Jenkins to check
the /Users/johnsmart/Projects/Books/jenkins-thedefinitive- guide
directory, and place any files that must be placed in the user home
directory here....
To configure your Jenkins server to run under a service account (The suggested option), Install Jenkins as a service, and under the services properties set the log on user info.

How to open an external executable file using jenkins

How to open an external executable file using jenkins
I tried it in execute window batch command like
cd c:\EMailer\
call testcompete.exe
But it is not working
then i tried
start testcomplete.exe
This testcomplete will run the automated site and write a text file .
It is also not working.Is there any pluggin or method in jenkin to open external executable files?
showing prompt when testcomplete trying to start
Set the Jenkins service to "Allow service to interact with the desktop". This will allow Jenkins to use the desktop as a resource.
You need to install Windows Exe Runner Plugin in Jenkins.
For more information: https://wiki.jenkins.io/display/JENKINS/Windows+Exe+Runner+Plugin

Exec task in msbuild TFS won't execute exe properly

I'm using web deploy to a remote server, through which we can only connect through a Cisco VPN client.
In my TFS project file I have an EXEC task to open the client, then one to close it.
<Exec Command="start $(COMSPEC) /C "C:\Program Files (x86)\Cisco Systems\VPN Client\vpnclient.exe" connect profile user me pwd password" ContinueOnError="false" />
Without these EXEC tasks and if I open the connection manually then the deployment works. But these commands aren't opening the client in the build, it just hangs on this task before opening the client.
If I copy this task and paste into a standard build file and call that from msbuild.exe then the client is opened.
Do you know why it won't work in the TFS project when the build is called but it would work manually in a separate build file?
For kicks I would try using the full path to comspec: "C:\Windows\system32\cmd.exe" or whatever path for the OS you are using in the off-chance it is resolving incorrectly.
Also, can you toss in a /k to keep the cmd prompt open and see what, if any, errors show assuming it launches correctly?
I couldn't work this one out. So I used Invoke Process in the XAML template instead. Which has worked fine.

Resources