jenkins debugging with eclipse - jenkins

I have built a new "Hello World" plugin for Jenkins and I was able to upload it onto Jenkins and it works successfully. I am now trying to make change to the plugin and debug it on Jenkins. I did this according to the instructions on this tutorial https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial
I tried this command:
mvnDebug hpi:run
and then start to debug from eclipse to the port 8000 which is the port that Jenkins opens up for debugging. The eclipse was able to connect to the correct port and I got the message which seems to be correct:
[info] Jenkins is fully up and running
It seems that everything went OK. Then I go to localhost:8080 to see the plugin but I found nothing there. Can anybody help me with this, please? Thanks.

Ok, about debugging Jenkins plugins, I know that there is a little amount of information. I can tell you how I debug:
Using the tutorial from https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial#Plugintutorial-DebuggingaPlugin
1. stop jenkins service
2. from cmd I run
set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n
and
mvn hpi:run
Note: Build automatically must be unchecked in Eclipse. And after I run mvn hpi:run I try to connect Eclipse to the port using java remote ( or something like this).
The second method that I use is:
1. I installed maven plugin in eclipse
2. Create a run configuration as maven in eclipse
3. Stop jenkins server
4. Run the configuration
5. Access localhost:8080/jenkins
Sorry for not giving the exact steps but I have those configurations on my PC at work...
Also, in my opinion the second method is more stable. I use it frequently when I work with my plugin...

Related

How to run Robot Framework/Sikuli test cases with Jenkins?

I am trying to run some automated tests for desktop apps. The code is written in Robot Framework and Sikuli. If I run them from command line, it is okay, but when I try it from Jenkins it is not.
Here is how I try to build in Jenkins
Here is the simple code:
Help
[Tags] help
Capture Screen
Click input_id
This is the result:
As you see it could not see my screen. What should I do to let the "Jenkins process" see my screen?
The issue was, that I installed Jenkins as a Windows service. After I installed via the jenkins.war file, it works.

Unable to run java file in GITHUB using jenkins

I am new to Jenkins and GITHUB.I have configured Jenkins with GITHUB and I don't see any issues with configuration.
I am running the file using windows batch
My commands are -
javac HelloJenkins.java
java HelloJenkins
Can someone tell me where am I going wrong?
enter image description here

sonar-scanner-2.9.0.670 throws java.lang.ExceptionInInitializerError inside docker container

In this build inside docker (on travis-ci), sonar-scanner-2.9.0.670 throws a java.lang.ExceptionInInitializerError:
ERROR: Error during SonarQube Scanner execution
java.lang.ExceptionInInitializerError
at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:166)enter code here
Build log here (see line 4660):
https://travis-ci.org/laristra/flecsi/jobs/213157927#L4660
Sonarqube got put into a ubuntu:latest container here:
https://github.com/laristra/flecsi-buildenv/blob/sonarqube/ubuntu#L14
You are working on a C++ project: https://github.com/laristra/flecsi.
You are building it with Travis-CI.
You want to analyze it on SonarQube.com.
You don't need to download any SonarQube Scanner nor set up any SonarQube inside a Docker.
Please:
follow the Get Started guide
, and look at the sample C/C++ project to understand how to trigger a SonarQube analysis using our Travis Addon
It automatically downloads and installs the SonarQube Scanner
It automatically downloads and installs the C/C++ Build Wrapper
It automatically configure everything to point to SonarQube.com
It turned out the problem was Oracle's JDK using openjdk-8-jdk fixed the issue (inside docker).

How to debug the Jenkins plugin

I have built a new "Hello World" plugin for Jenkins and I was able to upload it onto Jenkins and it works successfully. I am now trying to make change to the plugin and debug it on Jenkins.
Note:
My Jenkins is deployed in my local tomcat, i build the hpi file and copy it to jenkins plugins folder, it works.
Now i want to ask how can i debug my plugin code? Suggestions with any IDE is welcome.
I also have questions about:
do i need to create a project for jenkins source in my IDE and develop my plugin base on it?
Currently i only create a project for the plugin, build a hpi file and put it to Jenkins.
I am not sure if this step is correct.
Thanks in advance!
I imagine you ran
mvn package
to create your package
To debug you can do
mvnDebug hpi:run
and this will copy all the dependencies down (rather than in your jenkins install) and run it in place
If you are using an IDE then this can be done from within it.
More help can be found in the plugin tutorial
Follow the tutorial to set MAVEN_OPTS, and using IntelliJ to add a Jetty Server to point the port to it.
execute from cmd:
mvn clean
set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n
mvn hpi:run
add a debug local Jetty Server from intelliJ and point it to port 8000 (port number is specified in above cmd)
In case of IntelliJ IDEA the easiest way is to use maven's Run/Debug configuration.
Just add hpi:run in "Command line" filed and start Debug as usual.
When the console says that your "Jenkins is fully up and running", open a browser and go to http://localhost:8080/jenkins/ and your code will stopped at break point (if any).

MSBuild - Jenkins - Nuget integration

We are experiencing some weird behavior using Jenkins and MSBuild.
When manually typing into a command line to build a build.xml project:
msbuild build.xml /T:Package /P:PublishProfile=Test /P:Platform="AnyCPU"
/P:VisualStudioVersion=12.0
The build process works exactly as expected (build, packaging, etc.)
However, if I am using Jenkins to do exactly this - that is - open a command line and run this exact command, I get an error saying:
The command ""..\.nuget\NuGet.exe" install
"C:\Jenkins\jobs\.....\workspace\MYPROJECT\packages.config"
-source "" -NonInteractive -RequireConsent -solutionDir "..\ "" exited with code 1
Even if I am using the built-in jenkins plugin to run the command (regardless which parma combination I use), it still doesn't.
I know two of the following sounds like a solution, but they don't work:
Permissions! - My server always runs as admin.
Enabling package restoring on NuGet from VS - Already did!
Any idea will be great!!!
Here is the answer, it took a long time to solve, and thanks to #adarshr I came to realize the problem is because of the difference between the Jenkins runner's user (i.e the jenkins Service) and my user. To resolve this issue I've made Jenkins running as the same user and all good!
Step by step:
Go to Control Panel -> System and Security -> Administrative Tools
Click on the Services shortcut.
Right click on the Jenkins service and select Properties.
Navigate to the Log On tab.
Click on run as this user and fill in your credentials.
Restart Jenkins.
Works like a charm!

Resources