Devenv Return code issue

Devenv is the command line utility for Visual studio to build projects and solutions.
Devenv Switches

With MSBuild, there is some compilation order issue for the project order in the solution file.So we need to use devenv when we face the issue.

For Reference: https://github.com/Microsoft/msbuild/issues/421

For Jenkins, or any other CI tool, we don’t have plugin for devenv as there for MSBuild.

So, we need to call this devenv utility internally in any build step of CI tool.

But devenv.com is used generally than devenv.exe for this purpose.Check below link.

Use this link for integrating with Jenkins:

Jenkins and Devenv

So far is going good, but there is one more issue.
With Jenkins Build step, sometimes, devenv.com is also not giving return code correctly, let’s say I build a solution and redirect the output to a log file using below command.

devenv.com /Build "Release|x64" Path_to_Solution_file > "C:\JobStatus\logfile.log"
if %ERRORLEVEL% NEQ 0 goto Failed
GOTO END
:Failed
---some steps
:END
--some steps

It is working fine, but some times it is giving return code as success even the solution fails.

Even the return code doesn’t give correct result, the log file does.

So, I have written an utility which parses the log file and does two things returns 0 for success and 1 for failure.And also generates a False.txt for failure and True.txt for success, this is for second level of checking for convenience.

And below logic is written.We need to input the log file of solution for parsing.


"C:\JobStatus\CheckVSLogs.exe" "C:\JobStatus\logfile.log"
if %ERRORLEVEL% NEQ 0 goto Failed

IF EXIST "C:\JobStatus\False.txt" (
echo "False.txt exists so deleting it"
del "C:\JobStatus\False.txt"
GOTO Failed
) ELSE (
echo "False not exists"
del "C:\JobStatus\True.txt"
)

Download link:  CheckVSLogs Download Link 1 CheckVSLogs Download Link 2

You can reply back if you face any issues with usage of CheckVSLogs, so that I will do the necessary changes in its code.

how to clear jenkins build history

Go to your Jenkins home page → Manage JenkinsScript Console

VqzyG

Run the following script there. Change copy_folder to your project name

def jobName = "copy_folder"
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().each { it.delete() }
job.nextBuildNumber = 1
job.save()

Reference: Stackoverflow

How to fix path not found error in Python Plugin

I have installed below plugin recently for executing python scripts in jenkins.

https://wiki.jenkins.io/display/JENKINS/Python+Plugin

I have configured below location in the “global tool configuration section”

1

But still I am getting error as below.

C:\Program Files (x86)\Jenkins\workspace\testpy>exit 0
[testpy] $ python C:\Windows\TEMP\hudson7024971487055316356.py
The system cannot find the file specified
FATAL: command execution failed

So, I tried to troubleshoot by running another task “windows batch command” and found that path variable is not having the folder of python installation with the echo output.

1

So I restarted the jenkins using the below url.

http://win7_64bit-20:8080/restart

This is used to restart jenkins from web console and it loaded the variables.

Once the jenkins is restarted, it is running my python scripts and showing the python folder in path variable.

So, the final perception I got is, python plugin not able to read the location we kept in the global tool configuration, only it loads from path variable(Only from System Variables,not from User) on the node.And we need to restart Jenkins to load the path variables from the node.

 

Enable or Disable projects in Jenkins

By default, you don’t have any option to enable/disable a job or project in Jenkins.

The default view will be like this.

1

If you observe, there is no disable/enable option.

To make it available, install the Extra Columns Plugin

Then create a new view of type “List View” and select your projects, then click on add column and select the below one.

2

This will give you a button to enable/disable the project in the view created.

2

 

Blog at WordPress.com.

Up ↑