10

I'm setting a Multi-Branch pipeline in jenkins blue ocean. Everything is starting to work nice.

One thing I've noticed is that once a while, I get an execution of the job named: "Branch indexing" running.

My build contains some heavy unit testing and code coverage, that take ~4h30 to be executed, so having this job randomly executed 2 times is not really good(not even taking in account that we have 6-8 active branches, so it would mean that the executions will only stacks.

So:

1) What are those executions? 2) Is this absolutely required? 3) Can I disable it?

StephenKing
  • 36,187
  • 11
  • 83
  • 112
J4N
  • 19,480
  • 39
  • 187
  • 340
  • 2
    Branch indexing discovers new or deleted branches. In the job configuration (Branch Sources > Property strategy), you can activate _Suppress automatic SCM triggering_, which will not automatically build new branches. – StephenKing Jun 28 '18 at 12:54
  • 1
    But this is not a new branch, I'm talking about `develop` that have been build 2h before it has been triggered. – J4N Jun 28 '18 at 13:56
  • And it says something like "triggered by branch indexing"? – StephenKing Jun 29 '18 at 05:03
  • The other builds have the name of the last commit. This one has just "Branch indexing" as title, so I guess. – J4N Jun 29 '18 at 05:28
  • 4
    Did you figure this out? I'm having the same issue, trying to disable this "Branch Indexing". I asked a Q here https://stackoverflow.com/questions/54334258/how-to-disable-branch-indexing – five_dollar_shake Jan 23 '19 at 19:29
  • @five_dollar_shake unfortunately no :( – J4N Jan 24 '19 at 06:07
  • It's probably this `Scan Organization Triggers` or `Child Scan Triggers`, from the explanation, it said `This trigger allows for a periodic fallback, but when necessary. If no indexing has been performed in the specified interval, then an indexing will be scheduled.` – Phootip Nov 21 '19 at 09:06

1 Answers1

2

In Jenkins, we can create a stage to abort branch indexing.

stage('Branch indexing: abort') {
            when {
                allOf {
                    triggeredBy cause: "BranchIndexingCause"
                    not { 
                        changeRequest() 
                    }
                }
            }
            steps {
                script {
                    echo "Branch discovered by branch indexing"
                    currentBuild.result = 'SUCCESS' 
                    error "Caught branch indexing..."
                }
            }
        }
Optimus
  • 37
  • 2