Search code examples
jenkinsgitlabjenkins-pipelinejenkins-2

Jenkins pipeline automatic branch detection


I am migrating my old Jenkins free-style job to multi-branch pipeline. I also want to use GitLab hook with them.

My problem is the branch detection. I am doing it manually but I want it to be automatic: when a new branch is pushed to git, GitLab trigger a Jenkins job that trigger the branch detection if the branch parameter from GitLab is not known for Jenkins at the moment. Is this possible to do it or doesn't this exist?

FYI: I tried to launch the multi-branch pipeline job but Jenkins says:

ERROR: No parameterized job named XXX found.

Solution

  • I didn't receive the answer I wanted and I ran into this issue today that answered the question :

    https://github.com/jenkinsci/gitlab-plugin/issues/298

    TLDR: Multi-branch pipeline are not supported yet to be triggered by gitlab commit easily. There is a workaround. Look at the link above.