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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.