# Multibranch pipeline triggering multiple branches instead of one

**URL:** <https://community.jenkins.io/t/multibranch-pipeline-triggering-multiple-branches-instead-of-one/34188>\
**Category:** Using Jenkins\
**Tags:** question, git\
**Created:** [July 22, 2025, 5:15pm UTC](https://community.jenkins.io/t/multibranch-pipeline-triggering-multiple-branches-instead-of-one/34188 "2025-07-22T17:15:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![uler3161](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/uler3161/32/16042_2.png) [@uler3161](https://community.jenkins.io/u/uler3161)\
**Post date:** [July 22, 2025, 5:15pm UTC](https://community.jenkins.io/t/multibranch-pipeline-triggering-multiple-branches-instead-of-one/34188/1 "2025-07-22T17:15:35Z")

</div>

Jenkins setup:

## Jenkins: 2.504.3 OS: Windows Server 2019 - 10.0 Java: 21.0.6 - Oracle Corporation (Java HotSpot™ 64-Bit Server VM)

antisamy-markup-formatter:173.v680e3a\_b\_69ff3  
apache-httpcomponents-client-4-api:4.5.14-269.vfa\_2321039a\_83  
apache-httpcomponents-client-5-api:5.5-150.veb\_76e719855b\_  
asm-api:9.8-135.vb\_2239d08ee90  
authentication-tokens:1.131.v7199556c3004  
bootstrap5-api:5.3.7-1  
bouncycastle-api:2.30.1.80-261.v00c0e2618ec3  
branch-api:2.1229.ve86b\_d02b\_5e56  
build-timeout:1.38  
caffeine-api:3.2.0-166.v72a\_6d74b\_870f  
checks-api:373.vfe7645102093  
cloudbees-bitbucket-branch-source:936.4.3  
cloudbees-folder:6.1033.v7a\_d11b\_20c8df  
command-launcher:123.v37cfdc92ef67  
commons-lang3-api:3.17.0-87.v5cf526e63b\_8b\_  
commons-text-api:1.13.1-176.v74d88f22034b\_  
config-file-provider:988.v0461fcc2b\_9d1  
coverage:2.7.1  
credentials:1415.v831096eb\_5534  
credentials-binding:696.v256688029804  
data-tables-api:2.3.2-3  
display-url-api:2.209.v582ed814ff2f  
dotnet-sdk:1.4.0  
dtkit-api:3.0.3  
durable-task:587.v84b\_877235b\_45  
echarts-api:5.6.0-5  
eddsa-api:0.3.0.1-19.vc432d923e5ee  
email-ext:1916.vc954a\_f86ff21  
emma:1.31  
external-monitor-job:223.vb\_fddcf42c9b\_3  
favorite:2.237.v79163ca\_8b\_892  
font-awesome-api:6.7.2-1  
forensics-api:3.1.0  
git:5.7.0  
git-client:6.2.0  
github:1.43.0  
github-api:1.321-488.v9b\_c0da\_9533f8  
github-branch-source:1824.v046257273408  
gradle:2.15  
gson-api:2.13.1-139.v4569c2ef303f  
handy-uri-templates-2-api:2.1.8-36.v85e4cb\_234a\_13  
htmlpublisher:427  
instance-identity:203.v15e81a\_1b\_7a\_38  
ionicons-api:88.va\_4187cb\_eddf1  
jackson2-api:2.19.0-404.vb\_b\_0fd2fea\_e10  
jakarta-activation-api:2.1.3-2  
jakarta-mail-api:2.1.3-2  
javadoc:327.vdfe586651ee0  
javax-activation-api:1.2.0-8  
javax-mail-api:1.6.2-11  
jaxb:2.3.9-133.vb\_ec76a\_73f706  
jdk-tool:83.v417146707a\_3d  
jjwt-api:0.11.5-120.v0268cf544b\_89  
joda-time-api:2.14.0-127.v7d9da\_295a\_d51  
jquery3-api:3.7.1-3  
jsch:0.2.16-95.v3eecb\_55fa\_b\_78  
json-api:20250517-153.vc8a\_a\_d87c0ce3  
json-path-api:2.9.0-148.v22a\_7ffe323ce  
jsoup:1.21.1-52.v96e4041b\_60fd  
junit:1335.v6b\_a\_a\_e18534e1  
ldap:780.vcb\_33c9a\_e4332  
mailer:509.vc54d23fc427e  
matrix-auth:3.2.6  
matrix-project:849.v0cd64ed7e531  
maven-plugin:3.26  
mina-sshd-api-common:2.15.0-161.vb\_200831a\_c15b\_  
mina-sshd-api-core:2.15.0-161.vb\_200831a\_c15b\_  
msbuild:1.37  
mstest:1.0.5  
mstestrunner:1.5.0  
multibranch-scan-webhook-trigger:1.0.11  
okhttp-api:4.11.0-189.v976fa\_d3379d6  
oss-symbols-api:356.v2da\_d59a\_3742b\_  
pam-auth:1.12  
pipeline-build-step:571.v08a\_fffd4b\_0ce  
pipeline-github-lib:65.v203688e7727e  
pipeline-graph-analysis:241.vc3d48fb\_b\_2582  
pipeline-groovy-lib:752.vdddedf804e72  
pipeline-input-step:527.vd61b\_1d3c5078  
pipeline-milestone-step:138.v78ca\_76831a\_43  
pipeline-model-api:2.2255.v56a\_15e805f12  
pipeline-model-definition:2.2255.v56a\_15e805f12  
pipeline-model-extensions:2.2255.v56a\_15e805f12  
pipeline-rest-api:2.38  
pipeline-stage-step:322.vecffa\_99f371c  
pipeline-stage-tags-metadata:2.2255.v56a\_15e805f12  
pipeline-stage-view:2.38  
plain-credentials:199.v9f8e1f741799  
plugin-util-api:6.1.0  
powershell:2.3  
prism-api:1.30.0-1  
pubsub-light:1.19  
resource-disposer:0.25  
scm-api:704.v3ce5c542825a\_  
script-security:1373.vb\_b\_4a\_a\_c26fa\_00  
snakeyaml-api:2.3-125.v4d77857a\_b\_402  
sse-gateway:1.28  
ssh-credentials:359.v2191c4cf635f  
ssh-slaves:3.1031.v72c6b\_883b\_869  
sshd:3.372.v5d04a\_e92d8cf  
structs:350.v3b\_30f09f2363  
timestamper:1.30  
token-macro:444.v52de7e9c573d  
trilead-api:2.209.v0e69b\_c43c245  
variant:70.va\_d9f17f859e0  
workflow-aggregator:608.v67378e9d3db\_1  
workflow-api:1373.v7b\_813f10efa\_b\_  
workflow-basic-steps:1079.vce64b\_a\_929c5a\_  
workflow-cps:4151.v5406e29e3c90  
workflow-durable-task-step:1434.v1b\_595c29ddd7  
workflow-job:1540.v295eccc9778f  
workflow-multibranch:806.vb\_b\_688f609ee9  
workflow-scm-step:437.v05a\_f66b\_e5ef8  
workflow-step-api:704.ve4f0967e98fa\_  
workflow-support:968.v8f17397e87b\_8  
ws-cleanup:0.48  
xunit:3.1.5

Hi, I’m a relative newbie to Jenkins, so this might be an easy fix, but I just don’t know.

I have a multibranch pipeline. I’m using a self-hosted git repository. Also, I use the Multibranch Scan Webhook Trigger plugin. I have a number of different branches. Currently I do work in the `master` branch. When I’ve done enough work to do a release, I then merge into a branch that is there to handle deployment of a specific application to a specific environment. For instance, I have `dev_client` and `prod_client` branches, each of which will deploy a particular application (which I’m calling “client”) to the appropriate environment (dev or prod in this case). For completeness, I’ll add an anonymized version of my `JenkinsFile` below. Every branch has the same `JenkinsFile` and I coded it to do different things depending on what branch it’s on.

As part of my post-receive hook, I invoke the following URL to start the pipeline:

`https://myserver:8443/multibranch-webhook-trigger/invoke?token=ClientToken`

What I’m expecting to happen is this order of operations:

1. Push changes to `master`.
2. Webhook detects changes to `master` and invokes trigger URL above.
3. The `master` branch pipeline runs.

What I’m actually seeing:

1. Push changes to `master`.
2. Webhook detects changes to `master` and invokes trigger URL above.
3. The `master` branch pipeline runs.
4. The `dev_client` branch pipeline runs.

In my post-receive, I am logging branch name. At the time in which `dev_client` branch pipeline runs, the only branch that has been logged is `master`. Also, if I manually visit the webhook URL, it always seems to choose to run the `dev_client` branch. I just can’t figure out why. I would think it’s all or nothing. And it’s not random, because it’s always `dev_client`.

As a side note, is there something weird about this forum that is changing the word `master` to `controller` if you don’t put it in quotes?

```auto
def deploy = false
def test = false

pipeline {
    agent any
    options {
        disableConcurrentBuilds(abortPrevious: true)
    }
    environment {
        git_credentials = "git credentials here"
        git_url = "git url here"
        dotnet_version = "net9.0-windows"
        deploy_user_login = "deploy-login"
    }
    stages {
        stage('Set Environment Variables') {
            steps {
                script {
                    echo "Working with branch from ${env.BRANCH_NAME}"

                    if (env.BRANCH_NAME == 'prod_client') {
                        env.client_appsettings_file = "prod-client-appsettings"
                        deploy = true
                    } else if (env.BRANCH_NAME == 'dev_client') {
                        env.client_appsettings_file = "test-client-appsettings"
                        deploy = true
                    } else if (env.BRANCH_NAME == 'master') {
                        test = true
                    }
                }
            }
        }
        stage('CleanWorkspace') {
	        when {
		        expression { deploy || test }
	        }
            steps {
                cleanWs()
            }
        }
        stage ('Git Checkout') 
        {
	        when {
		        expression { deploy || test }
	        }
            steps 
            {
                git branch: "${env.BRANCH_NAME}", credentialsId: "${env.git_credentials}", url: "${env.git_url}"
            }
        }
        stage('Update Configuration') 
        {
	        when {
		        expression { deploy }
	        }
            steps 
            {
                configFileProvider([configFile(fileId: "${env.client_appsettings_file}", replaceTokens: true, targetLocation: 'Client\\appsettings.production.json')]) 
                {
                }
            }
        }
        stage('Test') 
        {
        	when {
		        expression { test }
	        }
            steps 
            {
                bat 'dotnet tool uninstall --global dotnet-coverage || exit 0'
                bat 'dotnet tool install --global dotnet-coverage || exit 0'
                bat 'dotnet test -l:trx --collect "Code Coverage" --results-directory:"./TestResults" || true'
                bat 'dotnet-coverage merge *.coverage --recursive -f cobertura --output TestResults/coverage.xml'
            }
        }
        stage('Publish') 
        {
	        when {
		        expression { deploy }
	        }
            steps 
            {
                bat "msbuild.exe /p:WarningLevel=0 /t:Restore;Publish /p:PublishProfile=ClickOnceProfile \"${workspace}\\Client\\Client.csproj\""
            }
        }
        stage('Update ClickOnce Versions') {
	        when {
		        expression { deploy }
	        }
            steps {
                script {
                    def xmlFilePath = "${workspace}\\Client\\Properties\\PublishProfiles\\ClickOnceProfile.pubxml"

                    def (currentRevision, newRevision, newXmlContent, newMinVersion) = updateClickOnceVersionNumbers(xmlFilePath)

                    writeFile(file: xmlFilePath, text: newXmlContent)

                    echo "Updated ApplicationRevision from ${currentRevision} to ${newRevision}"
                    echo "Updated MinimumRequiredVersion to ${newMinVersion}"
                }
                script {
                    bat 'git add Client\\Properties\\PublishProfiles\\ClickOnceProfile.pubxml'
					bat 'git commit -m "Updated ClickOnce Version" || echo "Nothing to commit"'

                    withCredentials([gitUsernamePassword(credentialsId: "${env.git_credentials}")]) 
                    {
                        bat "git push --set-upstream origin ${env.BRANCH_NAME}"
                    }
                }
            }
        }
    }
    post 
    {
        always 
        {
            script
            {
                if (test) 
                {
                    mstest(testResultsFile: '**/*.trx', failOnError: true, keepLongStdio: true)
                    recordCoverage(tools: [[parser: 'COBERTURA', pattern: 'TestResults/coverage.xml']], sourceCodeRetention: 'LAST_BUILD')
                }
            }
        }
    }
}

@NonCPS
def updateClickOnceVersionNumbers(String xmlFilePath) {
    def xmlFile = new File(xmlFilePath)
    def parser = new XmlParser()
    def project = parser.parse(xmlFile)

    def propertyGroup = project['PropertyGroup'][0]

    def currentRevision = propertyGroup['ApplicationRevision'][0].text() as Integer
    def newRevision = currentRevision + 1
    propertyGroup['ApplicationRevision'][0].value = newRevision.toString()

    def minVersionText = propertyGroup['MinimumRequiredVersion'][0].text()
    def versionBase = minVersionText.substring(0, minVersionText.lastIndexOf('.') + 1)
    def newMinVersion = versionBase + newRevision
    propertyGroup['MinimumRequiredVersion'][0].value = newMinVersion

    def writer = new StringWriter()
    def printer = new XmlNodePrinter(new PrintWriter(writer))
    printer.preserveWhitespace = true
    printer.print(project)

    return [currentRevision, newRevision, writer.toString(), newMinVersion]
}

```

---

<div class="post-metadata">

**Author:** ![uler3161](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/uler3161/32/16042_2.png) [@uler3161](https://community.jenkins.io/u/uler3161)\
**Post date:** [July 23, 2025, 1:18am UTC](https://community.jenkins.io/t/multibranch-pipeline-triggering-multiple-branches-instead-of-one/34188/2 "2025-07-23T01:18:41Z")

</div>

So I think what’s happening is this:

1. I merge controller into dev\_client.
2. The dev\_client pipeline runs.
3. The dev\_client pipeline updates ClickOnce version numbers and pushes those back into dev\_client.
4. I push something to controller.
5. The post-receive hook triggers a build for controller.
6. The branch indexing functionality runs for the multibranch and detects the ClickOnce version update push as being a change and then that triggers the dev\_client pipeline to run.

I’ve been trying various things ([ci skip] comment, ci skip push option) to no avail. The ci skip push option I think is failing due to an older git install on the server. Adding [ci skip] to the ClickOnce verison number commit message does nothing. Thought I needed the SCM Skip plugin, but that doesn’t seem to do anything, or else I need to configure it somehow and don’t know where.

---

<div class="post-metadata">

**Author:** ![uler3161](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/uler3161/32/16042_2.png) [@uler3161](https://community.jenkins.io/u/uler3161)\
**Post date:** [July 23, 2025, 3:56pm UTC](https://community.jenkins.io/t/multibranch-pipeline-triggering-multiple-branches-instead-of-one/34188/3 "2025-07-23T15:56:45Z")

</div>

It’s not ideal imo, but I’ve added this as the first thing in the first step of the first stage of my pipeline:

`scmSkip(deleteBuild: true, skipPattern:'.*\\[ci skip\\].*')`

It does work but it would be nice if it wouldn’t even start the build at all. But if it’s what I have to do, I guess it’s what I have to do.
