Giter VIP home page Giter VIP logo

jenkins-gitlab-merge-request-builder-plugin's Introduction

GitLab Merge Request Builder Plugin

A plugin that allows Jenkins to build merge requests.

This plugin fetches the source and target branches of a GitLab merge request and makes them available to your build via build parameters. Once the build completes, Jenkins will leave a comment on the merge request indicating whether the merge request was successful.

Supported GitLab Versions

  • GitLab version < 8.1: use v1.2.4 of this plugin
  • GitLab version >= 8.1 < 11: use v2.0.1 of this plugin
  • GitLab version >= 11: use the latest version of this plugin

Prerequisites

  • Whilst there is no explicit dependency on the Git plugin, it's strongly recommended that you install it since Jenkins will be unable to fetch the source code for your project.

Installation

  • Ensure that a Jenkins user exists within GitLab and has access to the repository.
    • For GitLab version < 8.4.X: ensure that the user has Reporter level access to the project.
    • For GitLab version >= 8.4.X: ensure that the user has Developer level access to the project.
    • Please note that if you would like to use the Auto-merge feature Jenkins needs to have Developer access to the project.
  • Install the plugin in Jenkins.
    • The plugin is hosted on the Jenkins Plugin repository
    • Go to Jenkins -> Manage Plugins -> Available
    • Search for GitLab Merge Request Builder
    • And install it
    • Ensure you restart Jenkins
  • Go to Manage Jenkins -> Configure System -> GitLab Merge Request Builder
  • Set the GitLab Host URL to the base URL of your GitLab server
  • Set your Jenkins Username for the Jenkins user (defaults to jenkins)
  • Set your Jenkins API Token for the Jenkins user. This can be found by logging into GitLab as Jenkins and going to the user profile section.
  • Set/change any of the other available parameters as necessary. If you host GitLab over an SSL connection you may want to enable ignoring certificate errors.
  • Save to preserve your changes.
  • Go to Manage Jenkins -> Configure Global Security and set Markup Formatter to Safe HTML. It will make Jenkins display links in build history properly.

Webhooks

  • Set GitLab webhooks to use {server}/gitlab-webhook/start
  • Ensure 'Merge Request' checkbox is ticked

Creating a Job

  • Create a new job by going to New Job
  • Set the Project Name
  • Feel free to specify the GitHub Project URL as the URL for the GitLab project (if you have the GitHub plugin installed)
  • In the Source Code Management section:
    • Click Git and enter your Repository URL and in Advanced set its Name to origin
    • For merge requests from forked repositories add another repository with Repository URL ${gitlabSourceRepository} and in Advanced set Name to ${gitlabSourceName}
    • In Branch Specifier enter refs/remotes/origin/${gitlabSourceBranch} or for merge requests from forked repositories enter ${gitlabSourceName}/${gitlabSourceBranch}
    • In the Additional Behaviours section:
      • Click the Add drop down button and the Merge before build item
      • Specify the name of the repository as origin (if origin corresponds to GitLab) and enter the Branch to merge to as ${gitlabTargetBranch}
      • Ensure Prune stale remote-tracking branches is not added
  • In the Build Triggers section:
    • Check the GitLab Merge Requests Builder
    • Enter the GitLab Project Path, this might be something like your_group/your_project for GitLab URL http://git.tld/your_group/your_project
    • The Target Branch Regex may be configured to whitelist this job for certain target branches. If left empty, every valid merge request for the configured project path will trigger this job.
    • The Use HTTP(S) URL checkbox should be used if you want Jenkins to clone/fetch using HTTP(S) instead of SSH.
  • Configure any other pre build, build or post build actions as necessary
  • Save to preserve your changes

Default Filters

  • Assignee Filter is defaulted to 'jenkins' only MRs that have been assigned to a 'jenkins' user will auto-start
  • Label Filter is defaulted to 'Build' only MRs that have been given the label 'Build' will auto-start

Changing any of the filters to an empty string will remove the filters

Manual Triggers

You can trigger a job a manually by clicking This build is parameterized and adding the relevant build parameters. These include:

  • gitlabSourceRepository (for MRs from forked repos)
  • gitlabSourceName (for MRs from forked repos)
  • gitlabSourceBranch
  • gitlabTargetBranch
  • gitlabMergeRequestId

Note: a manually triggered build will not add build triggered/succeeded/failed comments to the merge request. Note: You should ensure that the 'Global Config user.name Value' and 'Global Config user.email Value' are both set for your git plugin. In some cases, you will get an error indicating that a branch cannot be merged if these are not set.

Environment variables

The plugin will contribute some environment variables to the build.

  • gitlabMergeRequestId
  • gitlabMergeRequestIid
  • gitlabSourceName
  • gitlabSourceRepository
  • gitlabSourceBranch
  • gitlabTargetBranch
  • gitlabTitle
  • gitlabDescription
  • gitlabSourceProjectId
  • gitlabTargetProjectId
  • gitlabLastCommitId

Contributing

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2013 Tim Olshansky. See LICENSE for further details.

jenkins-gitlab-merge-request-builder-plugin's People

Contributors

abhirao avatar ajohnson-ventera avatar andreagiardini avatar andrew8xx8 avatar arjenw avatar arkady-emelyanov avatar bigmichi1 avatar brugidou avatar d4nj1 avatar dem-devops-ci avatar feiyuw avatar hrubi avatar johnktims avatar jwg4 avatar kamaradclimber avatar kamazee avatar kryger avatar kumarnitin avatar matthewoconnell avatar mc1arke avatar mjdetullio avatar mouseratti avatar nblair avatar paravibe avatar runsisi avatar svijee avatar tejaycar avatar timols avatar tomasbjerre avatar vbyjsue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jenkins-gitlab-merge-request-builder-plugin's Issues

Trigger build if target branch changed

I think it could be a good idea to trigger build if target MR branch changed to ensure that other merges weren't created regression while MR is considered by the team.

Currently builds triggered only if source branch changed.

Cron expression usage

I was wondering what was the usage of the cron expression. I tend to use Gitlab Hook plugin to build code as soon as possible without scanning git repositories.
With this process I think it's possible to get rid of cron. Anyone to comment ?

Builds disappear when gitlab is down due to NPE

The builder seems to throw an NPE which makes Jenkins hide the builds from the build list.

WARNING: Caught exception evaluating: it.getTestResultPath(testObject) in /job/na0_newaer-ng-server_gitlab_merge_request/34/. Reason: java.lang.NullPointerException
java.lang.NullPointerException
    at java.lang.StringBuilder.<init>(StringBuilder.java:92)
    at hudson.tasks.junit.CaseResult.getSafeName(CaseResult.java:254)
    at hudson.tasks.test.TestObject.getRelativePathFrom(TestObject.java:146)
    at hudson.tasks.test.AbstractTestResultAction.getTestResultPath(AbstractTestResultAction.java:224)
    at sun.reflect.GeneratedMethodAccessor335.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:258)
    at org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:104)
    at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
    at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
    at org.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
    at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
    at hudson.ExpressionFactory2$JexlExpression.evaluate(ExpressionFactory2.java:74)
    at org.apache.commons.jelly.expression.ExpressionSupport.evaluateRecurse(ExpressionSupport.java:61)
    at org.apache.commons.jelly.expression.ExpressionSupport.evaluateAsString(ExpressionSupport.java:46)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.buildAttributes(ReallyStaticTagLibrary.java:111)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:95)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
    at org.apache.commons.jelly.tags.core.WhileTag.doTag(WhileTag.java:62)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:98)
    at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
    at org.apache.commons.jelly.tags.core.OtherwiseTag.doTag(OtherwiseTag.java:41)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
    at org.apache.commons.jelly.tags.core.ChooseTag.doTag(ChooseTag.java:38)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
    at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
    at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:81)
    at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:146)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
    at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:150)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:98)
    at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
    at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:98)
    at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
    at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
    at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:81)
    at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:63)
    at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:53)
    at org.kohsuke.stapler.jelly.JellyClassTearOff.serveIndexJelly(JellyClassTearOff.java:112)
    at org.kohsuke.stapler.jelly.JellyFacet.handleIndexRequest(JellyFacet.java:127)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:666)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
    at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:384)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:583)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:214)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
    at winstone.ServletConfiguration.execute(ServletConfiguration.java:248)
    at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:376)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ApiTokenFilter.doFilter(ApiTokenFilter.java:64)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:50)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at winstone.RequestDispatcher.forward(RequestDispatcher.java:331)
    at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:227)
    at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)

Deleted project is causing warning generation each time the trigger is invoked

Definitely minor thing

Feb 18, 2014 9:34:07 PM hudson.triggers.Trigger checkTriggers
WARNING: org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run() failed for build_transition_merge_request
java.lang.Error: java.io.FileNotFoundException: http://....../api/v3/projects/2/merge_requests?private_token=.....
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:195)
    at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:150)
    at org.gitlab.api.GitlabAPI.getAllMergeRequests(GitlabAPI.java:131)
    at org.gitlab.api.GitlabAPI.getOpenMergeRequests(GitlabAPI.java:103)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:56)
    at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.run(GitlabMergeRequestBuilder.java:27)
    at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run(GitlabBuildTrigger.java:98)
    at hudson.triggers.Trigger.checkTriggers(Trigger.java:257)
    at hudson.triggers.Trigger$Cron.doRun(Trigger.java:205)
    at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.FileNotFoundException: http://...../api/v3/projects/2/merge_requests?private_token=....
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624)
    at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:260)
    at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:31)
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:188)
    ... 16 more

Error after saving configuration changes in 1.2.2

After saving changes to the configuration of a job that's building merge requests, I get an error with the following stack trace:

javax.servlet.ServletException: java.lang.Error: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@6d65d1c; line: 1, column: 2]
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:778)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:248)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:631)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:225)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ApiTokenFilter.doFilter(ApiTokenFilter.java:74)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:370)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.Error: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@6d65d1c; line: 1, column: 2]
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:218)
    at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:174)
    at org.gitlab.api.http.GitlabHTTPRequestor.getAll(GitlabHTTPRequestor.java:143)
    at org.gitlab.api.GitlabAPI.getProjects(GitlabAPI.java:168)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.getProjectForPath(GitlabRepository.java:98)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.checkState(GitlabRepository.java:39)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.init(GitlabRepository.java:30)
    at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.build(GitlabMergeRequestBuilder.java:52)
    at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:44)
    at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:27)
    at hudson.model.AbstractProject.submit(AbstractProject.java:1837)
    at hudson.model.Project.submit(Project.java:203)
    at hudson.model.Job.doConfigSubmit(Job.java:1154)
    at hudson.model.AbstractProject.doConfigSubmit(AbstractProject.java:773)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:120)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)
    ... 63 more
Caused by: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@6d65d1c; line: 1, column: 2]
    at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442)
    at org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:1198)
    at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:485)
    at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2770)
    at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2718)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)
    at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:287)
    at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:39)
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:211)
    ... 86 more

This only happens for jobs building from GitLab merge requests. Other build jobs are fine. I'm using Jenkins 1.567 and GitLab Merge Request Builder 1.2.2.

CRON Validation Error

Jenkins: 1.558
About Gitlab Merge Request Builder 1.2.0

When I configure this plugin I get the text "ERROR" below the crontab line.

the input is

*/5 * * * *

When I click on the "ERROR" link it expands to say:

javax.servlet.ServletException: java.lang.NoSuchMethodError: hudson.triggers.TimerTrigger$DescriptorImpl.doCheckSpec(Ljava/lang/String;)Lhudson/util/FormValidation;
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:778)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:248)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:248)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:631)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:225)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ApiTokenFilter.doFilter(ApiTokenFilter.java:74)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:370)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:701)
Caused by: java.lang.NoSuchMethodError: hudson.triggers.TimerTrigger$DescriptorImpl.doCheckSpec(Ljava/lang/String;)Lhudson/util/FormValidation;
    at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger$GitlabBuildTriggerDescriptor.doCheckCron(GitlabBuildTrigger.java:183)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:120)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)
    ... 67 more

NPE in trigger on first merge request

org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run() failed for gitlab-test
java.lang.NullPointerException
    at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.latestCommitIsNotReached(GitlabMergeRequestWrapper.java:101)
    at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.check(GitlabMergeRequestWrapper.java:86)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:83)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:65)
    at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.run(GitlabMergeRequestBuilder.java:27)
    at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run(GitlabBuildTrigger.java:101)
    at hudson.triggers.Trigger.checkTriggers(Trigger.java:255)
    at hudson.triggers.Trigger$Cron.doRun(Trigger.java:203)
    at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

build failed: could not find artifact org.gitlab:java-gitlab-api:jar:1.1.1

Build result:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19:48.881s
[INFO] Finished at: Wed Jul 31 08:54:52 CST 2013
[INFO] Final Memory: 12M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project gitlab-merge-request-jenkins: Could not resolve dependencies for project com.switchfly:gitlab-merge-request-jenkins:hpi:1.1.2-SNAPSHOT: Could not find artifact org.gitlab:java-gitlab-api:jar:1.1.1 in repo.jenkins-ci.org (http://repo.jenkins-ci.org/public/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Automatically merge if build successful and assigned to jenkins user

When I code review an issue I would like to forfeit my responsibility of performing the actual merge and checking the build. I am interested in seeing if code matches our existing conventions, that there is adequate test coverage and the implementations address the requirements. When I have completed the review I would like to assign the issue to the jenkins user.

The gitlab merge request plugin will find and build open merge requests assigned to the jenkins gitlab user. When a build is successful the jenkins user will automatically accept the merge request.

Can not parse merge request

The plugin seems to have picked up all the old merge requests, even though they were closed and the branches removed....it correctly added comments to the merge requests "starting build" and "build failed". It went through 20-30 such merge requests, but then it seems to have got stuck at one and doesn't seem to be going past that.

Exception in Jenkins log says :

May 30, 2013 7:30:35 PM org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper getLatestCommit
SEVERE: Merge Request without commits.

I tried creating new merge requests where the branches have not been deleted and the merge requests are valid and open but they don't seem to be picked up.

Alias jobs that are reused

I have a parametrized job that runs a selenium automation tests. The job takes in a build parameter 'BROWSER' specifying which browser to automate.

e.g.

build('Builder')
parallel([
    {build('Browser-Automation',BROWSER:'Chrome')},
    {build('Browser-Automation',BROWSER:'FireFox')},
    {build('Browser-Automation',BROWSER:'InternetExplorer')}
])

The 'Build Graph' will squash this job into one node.

[Builder] -> [Browser-Automation]

I would like to alias jobs to make more sense of the graph.

e.g.

build('Builder')
parallel([
    {build('Browser-Automation',BROWSER:'Chrome',ALIAS:'Chrome Automation')},
    {build('Browser-Automation',BROWSER:'FireFox',ALIAS:'FireFox Automation')},
    {build('Browser-Automation',BROWSER:'InternetExplorer',ALIAS:'IE Automation')}
])

resulting in a graph

[Builder] -> [Chrome Automation]
              -> [FireFox Automation]
              -> [IE Automation]

Temporary/merge-request project version + dependent projects

I'm suing simple trick to have temp projects version which will not intercept another set of builds.

projectVersion=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[') 

mvn versions:set -DnewVersion=${projectVersion}#${gitlabSourceBranch}"-"${gitlabTargetBranch}

Additionally I have two dependant projects so I'm reusing this temp version to set up dependencies on second project.

What do you think about addressing this in plugin somehow?

Additional builds triggered for commit even if current commit is building

Basically, there is a race condition between your job's build time and the merge request builder cron setting. The race causes the same commit hash to be built twice or even several times.

Setup:

  • Jenkins job that takes more than "X" minutes to build (i.e. 5 minutes)
  • Gitlab Merge Request Builder cron is set to poll every "X" minutes (i.e. same as above, 5 minutes = */5 * * * *)

Result:

  1. Cron picks up a new merge request to build
  2. After "X" (5) minutes, Gitlab Merge Request Builder triggers a second build while the first one is still building.
  3. First build finished and posts the comment on the merge request, sets commit as built.
  4. No additional builds are triggered (if cron is fast enough, a third or fourth could have been triggered for example)
  5. Second build finished and posts a second comment on the merge request, even though the same reference was built.

Updating a merge request with a new commit or amended commit should still work as intended and trigger a new build.

Workaround: Slow down your cron!

Merge request polling fails upon upgrade to 1.2.0

I upgraded to the new plugin version and merge request polling stopped working. In the console log is the following messages.

2014-04-28 23:45:22,001 WARNING [hudson.triggers.Trigger] (Jenkins-cron-thread-2) org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run() failed for icinga-conf_merge_request
java.lang.NullPointerException
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.latestCommitIsNotReached(GitlabMergeRequestWrapper.java:101)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.check(GitlabMergeRequestWrapper.java:86)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:83)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:65)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.run(GitlabMergeRequestBuilder.java:27)
        at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run(GitlabBuildTrigger.java:101)
        at hudson.triggers.Trigger.checkTriggers(Trigger.java:255)
        at hudson.triggers.Trigger$Cron.doRun(Trigger.java:203)
        at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
2014-04-28 23:50:21,902 WARNING [hudson.triggers.Trigger] (Jenkins-cron-thread-10) org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run() failed for icinga-conf_merge_request
java.lang.NullPointerException
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.latestCommitIsNotReached(GitlabMergeRequestWrapper.java:101)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.check(GitlabMergeRequestWrapper.java:86)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:83)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:65)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.run(GitlabMergeRequestBuilder.java:27)
        at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run(GitlabBuildTrigger.java:101)
        at hudson.triggers.Trigger.checkTriggers(Trigger.java:255)
        at hudson.triggers.Trigger$Cron.doRun(Trigger.java:203)
        at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
2014-04-28 23:55:21,885 WARNING [hudson.triggers.Trigger] (Jenkins-cron-thread-3) org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run() failed for icinga-conf_merge_request
java.lang.NullPointerException
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.latestCommitIsNotReached(GitlabMergeRequestWrapper.java:101)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.check(GitlabMergeRequestWrapper.java:86)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:83)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:65)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.run(GitlabMergeRequestBuilder.java:27)
        at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run(GitlabBuildTrigger.java:101)
        at hudson.triggers.Trigger.checkTriggers(Trigger.java:255)
        at hudson.triggers.Trigger$Cron.doRun(Trigger.java:203)
        at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) 
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

When I downgraded the plugin it started working again immediately.

Build triggered for closed requests

I found that commit to the source branch of the closed merge request triggers build.

How to reproduce:

  1. Create merge request for ci-test/branch-1 => master.
  2. Resolve MR with or without deleting og the source branch.
  3. Recreate and commit to ci-test/branch-1.
  4. Jenkins will start to build ci-test/branch-1 => master with request ID for closed request.

And even worse:

If you create a new MR for ci-test/branch-1 => master and commit to ci-test/branch-1 both closed and active requests builded.

Ability to retrigger a build without push

Sometimes a job is misconfigured or some other issue comes up, like database was down for a job.

In such cases it would be great to be able to re-trigger WITHOUT having to push a commit to the source branch.

Change to source branch not respected.

How to reproduce:
Make a merge request.
Wait for jenkins to build the request.
Edit the request and change the source branch.
Builder does not trigger another build.
Push to the branch.
Builder builds the old pre-edit source branch.

Build fails if slash in branch name

If you have a forward slash in the branch name e.g. bugfix/myfix or feature/my-new-feature. It should be able to account for that. Git supports it and so does GitLab.

Merge requests stopped building after upgrade to Gitlab 6.0

After upgrading to Gitlab 6.0 the merge requests stopped building on the jenkins server.

In the log I found this indicating that the project ID is missing somewhere:

org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run() failed for `Name_of_project-MergeRequests
java.lang.Error: java.io.FileNotFoundException: http://10.101.1.67/api/v3/projects/null/merge_requests/4/notes?private_token=EL6BEY9hoMKqaVTb3xaQ
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:195)

The null (literally the string value "null") value in the url that failed should have been the id of my Gitlab project.

Am I missing some new config somewhere or is this a bug?

MR from forked project

Hi,
I have small question about logic of a plugin. Apparently, it does expect that MR submitted within same repository but different branch. Correct me if I wrong.
How to handle cases where MR sent based on fork?

Thanks
Vik

Race condition causing jobs not to be loaded on Jenkins startup

Running latest master (and latest stable release), jobs with a gitlab merge request trigger on a https server sometimes disappear after a Jenkins restart, because of this exception (and despite the fact that the ignoreCertificateErrors flag is enabled).

SEVERE: Failed Loading job service-rtb-mr
java.lang.Error: javax.net.ssl.SSLHandshakeException: You can disable certificate checking by setting ignoreCertificateErrors on GitlabHTTPRequestor
        at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:199)
        at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:154)
        at org.gitlab.api.GitlabAPI.getAllProjects(GitlabAPI.java:93)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.getProjectForPath(GitlabRepository.java:98)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.checkState(GitlabRepository.java:39)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.init(GitlabRepository.java:30)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.build(GitlabMergeRequestBuilder.java:52)
        at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:49)
        at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:28)
        at hudson.model.AbstractProject.onLoad(AbstractProject.java:331)
        at hudson.model.Project.onLoad(Project.java:90)
        at hudson.model.Items.load(Items.java:276)
        at jenkins.model.Jenkins$18.run(Jenkins.java:2589)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:899)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
Caused by: javax.net.ssl.SSLHandshakeException: You can disable certificate checking by setting ignoreCertificateErrors on GitlabHTTPRequestor
        at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:275)
        at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:31)
        at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:192)
        ... 20 more

Probably a race condition between GitlabBuildTrigger#GitlabBuildTriggerDescriptor#configure() and GitlabBuildTrigger#GitlabBuildTriggerDescriptor#getGitlab() ? As a workaround, setting the initial value of _ignoreCertificateErrors to true fixes the issue...

Jenkins comment

I found your project available on the jenkins plugins, I really like to see jenkins & gitlab integration.

I have one question, does the publication of the results is automatically done by jenkins? Because even I have setup a project and trigger the building by hand, and the project is getting the correct params and the correct merge request, there is no test result published onto gitlab.

Thanks a lot for your help since now

Null in api call: api/v3/projects/null/merge_requests/2/notes

I'm getting such an error:

Aug 14, 2013 9:50:05 AM hudson.triggers.Trigger checkTriggers
WARNING: org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run() failed for webschool_specs
java.lang.Error: java.io.FileNotFoundException: http://gitlab.****.be/api/v3/projects/null/merge_requests/2/notes?private_token=H9***qq
        at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:195)
        at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:150)
        at org.gitlab.api.GitlabAPI.getAllNotes(GitlabAPI.java:166)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.getJenkinsNote(GitlabMergeRequestWrapper.java:75)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.check(GitlabMergeRequestWrapper.java:54)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:83)
        at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:65)
        at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.run(GitlabMergeRequestBuilder.java:27)
        at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run(GitlabBuildTrigger.java:95)
        at hudson.triggers.Trigger.checkTriggers(Trigger.java:261)
        at hudson.triggers.Trigger$Cron.doRun(Trigger.java:209)
        at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
        at java.util.TimerThread.mainLoop(Timer.java:534)
        at java.util.TimerThread.run(Timer.java:484)
Caused by: java.io.FileNotFoundException: http://gitlab.***.be/api/v3/projects/null/merge_requests/2/notes?private_token=H9***qq
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1401)
        at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:260)
        at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:31)
        at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:188)
        ... 13 more

I see there is null instead of 1 after projects/. Is this a bug or I missed something? Help is highly appreciated.

Links to merge requests from Jenkins do not include namespace in URL

Links to merge requests are broken in two locations:

  • Under the Jenkins build history table, left-hand side on the project page
  • Under the build name/time, in the center of the build page

Example link text: Merge Request #123 (source-branch => target-branch)

These link URLs do not include the full path with namespace, only the project name.

Expected URL: http://gitlab.example.com/my-group/my-project/merge_requests/123
Actual URL: http://gitlab.example.com/my-project/merge_requests/123

untitled

Parametrized build mismatches parameters

I must be the one who finds the weirdest bugs ever. A picture is worth more than a thousand words:

image

Project configuration:

image

Jenkins 1.522. Can't tell if Jenkins bug, plugin bug, or me being cursed by somebody.

Wrong merge request is triggered

Hi,

I have 2 merge requests on gitlab, from forked repo, on different branches.
I can't get the right branch to be merged by jenkins.

As written in the log, it tries to merge a commit from another branch which correspond the other pending merge request which compilation already passed.

See the log:

Gitlab Merge Request #42 : lolo/t-4/master_9382 => master
Building in workspace /home/jenkins/jobs/T4-GitlabMergeRequest/workspace
Fetching changes from 2 remote Git repositories
Fetching upstream changes from [email protected]:lolo/t4.git
Fetching upstream changes from [email protected]:repo/t4.git
using GIT_SSH to set credentials
Seen branch in repository ${gitlabSourceName}/master
Seen branch in repository ${gitlabSourceName}/master_9382
[...]
Seen branch in repository veve/t4/waste_roles
Seen 79 remote branches
Merging Revision 02dd76d0ba807d08a9312a003666167ac010105c (gb/t4/waste) onto origin/master using default strategy
ERROR: Branch not suitable for integration as it does not merge cleanly
Enregistrement des résultats des tests
Sending e-mails to: [email protected]
Finished: FAILURE

Issue running the plugin

I've probably missed something in the documentation, but I was hoping someone could nudge me in the right direction. I receive this error while attempting to save the job that i've setup by following the docs in the readme:

using v 1.1.1

Exception: java.lang.NullPointerException
Stacktrace:
javax.servlet.ServletException: java.lang.NullPointerException
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:719)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:583)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:214)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
    at winstone.ServletConfiguration.execute(ServletConfiguration.java:248)
    at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:376)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:50)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at winstone.RequestDispatcher.forward(RequestDispatcher.java:331)
    at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:227)
    at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NullPointerException
    at org.gitlab.api.GitlabAPI.<init>(GitlabAPI.java:31)
    at org.gitlab.api.GitlabAPI.connect(GitlabAPI.java:36)
    at org.jenkinsci.plugins.gitlab.Gitlab.connect(Gitlab.java:14)
    at org.jenkinsci.plugins.gitlab.Gitlab.get(Gitlab.java:19)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.getProjectForPath(GitlabRepository.java:98)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.checkState(GitlabRepository.java:39)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.init(GitlabRepository.java:30)
    at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.build(GitlabMergeRequestBuilder.java:52)
    at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:45)
    at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:28)
    at hudson.model.AbstractProject.submit(AbstractProject.java:1952)
    at hudson.model.Project.submit(Project.java:195)
    at hudson.model.Job.doConfigSubmit(Job.java:1076)
    at hudson.model.AbstractProject.doConfigSubmit(AbstractProject.java:758)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:151)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:90)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:111)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677)
    ... 39 more

Rebuild can cause false positives/negatives

Using the rebuild plugin (or simply starting a manual parametrized build) against a MR/branch for which the HEAD was already built results in nondeterministic behavior, as the actual HEAD is not checked out.

When the HEAD of the branchSpec was already built, the git plugin falls back to the latest built revision, which might not be the one being asked, and can therefore return a wrong result since it runs against a completely unrelated commit.

This is pretty obvious when turning on GitScm.VERBOSE. Here is a truncated output, during which a build targetting add_args actually ends up checking out test:

14:13:21 Gitlab Merge Request #17 : docker/service-mysql-migrations/add_args => master
../..
14:13:22 Removing what's already been built: {docker/service-mysql-migrations/test=Build #74 of Revision 57494c38da452e70b6dd8e3caf8156a193693038 (docker/service-mysql-migrations/test), docker/service-mysql-migrations/add_args=Build #67 of Revision 8705a4f235102b50799c2564a5864c239a118bed (docker/service-mysql-migrations/add_args)}
14:13:22 After filtering out what's already been built: []
14:13:22 Nothing seems worth building, so falling back to the previously built revision: Revision 57494c38da452e70b6dd8e3caf8156a193693038 (docker/service-mysql-migrations/test)
14:13:22 Checking out Revision 57494c38da452e70b6dd8e3caf8156a193693038 (docker/service-mysql-migrations/test)

As this is a built-in "feature" of the git plugin, I am unsure where and how this could be solved, but it's a pretty sneaky issue as it goes unnoticed unless you parse the logs...

Gitlab 5.2 isClosed and isMerged return always false

I use Gitlab 5.2. When the plugin gets merge_request by api, the isClosed and isMerged method return always true.

It's seem the merge_request model changed between version of Gitlab. I think "closed" and "merged" attributs was removed and replaced by "state".

Or i'm wrong. Any ideas?

Thanks

GitLab API access error (status: 403) in 1.2.1

When upgrading gitlab-merge-request-builder-plugin to 1.2.1, /api/v3/projects/all?private_token=xxx requests failed and all the merge-request driven jobs were disappeared. After that, we downgraded to 1.2.0 and everything works fine now.

  • GitLab: 6.7
  • Jenkins: 1.565
java.lang.Error: java.io.IOException: {"message":"403 Forbidden"}
  at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:218)
  at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:174)
  at org.gitlab.api.http.GitlabHTTPRequestor.getAll(GitlabHTTPRequestor.java:143)
  at org.gitlab.api.GitlabAPI.getAllProjects(GitlabAPI.java:173)
  at org.jenkinsci.plugins.gitlab.GitlabRepository.getProjectForPath(GitlabRepository.java:98)
  at org.jenkinsci.plugins.gitlab.GitlabRepository.checkState(GitlabRepository.java:39)
  at org.jenkinsci.plugins.gitlab.GitlabRepository.init(GitlabRepository.java:30)
  at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.build(GitlabMergeRequestBuilder.java:52)
  at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:44)
  at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:27)
  at hudson.model.AbstractProject.onLoad(AbstractProject.java:326)
  at hudson.model.Project.onLoad(Project.java:90)
  at hudson.model.Items.load(Items.java:273)
  at jenkins.model.Jenkins$18.run(Jenkins.java:2591)
  at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
  at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
  at jenkins.model.Jenkins$7.runTask(Jenkins.java:904)
  at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
  at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
  at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: {"message":"403 Forbidden"}
  at org.gitlab.api.http.GitlabHTTPRequestor.handleAPIError(GitlabHTTPRequestor.java:320)
  at org.gitlab.api.http.GitlabHTTPRequestor.access$300(GitlabHTTPRequestor.java:39)
  at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:215)
  ... 21 more
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: [FILTERED]
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1459)
  at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
  at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:283)
  at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:39)
  at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:211)
  ... 21 more

"Ignore SSL Certificate Errors" has no effect

As the subject says, the option doesn't have any effect, and loading jobs with the plugin assigned fail due to a failed SSH handshake.

Log says:

Jun 26, 2013 5:26:43 PM jenkins.InitReactorRunner$1 onTaskFailed
SEVERE: Failed Loading job XXX
java.lang.Error: javax.net.ssl.SSLHandshakeException: You can disable certificate checking by setting ignoreCertificateErrors on GitlabHTTPRequestor
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:195)
    at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:150)
    at org.gitlab.api.GitlabAPI.getAllProjects(GitlabAPI.java:90)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.getProjectForPath(GitlabRepository.java:98)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.checkState(GitlabRepository.java:39)
    at org.jenkinsci.plugins.gitlab.GitlabRepository.init(GitlabRepository.java:30)
    at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.build(GitlabMergeRequestBuilder.java:52)
    at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:45)
    at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.start(GitlabBuildTrigger.java:28)
    at hudson.model.AbstractProject.onLoad(AbstractProject.java:311)
    at hudson.model.Project.onLoad(Project.java:83)
    at hudson.model.Items.load(Items.java:221)
    at jenkins.model.Jenkins$17.run(Jenkins.java:2542)
    at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
    at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
    at jenkins.model.Jenkins$7.runTask(Jenkins.java:893)
    at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
    at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)
Caused by: javax.net.ssl.SSLHandshakeException: You can disable certificate checking by setting ignoreCertificateErrors on GitlabHTTPRequestor
    at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:271)
    at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:31)
    at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:188)
    ... 20 more

Hope this helps.

Trigger a build only for MR to specific branches

Hey, I would like create a job in jenkins that is triggered when the Merge Request is requested to a specific branch or specified subset of branches (it is from a forked repository by the way so it also depends on #29). Is this currently possible or is this an enhancement? Thanks.

ambiguous argument 'origin/${gitlabTargetBranch}^{commit}': unknown revision

Hello,

I'm trying to set up the plugin according to the README.md but for me it looks like the variables aren't applied on the actual commands. I'm quite new to jenkins and I can't figure what I'm doing wrong.

Fetching upstream changes from git@hostname:reponame/repo.git
using GIT_SSH to set credentials 
Seen branch in repository origin/develop
Seen branch in repository origin/feature-application-json
Seen branch in repository origin/feature/jenkins-build
Seen branch in repository origin/master
Seen 4 remote branches
Merging Revision 91ce96f9c84c1607b806371285d051a0dc66d76d (origin/master) onto origin/${gitlabTargetBranch} using default strategy
FATAL: Command "git rev-parse origin/${gitlabTargetBranch}^{commit}" returned status code 128:
stdout: origin/${gitlabTargetBranch}^{commit}

stderr: fatal: ambiguous argument 'origin/${gitlabTargetBranch}^{commit}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

hudson.plugins.git.GitException: Command "git rev-parse origin/${gitlabTargetBranch}^{commit}" returned status code 128:
stdout: origin/${gitlabTargetBranch}^{commit}

stderr: fatal: ambiguous argument 'origin/${gitlabTargetBranch}^{commit}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Project with namespace path does not seem to work?

I have a project which is not at root ( "path_with_namespace": "nkumar/test" ) and it seems like the plugin can not work with such a project. It keeps giving incorrect project id exception.

Example log message below.
May 30, 2013 7:26:25 PM org.jenkinsci.plugins.gitlab.GitlabRepository checkState
SEVERE: Could not retrieve Project with id: 17 (Have you properly configured the project id?)

Here's the output from gitlab for the project, it shows id as 17.

{
"created_at": "2013-05-17T01:20:42Z",
"default_branch": "master",
"description": null,
"id": 17,
"issues_enabled": true,
"merge_requests_enabled": true,
"name": "test",
"namespace": {
"created_at": "2013-05-02T21:45:16Z",
"description": "",
"id": 3,
"name": "nkumar",
"owner_id": 3,
"path": "nkumar",
"updated_at": "2013-05-02T21:45:16Z"
},
"owner": {
"created_at": "2013-05-02T21:45:15Z",
"email": "[email protected]",
"id": 3,
"name": "Nitin Kumar",
"state": "active",
"username": "nkumar"
},
"path": "test",
"path_with_namespace": "nkumar/test",
"public": false,
"wall_enabled": false,
"wiki_enabled": true
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.