Status Update
Comments
ed...@google.com <ed...@google.com> #2
The current workaround would be to also mirror the submodule repositories into Cloud Source Repositories separately from the main GitHub repository.
- If relative URLs are used in .gitmodules file, they will automatically be resolved relative to the parent project. This avoids needing to rewrite anything.
- If absolute URLs are used, the builder could use url.insteadOf in ~/.gitconfig to remap URL associations. Or preconfigure entries in the parent project's .git/config using submodule.NAME.url (by cloning the parent without --recursive), and then running 'git submodule update'.
I hope this is workaround is helpful. There is currently no available ETA for the feature implementation as of yet.
[1]
[Deleted User] <[Deleted User]> #3
however the workaround mentioned here does not work, as the build asset sent to CloudBuild from the Github CI App on github is not a repository.. unless I am missing something, this is the output of my test repo build with submodule [2]:
=============================================================================
starting build "fa2c589c-ddee-4ebf-8e8a-5d9579fb89b1"
FETCHSOURCE
Fetching storage object: gs://
Copying gs://
/ [0 files][ 0.0 B/ 559.0 B]
/ [1 files][ 559.0 B/ 559.0 B]
Operation completed over 1 objects/559.0 B.
BUILD
Starting Step #0
Step #0: Already have image (with digest):
Step #0: /workspace:
Step #0: total 24
Step #0: drwxr-xr-x 3 root root 4096 Aug 19 22:24 .
Step #0: drwxr-xr-x 1 root root 4096 Aug 19 22:24 ..
Step #0: -rw-rw-r-- 1 root root 0 Aug 19 22:23 .gcloudignore
Step #0: -rw-rw-r-- 1 root root 110 Aug 19 22:23 .gitmodules
Step #0: -rw-rw-r-- 1 root root 58 Aug 19 22:23 README.md
Step #0: -rw-rw-r-- 1 root root 283 Aug 19 22:23 cloudbuild.yaml
Step #0: drwxrwxr-x 3 root root 4096 Aug 19 22:23 submodules
Step #0:
Step #0: /workspace/submodules:
Step #0: total 12
Step #0: drwxrwxr-x 3 root root 4096 Aug 19 22:23 .
Step #0: drwxr-xr-x 3 root root 4096 Aug 19 22:24 ..
Step #0: drwxrwxr-x 2 root root 4096 Aug 19 22:23 test-module
Step #0:
Step #0: /workspace/submodules/test-module:
Step #0: total 8
Step #0: drwxrwxr-x 2 root root 4096 Aug 19 22:23 .
Step #0: drwxrwxr-x 3 root root 4096 Aug 19 22:23 ..
Finished Step #0
Starting Step #1
Step #1: Already have image (with digest):
Step #1: cat: /workspace/submodules/test-module/README.md: No such file or directory
Finished Step #1
ERROR
ERROR: build step 1 "
==================================================================================
as you can see from the build output, the step that runs the `ls -la -R /workspace` does not list any git repository.. So I have no idea how the workarounds could possibly work, as I constantly just get:
Step #2: Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Step #2: fatal: not a git repository (or any parent up to mount point /)
Whenever I attempt to use any `git` command in the cloudbuild spec.
Is there any actual workaround for this currently? or is the entire thing just broken for repos with submodules?
[1]
[2]
ru...@gmail.com <ru...@gmail.com> #4
ja...@google.com <ja...@google.com> #5
I also had a hard time getting this to work recently I think because the .git
dir is not there. I was able to make it work by parsing the .gitmodules
file and manually cloning the repo, but I only did that for my usecase (which is not a general workaround). I'm sure someone can come up with a general bash-based workaround. Here is my step:
- name: 'gcr.io/cloud-builders/git'
entrypoint: '/bin/sh'
args:
- '-c'
- |
# Get the theme git submodule
THEME_URL=$(git config -f .gitmodules --get-regexp '^submodule\..*\.url$' | awk '{ print $2 }')
THEME_DIR=$(git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | awk '{ print $2 }')
rm -rf themes
git clone $$THEME_URL $$THEME_DIR
jd...@mtbpower.com <jd...@mtbpower.com> #6
cn...@google.com <cn...@google.com> #7
The .git
directory has been present for some time now, which enables additional use cases.
There is additional work underway to provide more flexibility to how the initial git clone
is performed.
jz...@gmail.com <jz...@gmail.com> #8
sa...@66degrees.com <sa...@66degrees.com> #9
ru...@gmail.com <ru...@gmail.com> #10
We have an external submodule that is based on another GitHub repository, I set it up to be mirrored with a Cloud Source Repository. Then, in my Cloud Build step:
```
- id: '⏬️ Clone submodules'
name: '
entrypoint: 'bash'
env: ['GIT_DISCOVERY_ACROSS_FILESYSTEM=1']
args:
- '-c'
- |
git init
git submodule set-url my-gh-org/repo-name
git submodule init
git submodule update --init --recursive
echo "🦄 Submodules pulled."
```
Essentially, we just replace the local reference to Cloud Source Repository and it works just fine. Would be great if Google could provide an official update in the meantime though.
ar...@gmail.com <ar...@gmail.com> #11
ru...@gmail.com <ru...@gmail.com> #12
se...@ondeck-ai.com <se...@ondeck-ai.com> #13
ad...@cinnamon.health <ad...@cinnamon.health> #14
Any updates here? I am trying to use Cloud build with bitbucket and none of these workarounds work for me. I have both repo's synced in Cloud Repositories and change the url, but the git submodule update --init --recursive
command doesn't actually pull the repo down.
va...@google.com <va...@google.com>
bu...@gmail.com <bu...@gmail.com> #15
ku...@google.com <ku...@google.com>
ba...@google.com <ba...@google.com>
ku...@google.com <ku...@google.com> #16
Hello,
We’ve received an update from the product management team.
The team is aware of this limitation but releasing native submodule integration is not on their roadmap at this time. Further the team suggested, one workaround that is available is to create a webhook trigger that does not automatically clone a git repository. In this case, you will have full control over the git clone operation and can pull submodules into your build. You can find examples of how to define the build config here:
Please note that there are no ETAs or guarantees of implementation for feature requests. However, rest assured, all communication regarding this feature request is to be done here.
Kind regards.
za...@deepshot.org <za...@deepshot.org> #17
Thanks
Description