Re connect SonarQube with Jenkins - jenkins

I have the next problem. We have the lastest LTS versions from Sonarqube and Jenkins. Both are connect and run without problem.
Now we want to change Sonarqube host. For example:
Before:
http://our-url:9000/sonar
Now:
http://our-url:9000
We clone the server to test if all works fine or not. Change URL from Sonarqube inside Jenkins and run a test project and everything is fine but when we wanna see the existing projects they are not linked to Sonarqube. Thats the problem.
Somebody knows how re connect that project again? Without run another test? Well, if it's possible.
Thanks.

I suggest you to create a webhook on sonar-side:
https://<your Jenkins instance>/sonarqube-webhook/
If you use pipeline you can find useful info at: https://blog.sonarsource.com/breaking-the-sonarqube-analysis-with-jenkins-pipelines/

If someone have this weird and unusual problem, you can solved it if you go to Jenkins folder > Jobs > Your Job > build > # of the builds (need to edit all) > Edit the text file. Then search the sonarqube URL and edit it.
Cheers!!

Related

run sonarQube via jenkins Task 'my-task' does not exist. Please use 'list' task to see all available tasks

I've got a server in work which has sonarQube, Gitlab and jenkins running side by side with Maven also on the box. I have also a project on this box i wish to test with sonarqube (located on this same box in /home/{user}/live/{sitename}/htdocs). I created a job in sonarqube, the only options i had where to call it something and I've no idea how this links to the actual project or where it is expecting to find the project to scan. in jenkins I added build step for sonarqube, again no option on where to find the code. i ran it anyway and to no surprise it failed asking me to use list to see all available, not being funny but where do i do this?
So I have 2 questions really:
where is sonarQube looking for this code, i presume symbolic links are good in this location to the actual code right?
where do i find and use this list command? is this in jenkins or sonarqube?
sonarqube jankins and gitlab are all accessible on our intranet with different default ports (8080, 8008 and 9000) i have the sonarqube scanner plugin on jenkins and it is using maven? Does anyone know of any good tutorials to setup this kind of scenario?
thanks
Craig
Configure your current Job and set below.
Under Build->Execute SonarQube Scanner
Task to run : leave it blank
Path to project properties: Specify your sonar project properties file
path
Before doing above changes make sure that below configurations are set
Jenkins->Manage Jenkins->Sonar Servers
Name:Sonarqube
Server URL: http://localhost:9000/sonarqube
Server authentication token: Generate in SonarQube in specify here
Jenkins->Manage Jenkins->Global Tool Configuration->SonarQube Scanner
SonarQube Scanner installations:
Name: SonarScanner
Install automatically: Tick checkbox
Install from Maven Center: Choose compatible SonarScanner version
I was able to get this working in the end but after upgrading sonarqube we decided to use the new pipelines feature, this took a while to configure but we are now able to do code analysis on our builds, see this link for details

Jenkins plugin not showing up

probably a newbish question, but that's what I am. I need to run a post build script, so I installed the post-build-task plugin onto my Jenkins server (v2.5). For some reason, when I go to the job configuration page, there is no checkbox or anything for the plugin. Is there some common pitfall I am stepping into or something?
Edit: I have restarted the server.
So it was a blatantly simple issue. The job I was working in was a pipeline, and it needed to be a freestyle project.
Restarting will update the plugins..

Jenkins Crashes after installing GitHub Plugin

I have a question about updating GitHub plugin.
Everytime I do an update plugin such as GitHub and restart the jenkins, Jenkins start crashing. when I try to access jenkins through URL in my browser, the error page shows up with some exception "class not found jenkins/model jenkins" . and then in order to make jenkins working again , I have to delete the plugin entirely from the plugins directory. I wish someone has an answer for this because I really need to make my github projects available to jenkins for build. Thanks
It is a very usual problem with Jenkins. My workaround was to either update the jenkins (where ever it is installed) and restarting the hudson service.
sometimes even restarting the service works.
often you might need to remove those plugins from within (/var/lib/hudson/plugins/) and restart the service.

Jenkins - Not Showing Build History

I have a multi-module maven project that I'm building with Jenkins called MyApp. I also have another maven project that depends on MyApp, and this project runs integration tests on MyApp.
In Jenkins, when I view the status of the MyApp project it successfully displays a list of previously run builds and I can click on them to find out more information (and view the console output).
However, the integration test project, while it does build properly, it only displays previously run builds for about 5 minutes, at which point something happens and jenkins completely forgets the build ever ran.
On the filesystem, I am able to cd to:
/usr/share/tomcat6/.jenkins/jobs/My App Integration Test/builds
and ls reveals
me#myserver:/usr/share/tomcat6/.jenkins/jobs/My App Integration Test/builds$ ls
1 2 2013-01-24_16-46-59 2013-01-24_16-51-58 2013-01-24_18-05-09 2013-01-24_18-58-46 3 4
that all my previously run builds are right there, where they should be.
Jenkins has a "discard old builds" feature in its project configuration page, but I obviously have it unchecked.
I'm running jenkins in tomcat6 on Ubuntu.
Help please?
Jenkins has resolved this issue as of 1.505 I recommend everyone upgrade who does not wish to switch from Jenkins back to Hudson.
This can be done through the GUI via Manage Jenkins->Upgrade to Latest (Note for this to work you need to have the appropriate permissions for Jenkins)
More information can be found here For linux users aptitude update or yum update jenkins should also work for you.
I have jenkins running with 1.517, still facing the issue if the number of builds goes more than 65 without discard option. Found that reload configuration bring back the build history.
I've seen this issue and have always been able to resolve it by following these steps:
Going to \\[buildmachine]\C$\Jenkins\jobs\[jobname]
Removing the builds folder.
Removing shortcuts to lastStable and lastSuccessful.
Open file nextBuildNumber and change the number to 1.
Then build new jobs and they no longer disappear.
As mentioned by Dave Bacher, this appears to be a bug in Jenkins. I switched over to Hudson and problem fixed!

Jenkins Post build deploy

I am using Jenkins CI in my project, I am able to successfully build the project and I have no issues in deploying it in the container after every successful build. Now I have a condition that the deployment to the container has to happen only if there is a change in the release properties file. If there is no change in the release properties file then the project has to be built but no deployment should happen.
Since I am new to Jenkins I am trying out all the options, I am sure that someone must have been in the similar situation, please share your thoughts or ideas. Incase if I find something I will post it.
Highly Appreciate your help on this.
If this is still not answered!!
This can we easily done using Script Trigger plugin.
This allows you to run a shell/batch script and based on the exit code of this script the build will be executed.
You can keep track of the last modified date of the properties file and if it changed then you can go ahead and build, if not there will not be any build until the change happens.
Hope this helps (if at all required now ;)
You should install the "Post-Build Script Plug-in" in your Jenkins. The previous answer was mentioning a plugin that is no longer available.
Then you can add sub build steps, like executing a shell script
script
You can also publish a Docker container, etc.

Resources