I am just starting with jenkins. And I am trying to run a build on a branch/master.
And all I am getting is Did not schedule build for branch: master
Here is the log:
Started by timer
[Sun Mar 05 18:23:43 NPT 2017] Starting branch indexing...
Connecting to https://bitbucket.org using [email protected]/****** (sameer_kattel)
Repository type: Git
Looking up sameer_kattel/protected-consumer for branches
Checking branch single_page_app from sameer_kattel/protected-consumer
Checking branch master from sameer_kattel/protected-consumer
‘Jenkinsfile’ found
Met criteria
Changes detected: master (null → b2e24fc7a3a3c68f84dddf69d2cedc79f8478bf3)
Did not schedule build for branch: master
Checking branch enable_cors_response_lamda from sameer_kattel/protected-consumer
Looking up sameer_kattel/protected-consumer for pull requests
[Sun Mar 05 18:23:45 NPT 2017] Finished branch indexing. Indexing took 2.1 sec
Finished: SUCCESS
How do I schedule a branch?? Here is my JenkinsFile
#!groovy
node {
currentBuild.result = "SUCCESS"
try {
stage 'Build'
checkout scm
dir(spa)
sh 'npm install'
sh 'ng build'
}
catch (err) {
currentBuild.result = "FAILURE"
echo 'failed'
throw err
}
}
Can some one point me to right direction??
Head over to your Jenkins instance and create a new item. Enter a name for the job, and select the “Multibranch Pipeline” option at the end of the screen. Then, click on the OK button. In the next screen, go to the “Branch sources” tab, click on the “Add source” button, and choose “Git” from the dropdown menu.
When the pipeline build starts, Jenkins uses the Jenkinsfile in that branch for build stages. SCM (Source Control) can be Github, Bitbucket, or a Gitlab repo. You can choose to exclude selected branches if you don't want them to be in the automated pipeline with Java regular expressions.
Go to the configuration settings of your multibranch pipeline and in the “Branch Sources” section click on the “Add property” and select the property, named “Suppress automatic SCM triggering“. This will prevent Jenkins from triggering the builds every time it discovers new branches.
A suggestion found in some old IRC logs is that the "Automatic branch project triggering" option has been set to something that doesn't match the branch you want built. Set that option appropriately so that your desired branch or branches will build automatically.
As oueftete's answer suggests, make sure the "Automatic branch project triggering" regex matches your branch.
What I didn't realize (after coming back to this page and rereading that answer multiple times over the last year and a half) is that, unlike in python, a blank regex does NOT match everything. If you want to build every branch, you have to put .*
in that field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With