Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Pull request pipeline doesnt respect clone depth

Z November 20, 2020

I have the following pipeline set up for pull requests: 

clone:
depth: 1
options:
max-time: 15

definitions:
services:
docker:
memory: 6144
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
size: 2x
clone:
depth: 1 # this doesnt work for some reason...
script:
- pipe: sonarsource/sonarcloud-scan:1.2.0
variables:
SONAR_TOKEN: $SONAR_TOKEN

pipelines:
pull-requests:
'**':
- step: *build-test-sonarcloud

The clone depth works fine for the custom/branch pipelines but not for the pull-request pipeline.

Ive tried setting clone enabled to false and that seems to apply fine so not sure why clone depth isnt being picked up.

1 answer

0 votes
Eddie Webbinaro
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 9, 2021

Pull Request pipelines use special checkout rules, as noted in the docs https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/

PR builds checkout the current branch and merge in the target branch. It is intended to mimic the state post-merge of complete branch histories.

Shallow clones sever the history prior to the number of commits specified.  Fine if you don't need the commit history, but of course git needs that history back to the point of divergence in order to merge correctly.  So shallow clone would then fail merge or worse have a different outcome than an actual merge to master later with full repos.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events