why won't builds trigger with multibranch pipeline github branch source ?

21 views
Skip to first unread message

Neil T

unread,
Jan 3, 2019, 8:32:52 AM1/3/19
to Jenkins Users
Hi All

My desired behaviour for triggering multi branch pipelines is:

- trigger build on commit / push to git hub
- don't trigger builds when the repository scanner runs (on cron)
- don't trigger builds when PR is opened 

Issue is

- builds only trigger is noTriggerBranchProperty() is commented out / absent

From my understanding of the above config is as in the docs
- 'Suppresses the normal SCM commit trigger coming from branch indexing.'

But it seems to suppress ALL triggers?! 


I've used DSL construct the config and the result is, DSL below.

Screenshot from 2019-01-03 13-12-48.jpg

























multibranchPipelineJob('simple-spring-boot') {
    description("")
    branchSources {
        branchSource {
            source {
                github {
                    repoOwner('me')
                    repository('simple-springboot')
                    apiUri(url)
                    credentialsId("---")
                    buildOriginBranch(true)
                    traits {
                        headWildcardFilter {
                            includes('master development *PC-* *HD-* *SLR-*')
                            excludes('PR')
                        }

                        gitHubCommitSkipTrait()
                    }
                }
            }

            buildStrategies {
                ignoreCommitterStrategy {
                    ignoredAuthors("jenkins")
                    allowBuildIfNotExcludedAuthor(true)
                }
            }

            strategy {

                namedExceptionsBranchPropertyStrategy {
                    defaultProperties {
                        buildRetentionBranchProperty {
                            buildDiscarder {
                                logRotator {
                                    daysToKeepStr("10")
                                    numToKeepStr("10")
                                    artifactDaysToKeepStr("-1")
                                    artifactNumToKeepStr("-1")
                                }
                            }

                        }
                        noTriggerBranchProperty()

                    }
                    namedExceptions {
                        named {
                            name("master production")
                            props {
                                buildRetentionBranchProperty {
                                    buildDiscarder {
                                        logRotator {
                                            daysToKeepStr("10")
                                            numToKeepStr("10")
                                            artifactDaysToKeepStr("-1")
                                            artifactNumToKeepStr("-1")
                                        }
                                    }
                                }
                                noTriggerBranchProperty()
                            }

                        }
                    }
                }
            }
        }
    }
    triggers {
        periodic(1440)
    }

    orphanedItemStrategy {
        discardOldItems {
            daysToKeep(1)  // remove merged pipelines every day
        }
    }

    configure {
        def traits = it / sources / data / 'jenkins.branch.BranchSource' / source / traits
        traits << 'org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait' {
            strategyId(3)
        }
//        traits << 'org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait' {
//            strategyId(1)
//        }
//
//        traits <<
//
//    }
    }
}






Neil T

unread,
Jan 3, 2019, 9:43:14 AM1/3/19
to Jenkins Users
I meant to add that the I can see the triggers are firing from github in the jenkins logs. 

Neil T

unread,
Jan 3, 2019, 10:05:59 AM1/3/19
to Jenkins Users
Right, I think the docs are misleading me


Notes: Suppress Automatic SCM trigger property: It disables any automatic triggering, not only coming from push / pull request / repository notification but also from branch indexing.

but on jenkins help 

Suppresses the normal SCM commit trigger coming from branch indexing.

Reply all
Reply to author
Forward
0 new messages