Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Source Repository makes only a shallow clone?

Our code is hosted on GitHub. We are using Google Cloud Container Builder in order to build and package our software. In order to do that, we had to connect our private repo to Google Cloud Source Repository. Unfortunately it seems that the mirror is a shallow clone, because our dev tools are complaining about it. e.g. SonarQube cannot fetch blame for certain files.

Documentation:

Connected repositories

If you already have a repository on GitHub or Bitbucket, you can connect it to your Cloud Source Repository. Connected repositories are synchronized with the Cloud Source Repository automatically.

Is there a way how to increase the depth of the clone? Or how to make a full clone?

like image 978
Michal Avatar asked Oct 18 '25 18:10

Michal


1 Answers

As described here

To build your source on a Git repo, Cloud Build performs a shallow clone of the repo. This means that only the single commit that started the build is checked out in the workspace to build. Cloud Build does not check out any other branches or history. This is done for efficiency, so that builds don't have to wait to fetch the whole repository and history just to build a single commit.

If you want to include more of your repo's history in the build, add a build step in your build config file to "unshallow" the clone. For example

steps:
- name: gcr.io/cloud-builders/git
  args: ['fetch', '--unshallow']
...
like image 112
ALOToverflow Avatar answered Oct 20 '25 08:10

ALOToverflow