Questions tagged [multibranch-pipeline]

Multibranch Pipeline is a Jenkins job configuration type provided by the Pipeline: Multibranch Plugin that detects and builds SCM branches.

Multibranch Pipeline is a Jenkins job configuration type provided by the Pipeline: Multibranch Plugin that detects and builds SCM branches.

310 questions
114
votes
6 answers

"Build Periodically" with a Multi-branch Pipeline in Jenkins

I'm running Jenkins 2 with the Pipeline plugin. I have setup a Multi-branch Pipeline project where each branch (master, develop, etc.) has a Jenkinsfile in the root. Setting this up was simple. However, I'm at a loss for how to have each branch run…
geowa4
  • 40,390
  • 17
  • 88
  • 107
76
votes
10 answers

Jenkins - abort running build if new one is started

I use Jenkins and Multibranch Pipeline. I have a job for each active git branch. New build is triggered by push in git repository. What I want is to abort running builds in current branch if new one appears in same branch. For example: I commit and…
kakty3
  • 1,149
  • 1
  • 9
  • 12
56
votes
4 answers

Can I check if Environment variable exist or not in Jenkinsfile

I am running Multibranch pipeline for my project. The behaviour of Jenkinsfile should change according to the trigger. There are two events that triggeres the pipeline 1. Push event 2. Pull Request. I am trying to check Environment variable…
kishs1991
  • 969
  • 4
  • 10
  • 16
45
votes
6 answers

Jenkins multibranch pipeline Scan without execution

Is it possible to Scan a Multibranch Pipeline to detect the branches with a Jenkinsfile, but without the pipeline execution? My projects have different branches and I don't want that all the children pipelines branches with a Jenkinsfile to start to…
Daniel Majano
  • 976
  • 2
  • 10
  • 18
42
votes
5 answers

How to set and reference a variable in a Jenkinsfile

I have a declarative pipeline script for my multibranch project in which I would like to read a text file and store the result as a string variable to be accessed by a later step in the pipeline. Using the snippet generator I tried to do something…
37
votes
1 answer

Jenkins multibranch pipeline won't prune deleted branches

We're currently having some trouble with the bitbucket branch source plugin used to handle a multibranch test job in one of our Jenkins instances (productive instance): Any job related to a deleted branch is not getting deleted in Jenkins. Is is…
Joerg S
  • 4,730
  • 3
  • 24
  • 43
31
votes
4 answers

How to trigger Jenkins Multi-Branch Pipeline with Gitlab Webhook

I currently set up a Jenkins Multi-Branch Pipeline job that is based on a Git repository hosted on our Gitlab server. Jenkins can read the branches in the repository and creates a job for every branch in the repository. But I can't figure out how to…
Michael Lihs
  • 7,460
  • 17
  • 52
  • 85
28
votes
5 answers

Jenkins JobDSL multibranchPipelineJob change script path

I am trying to create a multibranchPipelineJob in jobDSL, however the Jenkinsfile is at an alternative location to the default. I have looked through the docs https://jenkinsci.github.io/job-dsl-plugin/#path/multibranchPipelineJob and I cannot see…
apr_1985
  • 1,764
  • 2
  • 14
  • 27
27
votes
5 answers

How to get the git latest commit message and prevent the jenkins build if the commit message contains [ci skip]?

I tried to get the git commit message in jenkinsfile and prevent the build based on commit message. env.GIT_COMMIT doesn't return the commit details in jenkinsfile. How to get the git latest commit message and prevent the jenkins build if the commit…
24
votes
2 answers

Jenkins Multibranch Config: How to Filter branches based on variable string?

We have Jenkins set up with 7 multibranch pipeline projects, each building off the same git repo, but for different target platforms. Each of these multibranch pipelines builds a number of branches. We currently set which branches each multibranch…
Allen Pestaluky
  • 3,126
  • 2
  • 20
  • 22
22
votes
1 answer

Is it possible to rename default "Declarative: Checkout SCM" step?

When you use Jenkins multibranch pipeline, the first stage is named by default Declarative: Checkout SCM. Is it possible to rename it? I know that it is possible to skip default checkout, but I do not want this - I just want to rename this default…
Basil
  • 981
  • 1
  • 8
  • 20
21
votes
5 answers

GitHub Branch name from which the Pull Request is raised

I'm using Multibranch Pipeline Job in Jenkins. How do I find the branch name from which the Pull Request is raised in GitHub? I'm using /github-webhook/ & also tried with /ghprbhook/ and tried with the following environment variables:…
21
votes
1 answer

How to trigger Multibranch Pipeline build with github webhook

In freestyle job there is an option named "GitHub hook trigger for GITScm polling" on stage Build Trigger. screen capture here: . Together with webhook in gitlab config "http://myjenkins/gitlab/notify_commit" it works fine, meaning that the build…
Mars
  • 211
  • 1
  • 2
  • 3
21
votes
4 answers

How to remotely trigger Jenkins multibranch pipeline project build?

Title mostly says it. How can you trigger a Jenkins multibranch pipeline project build from a remote git repository? The "Trigger builds remotely" build trigger option does not seem to work, since no tokens that you set are saved.
Marmoy
  • 8,009
  • 7
  • 46
  • 74
15
votes
3 answers

How to trigger a Jenkins multibranch pipeline when code change is pushed to GitHub

I have a Jenkins job (multibranch pipeline) setup for a GitHub repo. I want to trigger that job automatically whenever there is a change pushed to that Git repo. How can I achieve this using a Jenkinsfile? I want to avoid any config change in the…
1
2 3
20 21