Reputation: 1598
I'm using bitbucket branch source plugin with a bitbucket team project which indexes whole bitbucket repos. Despite my jenkinsfile has checkout scm typed just once, jenkins does checkout before jenkinsfile even starts, how to disable it?
I need to use parameterized pipeline that is triggered remotely via "buildWithParameters" and one commit hash is passed to the pipeline. BUT the problem is bitbucket plugin launches its own checkout before the jenkinsfile which welcomes over 20-30 commits to the build which makes the second parameterized checkout useless.
What is also weird when this double checkout happens is that the second parameterized checkout often ends up with log entry:
> git rev-parse 19835cab351224455778899sdggscvhjkkknb42a3addfb^{commit} # timeout=10
while actually should do:
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
And thats all, just that one line in the log, nothing is executed. How to avoid the first checkout?
Upvotes: 3
Views: 1421
Reputation: 1005
I am new to Jenkins Pipelines but my understanding is Jenkins needs to fetch your github/bitbucket code first just to read the jenkinsfile and after reading the Jenkinsfile, it will execute your specific scm steps in the file.
There is an issue in Jenkins backlog to try to read the Jenkinsfile without doing a checkout.
Upvotes: 1
Reputation: 14047
you may be referring to the "Declarative: Checkout SCM" "stage". if so, skipDefaultCheckout, like this:
pipeline {
agent { label 'docker && git && rbenv' }
options {
skipDefaultCheckout true
}
...
Upvotes: 2