Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Not working with Jenkins 2.0 Pipeline plugin #31

Open
techgnosis opened this issue May 4, 2016 · 19 comments
Open

Not working with Jenkins 2.0 Pipeline plugin #31

techgnosis opened this issue May 4, 2016 · 19 comments

Comments

@techgnosis
Copy link

Log says "WARNING: no project references the given repo url and commit branch"
However, I get all the normal spew leading up to the warning, such as..

INFO: gitlab web hook triggered for

  • repo url: [email protected]:redacted/redacted-reference-project.git
  • branch: master
  • with payload:
    {
    "object_kind": "push",
    "before": "2bd4bdf47f9752f7a178488554f06cc2682e8ff0",
    "after": "89ab9882dbe33e6e51336d7ecd63b66e94427a64",
    "ref": "refs/heads/master",
    etc etc..

So the web hook is triggered and it finds all the commits. It just fails at the end.

Running Jenkins 2.0

@chrisjunlee
Copy link

What are the repro steps and expected behavior?

@robertbus
Copy link

I can confirm that the plugin does not work with Jenkins 2.0 Pipeline.

Steps to reproduce:

  1. create git repo in GitLab with a Jenkinsfile
  2. configure the 'build_now' webhook triggered by push events in GitLab pointing it to Jenkins
  3. configure a new Pipeline job in Jenkins using above created repo
  4. push some change into GitLab
  5. check Jenkins logs

Expected behavior:

  • webhook triggered by the push and Jenkins building the pipeline project with the new changes

Actual behavior:

  • webhook triggered by the push and Jenkins stating in the logs that it could not find a matching project: "no project references the given repo url and commit branch"

To verify that the plugin works otherwise I also created a freestyle job in Jenkins using the same git repo and a dummy shell step just echoing some text.

Having both jobs (pipeline and freestyle) in Jenkins and pushing changes to the git repo (or clicking on the test hook link in GitLab) leads to the result that the freestyle project build kicks off, but the pipeline one doesn't.

In the logs I could see that Jenkins found only one matching project, the freestyle one.

I hope this helps to pinpoint the cause of this issue.

@singh-abhijeet
Copy link

singh-abhijeet commented Jul 26, 2016

Unable to trigger Pipeline Project build on Jenkins 2.7, Pipeline Plugin 2.2, GitLab 7.7.
Jenkins log: No valid crumb was included in request for /github-webhook/. Returning 403.

Tried these URLs, but in vain:

Freestyle project builds fine though.

Note: Disabled Cross Site Forgery security on Jenkins to make it working. Unchecked Manage Jenkins > Configure Global Security > Prevent Cross Site Request Forgery exploits on Jenkins.

@o8o
Copy link

o8o commented Nov 4, 2016

I used this URL and it works: http://jenkins host:port/project/my job name

@amontalban
Copy link

I'm still having this issue:

Feb 24, 2017 7:54:47 PM com.dabsquared.gitlabjenkins.webhook.GitLabWebHook getDynamic
INFO: WebHook called with url: /jenkins/project/Pipeline
Feb 24, 2017 7:54:48 PM org.jruby.javasupport.JavaMethod invokeDirectWithExceptionHandling
INFO: gitlab web hook triggered for
   - repo url: [email protected]:developers/ACME.git
   - branch: pipeline
   - with payload:
{
  "before": "19ed3ef57b7a1b12dbf546649ae61b234d8959fc",
  "after": "c9d3369b5387a9c83c810448ad2854c7d883be9c",
  "ref": "refs/heads/pipeline",
  "user_id": 3,
  "user_name": "Andres Montalban",
  "project_id": 5,
  "repository": {
    "name": "ACME",
    "url": "[email protected]:developers/ACME.git",
    "description": "ACME Core Repository",
    "homepage": "https://git.ACME.com/developers/ACME"
  },
  "commits": [
    {
      "id": "c9d3369b5387a9c83c810448ad2854c7d883be9c",
      "message": "Initial config of Jenkins pipeline",
      "timestamp": "2017-02-24T19:54:40+00:00",
      "url": "https://git.ACME.com/developers/ACME/commit/c9d3369b5387a9c83c810448ad2854c7d883be9c",
      "author": {
        "name": "Andres Montalban",
        "email": "[email protected]"
      }
    }
  ],
  "total_commits_count": 1
}
Feb 24, 2017 7:54:48 PM org.jruby.javasupport.JavaMethod invokeDirectWithExceptionHandling
INFO: matching projects:
   - Checkout_ACME_Repo
Feb 24, 2017 7:54:48 PM org.jruby.javasupport.JavaMethod invokeDirectWithExceptionHandling
WARNING: no project references the given repo url and commit branch

I have two jobs Checkout_ACME_Repo (FreeStyle) and Pipeline (Pipeline), but only former is matching.

@vkotovv
Copy link

vkotovv commented May 23, 2017

@singh-abhijeet is this hook working with pipelines if you disable Cross Site Forgery security as you said?

@singh-abhijeet
Copy link

singh-abhijeet commented May 25, 2017

@vkotovv Yes Vadim, the 403 error was due to Cross Site (Domain) request to the Web Hook. Disabling the security option helped. This solution is advisable if you're running Jenkins, Git within your org's Firewall; as disabling it can invite False/Forgery request to the Web Hook if your Jenkins instance is exposed publicly via Internet.

@leti-ulloa
Copy link

I'm having the same problem originally reported.. the web hook works fine on a freestyle project but does not work in pipeline project.. Has anyone found a workaround for this?

@bmaehr
Copy link

bmaehr commented Aug 16, 2017

It is still not working with Pipeline-Projekts.

bmaehr pushed a commit to bmaehr/gitlab-hook-plugin that referenced this issue Aug 16, 2017
@colinlabs
Copy link

colinlabs commented Nov 26, 2017

@bmaehr thanks, I had build successfully, it's docker image's problem, your PR work well in my machine,support 2.0 pipeline web hook and system hook . @javiplx , can you merge this PR to master branch?

@ikus060
Copy link

ikus060 commented Feb 7, 2018

Is this issue fixed with the previous PR ?

@bmaehr
Copy link

bmaehr commented Feb 7, 2018

My commit should fix it, but I also don't understand @colinlabs comment.

@colinlabs
Copy link

@bmaehr it works, but there is a problem, must success run a job before trigger hook

@ikus060
Copy link

ikus060 commented Feb 8, 2018

@colinlabs You mean: a job must run successfully to make the web hook work ?

@colinlabs
Copy link

@ikus060 yes, otherwise, it will raise an "Template not find" error

@bmaehr
Copy link

bmaehr commented Feb 8, 2018

I think it is enough that the template has run once.

@ezraroi
Copy link

ezraroi commented May 5, 2019

he, any update on this? looks like the PR was never merged.... for me it is not working even when the pipeline ran once

@javiplx
Copy link

javiplx commented May 5, 2019

It looks like I didn't notice the notification about #55. I need to arrange it to execute tests to ensure that it does not break something, as happened with javiplx#100

@ezraroi
Copy link

ezraroi commented May 5, 2019

@javiplx so we can expect to get a new version with this feature?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests