How to trigger maven specific job in Jenkins with Gerrit - maven

I'm currently using Jenkins(1.451) and the Gerrit Trigger(2.3.1) to launch builds from Gerrit in order to verify code.
This is working fine as long as the project in Jenkins is configured as a "Free style" project. However, I'm currently setting up a new build pipeline where I'm using the "Build a maven2/3 project" option in order to take advantage of maven specific properties which I can't get from the "Free style" option. For some reason, Jenkins doesn't seem to trigger builds using this option. Nothing at all happens when I submit code to Gerrit which under normal circumstances should be picked up. I'm actually wondering if the Gerrit trigger is meant to work with Jenkins projects configured as a maven2/3 job or maybe it is the case that I can only use the Free style option in order to do this.ge
Could anyone confirm if this is the case?

Yes this will work. I suspect you might have some authentication issues that causes your jobs not to be triggered.
Check you sshd_log in the gerrit config folder to see if there are any jenkins logins that result in immediate LOGOUT. I my case I forgot to add Stream Events rights to the Non-Interactive Users under All-Projects and this caused some strange behavior.
This was the message I saw 3x per second in my sshd_log:
jenkins a/1000002 gerrit.stream-events 0ms 0ms not-admin
See here for more details

Related

Rest api to get sonarqube info from bamboo build or vice versa

Is there any way I can get any sonarqube api which can provide the build number of bamboo or any bamboo api which can give sonarqube info.This would really help.
I have so far tried both side but i am surprised both the system are quite clueless about each other. Why it is not possible that a build which ran sonarqube as as one of it's job doesn't have any information about that. Also neither in sonar it tell which build has actually triggered that sonar execution
(Not sure I understand what exactly you are looking for, perhaps this ...? )
I don't believe you can relate a specific Activity (SonarQube analysis) to a specific build (Bamboo), just project to job.
You must have SonarQube Server configured in Bamboo
When executing your job, you can add these sonar.links optional parameters to the analysis step:
sonar.links.homepage Project home page.
sonar.links.ci Continuous integration.
and
sonar.links.scm Project source repository.
sonar.links.issue Issue tracker.
Maybe also specify sonar.host.url=$SONAR_HOST_URL (where SONAR_HOST_URL is the global setting in Bamboo) in the analysis step parameters.
Those populate the Project Overview page sidebar:
That should provide the links from SonarQube back to the other systems of interest.
If you have properly configured Bamboo, you should see a link in Bamboo to the SonarQube project, post execution.

How can I configure the Bluemix Pipeline to either tag builds or create a work item (defect) according to the state of the build?

I have a Build & Deploy Pipeline in Bluemix, I would like to create a condition where, if the build fails, it will automatically assign a defect (i.e., work item in the "Track & Plan" page) to whoever delivered the very latest change (or just assign to the main owner of the App/Project), also, if the build is completed successfully, I would like to tag it.
Tagging is ok, that's general GIT knowledge, I just wanted to solve 2 Problems with that plan:
How do we trigger a specific subsequent Stage in the pipeline if the current build fails/passes?
How do I create a work item from the pipeline? Do I need to create a separate GIT repo and build some sort of API package that allows me to invoke a mechanism that creates the ticket?
I guess I'm going too maverick with this Pipeline, please share your thoughts.
As of right now you can not create a work item from the pipeline. That is a great feature improvement and I can take it back to the team.
For your question about triggering a stage if something passes or fails... The way it works now only the next stage will be triggered if the previous is successful. The pipeline is based on Jenkins and Jenkins doesn't allow you to trigger a specific job if a job passes or fails. You would want to detect the pass or fail in your stage and do your logic based on that.

Jenkins does not show some builds log and failed builds in history

We have updated our Jenkins CI tool to updated version number is: 1.596.1. The problem is, for some projects, we cannot see the build console log. When we try to see the log, Jenkins responds with 404 error page.
Also, when this problem occurs in a particular job, we have examined that, failed builds are not be shown in the build history list in the job page. Even though we see that there is build from the gerrit history, when I click on the job with the specified ID, I again get the 404 error.
We are using Jenkins with Git/Gerrit, and most builds are triggered from the Gerrit review system.
New information: Jobs that have this problem have also the inconsistent timestamp problem.
It seems that this problem also occurs when Jenkins job is triggered by a patchset creation/merge in Gerrit review system.
What may be the root cause for this problem? Is it the version we're using or some other factor?
This is a persistent problem with Jenkins. A restart, which you can do from the front page when you're authenticated, is the fix. Visit
https://yoursite/jenkins/quietDown
to restart the instance.

Making gitolite trigger teamcity builds

Rather than having teamcity log onto the gitolite server several tens of thousands of times each day - and also sitting around waiting for the poll to happen (or starting it manually).
It would be nice if it was possible to set it up gitolite hooks that inform TeamCity that the repository has changed.
Is such a configuration possible with TeamCity and gitolite?
I know Jenkins has a github plugin that works nicely - I use that setup for some Minecraft CI I am running privately.
One way would be to gitolite (through a VREF hook) to call TeamCity through its REST API, in order to launch a build through web request.
You just need to make web request to the following URL:
http://YOURSERVER/httpAuth/action.html?add2Queue=btId
, where btId is build type Id – unique identifier for each build configuration.
To get it, you can just look for it in browser address bar, when clicking on build configuration, or use TeamCity REST API for details.
The OP Morten Nilsen didn't need a VREF:
add a file "post-receive" to .gitolite/hooks/common and
run gitolite setup --hooks-only

Hudson build on URL token

I configured a hudson instance and have created jobs. While creating builds, I was able to see this option "Trigger the build by accessing this URL + SecretTOKEN" option. Now, I am unable to see that for any new jobs I create. Am I missing some setting or a configuration? The only change I made was running the servlet container from Root to a regular user.
In my Hudson (1.349) when creating a new job, there's an option under Build Triggers called Trigger Builds Remotely (e.g. from scripts), which when selected allows you to enter an Authentication Token (which has the descriptive text from your question).
I'm not aware of any system configuration that disables this. It doesn't sound like a Hudson user permissions problem if you can have permissions to create/edit jobs.
What appears under Build Triggers when you create a new job?
I had the same problem with the missing Trigger Builds Remotely option. The fix in my case was to enable security in the main Hudson configuration (with Anyone can do anything selected)

Resources