Disabling clones in pipelines steps

Bitbucket Pipelines executes a git clone of your repository before every step in your pipeline. This behavior is common as it lets you build your code or run your tests, however there are cases you might not need it. For example, you might have a deployment step that deploys a previously built artifact – performing a checkout of your repository in this instance would be unnecessary and a waste of time and build minutes.

Starting today you can skip the git clone operation in your pipeline by adding a clone section in your step configuration, with the property enabled:false.

  pipelines:
  default:
    - step:
        name: Build and Test
        script:
          - echo "building my artifact..."
        artifacts: my/artifact.zip
    - step:
        name: Deploy
        clone:
          enabled: false
        deployment: prod
        script:
          - echo "pushing my artifact to production..."

The enabled flag can also be specified in the top-level clone section, where it will disable git clone for every step. In case the enabled flag is specified at both the top and step-level, the step-level takes precedence when the pipeline is executed.

Happy coding!