Jenkins is not able to recognize xmlstarlet in my shell script - jenkins

I have Jenkins running on my local Windows 7 machine. I am trying to use Jenkins for Salesforce deployment and have added a shell script to parse package.xml. My script uses xmlstarlet to do the parsing, but when I build the project I am getting the following error:
./modifyPackage.bash: line 9: xml: command not found
./modifyPackage.bash: line 24: unexpected EOF while looking for matching `"'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I am using the git sh.exe to execute the shell script, so I have added the below path in Shell executable.
C:\Program Files\Git\bin\sh.exe
Looks to me that Jenkins is not able to recognize the xml starlet used in shell script. I also tried adding xmlstarlet-1.6 exe file in the GIT directory, but it didn't work. How should I fix this?
Regards

Found out the problem. I needed to add the path of xml starlet as a PATH environment variable in Manage Jenkins -> Configure System -> Global Properties with key as PATH and value as $PATH:$Actual Path of xml starlet.

Related

issue in jenkins integration with git

i installed jenkins in c:\program files(x86)\jenkins and am trying to integrate with a helloworld java file. but when i first tried to build from jenkins, itself, its failed.
i went through this link : https://www.youtube.com/watch?v=bGqS0f4Utn4
when i compiled my java file, from the admin cmd prompt, its compiles successfully. but it failed within the jenkins console.
I created a C:\workspace folder and saved the java file, there.
what am doing wrong ? why am getting the wrong path within the console output?
am getting the below error in the console output :
`Console Output
Started by user user1
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\workspace\
HelloWorld
[HelloWorld] $ cmd /c call C:\Windows\TEMP\jenkins6223662388306682118.bat
C:\Program Files (x86)\Jenkins\workspace\HelloWorld>cd C:\Workspace
C:\Workspace>javac Hello.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace>java Hello
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace>exit 9009
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
First, since you've installed JDK, make sure you've added in system level environment variable
Set JDK bin path in Jenkins > manage jenkins > global tools configurations > jdk installations, then try
mostly this option would help to resolve

Jenkins couldn't recognize Python run from .BAT file

I'm a beginner to Jenkins, and trying to run a small Python code from Jenkins batch command for Windows.
However, the build run throws below error:
Running as SYSTEM
Building in workspace C:\Program Files (x86)\Jenkins\workspace\PythonProject1
[PythonProject1] $ cmd /c call C:\Windows\TEMP\jenkins7865401366299588301.bat
C:\Program Files (x86)\Jenkins\workspace\PythonProject1>cd C:\Users\Ben\Desktop\py
C:\Users\Ben\Desktop\py>python C:\Users\Ben\Desktop\py\for.py
'python' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Ben\Desktop\py>exit 9009
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Python is installed in my machine and is declared in Environment Variable too. What am I missing?
"Running as SYSTEM" means the Jenkins service is not running with your account, but the Windows system account, used as a service account.
That means you need to add python path to the system environment variables, not the user ones.

How to resolve grunt not recognizable error on jenkins whereas Grunt is running in command prompt?

How to resolve grunt not recognizable error on jenkins whereas Grunt is running in command prompt?
Jenkins output:
test cases will be executed
'grunt' is not recognized as an internal or external command, operable program or batch file.
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Most probably if the grunt-cli package is installed globally, you do not have the executable path added to system's PATH variable.
Or in the case when you do not have the package installed, npm install -g grunt-cli in windows shell.
Issue was related to path,basically my user's path variable had npm and grunt paths but was missing from system path variable.So i added npm path to system path variable and it worked for jenkins!
In my case the path was defined correctly. It worked when I execute it on CMD, but not from Jenkins. Turns out it was due to Jenkins using its own managed path, as defined in Manage Jenkins -> Configure System -> Global Properties.
Define Environment variable named "Path" there, and add the location of your npm directory to it, such as: "C:\Users\your-user-name\AppData\Roaming\npm;"

Jenkins can't find make.exe

I'm trying to install jenkins on windows and I have Cygwin.
I provided the bash.exe path to jenkins and add a job which executes a .sh file.
The output is like:
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Build_Release
[Build_Release] $ C:\cygwin64\bin\bash.exe -xe C:\WINDOWS\TEMP\jenkins8276366787192439492.sh
+ cd /cygdrive/d/01-Avelabs/001-Projects/001-VGTT/001-Repos/P2.4.0.5/host/AdasHost/Application/
+ ./BuildHost.sh
./BuildHost.sh: line 2: make: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
What am I missing?
To get you going (the problem is not obvious but it should be easy enough to debug): Add a "set" command at the top of the script to dump the environment variables, including the PATH. You will very likely find that PATH is not in any of the folders listed in the value of the PATH env var. (You could also put simply, "echo $PATH".)
Some possibilities:
When I start bash in Windows I typically inherit the Windows path, but not the Linux path: /cygdrive/c/windows/system32 is included, but /bin is not. So, even basic Linux commands like "ls" result in "command not found" errors. I'll typically start a bash session with "export PATH=/bin:$PATH" to get around this.
Even if you initialize the path with a .bash_profile script, the user under which Jenkins is executing is probably not executing the same initialization script.
Finally - and not meaning to say "Is it plugged in? - but: I ran a clean Cygwin install and did not get make by default. So be sure it is included in /your/ installation!

configure Valgrind plugin in Jenkins

I have installed valgrind plugin in Jenkins.
I just want to trigger my binary(of a simple C program ) with valgrind trough jenkins(valgrind plugin)
Under Build->Run Valgrind Options
I have given Working Directory as directory of my executable.
executable Include pattern as quick* (quick is my executable name)
When I run the build the following is the console output.
Building in workspace /home/iptv/.jenkins/jobs/testVal/workspace
[VAlgrind] Error, java.lang.NullPointerException: null
Build step 'Run Valgring' marked build as failure
Finished: Failure
Is ther some where we need to declare environment variables ${PROGRAM_NAME} and ${PROGRAM_DIR}
Am I missing something to configure.
Thanks in advance.

Resources