• Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      We're using feature clone depth only for one specific custom pipeline. There only a way to configure this parameter globally, as result - for all other pipelines we have longer clone process.

      I suggest to add ability define or override value of clone depth on pipeline level.

          Form Name

            [BCLOUD-18006] Define clone depth per pipeline

            Raul Gomis added a comment -

            Hi everyone,

            Thanks for the feedback, we already support clone depth at step level, and also you can skip the git clone if you needed.

            Cheers,
            Raul

            Raul Gomis added a comment - Hi everyone, Thanks for the feedback, we already support clone depth at step level, and also you can skip the git clone if you needed. Cheers, Raul

            You can use it directly in step

                - step: &dummy
                    name: Dummy step
                    clone:
                      depth: 2
                    script:
                      - echo "Hello, I am pointless"

             

            Mateusz Przybyłek added a comment - You can use it directly in step     - step: &dummy         name: Dummy step         clone:           depth: 2         script:           - echo  "Hello, I am pointless"  

            Attachment 1695582845-Screenshot_20190416_103927.png has been added with description: Originally embedded in Bitbucket issue #18006 in site/master

            Sasa Jovanovic added a comment - Attachment 1695582845-Screenshot_20190416_103927.png has been added with description: Originally embedded in Bitbucket issue #18006 in site/master

            I came across this issue due to a code analysis step needing the master branch locally in order to be able to compare the new code against the existing master code. (SonarCloud was giving an error of “Could not find ref ‘master’ in refs/heads or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.“)

            Some notes on previous suggestions-

            • git fetch --unshallow origin doesn't work - I get an error of fatal: --unshallow on a complete repository does not make sense
            • The example given above checks out the master branch. I did not want this - I wanted my development branch checked, but for master branch to be available.

            My solution ended up being-

            - step:
              script:
                  - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
                  - git fetch --depth=10000 origin
                  - run-code-analysis
            

            Pat Macpherson added a comment - I came across this issue due to a code analysis step needing the master branch locally in order to be able to compare the new code against the existing master code. (SonarCloud was giving an error of “Could not find ref ‘master’ in refs/heads or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.“) Some notes on previous suggestions- git fetch --unshallow origin doesn't work - I get an error of fatal: --unshallow on a complete repository does not make sense The example given above checks out the master branch. I did not want this - I wanted my development branch checked, but for master branch to be available. My solution ended up being- - step: script: - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - git fetch --depth=10000 origin - run-code-analysis

            @ozbek
            I've first tried your solution, but it doesn't work for me

            After some research, I've found the root cause. I run pipelines from develop branch. In that case, clone command look like this

            #!bash
            
            GIT_LFS_SKIP_SMUDGE=1 git clone --branch="develop" --depth 50 https...
            
            

            On the link I've mentioned before, you can find the comment where Peter Cordes said
            This doesn't undo the --single-branch side effect.

            That's why I need a solution from the link

            Sasa Jovanovic added a comment - @ozbek I've first tried your solution, but it doesn't work for me After some research, I've found the root cause. I run pipelines from develop branch. In that case, clone command look like this #!bash GIT_LFS_SKIP_SMUDGE=1 git clone --branch= "develop" --depth 50 https... On the link I've mentioned before, you can find the comment where Peter Cordes said This doesn't undo the --single-branch side effect. That's why I need a solution from the link

            @sasa_jovanovic_esenca:

            The step git fetch --unshallow is working just fine. Why do you need the rest of the steps?

            Shuhrat Dehkanov added a comment - @sasa_jovanovic_esenca: The step git fetch --unshallow is working just fine. Why do you need the rest of the steps?

            Here's the workaround until this issue will be resolved.

            #!yml
            - step:
              script:
                - git fetch --unshallow
                - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
                - git fetch origin
                - git checkout --track origin/master
            

            I've found this on the link

            Sasa Jovanovic added a comment - Here's the workaround until this issue will be resolved. #!yml - step: script: - git fetch --unshallow - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - git fetch origin - git checkout --track origin/master I've found this on the link

            Aneita added a comment -

            Hi @ihor_sviziev,

            Thanks for reaching out and for the suggestion. I can see why this would be a useful option to have.

            Given our current priorities, this is unlikely to be something we support in the short term. In the meantime however, I'll open this ticket to gauge the interest of other users in seeing the same functionality.

            Aneita

            Aneita added a comment - Hi @ihor_sviziev, Thanks for reaching out and for the suggestion. I can see why this would be a useful option to have. Given our current priorities, this is unlikely to be something we support in the short term. In the meantime however, I'll open this ticket to gauge the interest of other users in seeing the same functionality. Aneita

              Unassigned Unassigned
              73e249dc7e91 ihor_sviziev
              Votes:
              14 Vote for this issue
              Watchers:
              16 Start watching this issue

                Created:
                Updated:
                Resolved: