I have integrated Jenkins with Bitbucket using the Bitbucket Plugin. As per the plugin's Wiki, a given job will be triggered if the repository is set in the SCM of the job. As you know, if one set SCM in a Jenkins job, this is cloned in pre-build stage.

So far so good. However, the main purpose of the job I'm setting has nothing to do with the repository's content; instead, I just want the job to process the payload sent by Bitbucket. One could say it's not a big deal in terms of storage to clone a repository despite you really don't need it. I don't think so, adding unnecessary steps, consuming time and resources is not a good practice.

So, the question is: Does anyone know how to set an SCM in a Jenkins job but prevent it to clone the repository?

  • 2
    It sounds like you're trying to use Jenkins as a micro service which is kind of out of the scope of Jenkins :). Do post back if you get this working though because it is interesting. Commented Mar 29, 2017 at 16:33
  • I'm not using Jenkins as a micro service. Why do you say that? In reality, all of this is a work around: I'm using a Pipeline Job which is common to many repositories. Jenkinsfile is in a different repository. Thus, I can't trigger the pipeline directly with the Bitbucket Plugin because it just don't trigger it, so I decided to create a "proxy job" per repo, and send the information to the pipeline as a downstream job. In such "proxy job" I don't need to clone the repo, but it needs to be in SCM. Commented Mar 29, 2017 at 16:39
  • It is very hard to understand and you write more about what is impossible than about what you actually want to achieve, Maybe you can add more details about what you are actually want to achieve and how your proxy jobs fit in there? Commented Apr 24, 2017 at 19:45
  • I guess you're talking about my comment above. It's just an answer to the first comment. Please refer to the main question, there is nothing else to add. What I want you achieve is very clear: "Prevent Jenkins to clone a repository during the build". Commented Apr 24, 2017 at 23:08
  • 1
    @HéctorValverdePareja Sure, but your wording seems to hesitate between A/giving enough details so that everybody can check if you're in a XY-problem situation and B/just to focus on the precise thing you want to achieve. I think (opinion) you could remove this hesitation by describing carefully enough your original problem and the solution you are trying to implement. But now that someone wrote an answer, this might be not so important anymore. Commented Apr 29, 2017 at 18:40

3 Answers 3


Yes, definitely. I do this all the time. You can specify configuration options for your pipeline and one of them is skipDefaultCheckout, which causes pipeline to skip the default "Declarative: Checkout SCM" stage.

The skipDefaultCheckout option is documented in Pipeline Syntax and here's an example Jenkinsfile showing how to use it:

pipeline {
  agent { label 'docker' }
  options {
    skipDefaultCheckout true
  stages {
    stage('commit_stage') {
      steps {
        echo 'sweet stuff here'
  • 1
    How would you the. Manually clone the repository in a stage?
    – oz123
    Commented Sep 10, 2017 at 5:11
  • 2
    you can run checkout scm to manually clone where you need to. see devops.stackexchange.com/a/1916/2450.
    – burnettk
    Commented Sep 11, 2017 at 2:29

In case you're not using the Declarative Pipeline, you can avoid checking out from SCM by:

node {
  • 2
    Could you add a link to the documentation and explain more about skipDefaultCheckout()?
    – 030
    Commented Oct 6, 2017 at 11:36
  • I don't see any added value compared to existing answer, that's just a 'try this' with no explanation and not a good answer.
    – Tensibai
    Commented Oct 6, 2017 at 12:05
  • 1
    This answer is fine as a supplement to the accepted answer - not everyone will be using the declarative Pipeline plugin, so this works for those using the procedural one.
    – RichVel
    Commented Nov 23, 2017 at 13:53

I think what you want to achieve is processing a webhook payload in a Jenkins job. Using bitbucket plugin won't be necessary and it is probably strongly designed to clone the repo.

I belive this stackoverflow answer could help you.

  • Please include a relevant quote from that linked answer ...
    – Pierre.Vriens
    Commented Apr 28, 2017 at 21:43
  • 1
    Welcome to DevOps! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Commented Apr 28, 2017 at 22:22
  • 1
    @RichardSlater I'm not sure about the policy on DevOps, but other sites make an exception for in-network links.
    – chicks
    Commented Apr 29, 2017 at 0:06
  • 3
    @chicks even StackOverflow links are subject to link rot and by summarising the question it gives a clear indication to other reasons why the answerer believes the question is answered by the link. Commented Apr 29, 2017 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.