git-resource icon indicating copy to clipboard operation
git-resource copied to clipboard

submodule_recursive: false - doesn't seems to work - all submodules are fetched

Open sfroee opened this issue 4 years ago • 3 comments

Hello,

All attempts to use git resource and clone only first level of submodules fails Perhaps it's a mistake I made , but I really tried many variation with the pipeline syntax.

I created a simple test scenario to show this issue, Create a root repo with submodule child , and child repo with another two submodules grandchild-1 and grandchild-2

root |

child
grandchild-1 grandchild-2

then I created a pipeline (maintained in the root repo)with below syntax You can see my source in : https://github.com/sfroee/root

pipeline.yml:

`--- resources:

  • name: root type: git check_every: 5m source: uri: https://github.com/sfroee/root.git branch: master submodule_recursive: false

jobs:

  • name: test-submodules plan:
    • get: root params: submodule_recursive: false trigger: true
    • task: simple-task tags: [] timeout: 15m attempts: 1 config: platform: linux image_resource: type: docker-image source: repository: alpine tag: latest username: "" password: "" inputs: - name: root run: path: root/test.sh`

However when running this pipeline I see the git clone fetched all submodules including grandchilds This is the output of the fetch git resource:

=====

Cloning into '/tmp/build/get'... 469bb2a fix Submodule 'child' (https://github.com/sfroee/child) registered for path 'child' Cloning into '/tmp/build/get/child'... Submodule path 'child': checked out '1484c7198eda5698a3eded99b346e73587980d5c' Submodule 'grandchild-1' (https://github.com/sfroee/grandchild-1) registered for path 'child/grandchild-1' Submodule 'grandchild-2' (https://github.com/sfroee/grandchild-2) registered for path 'child/grandchild-2' Cloning into '/tmp/build/get/child/grandchild-1'... Cloning into '/tmp/build/get/child/grandchild-2'... Submodule path 'child/grandchild-1': checked out 'cf7f05605e583576db33c8b7ec0ba15ddf888e98' Submodule path 'child/grandchild-2': checked out '426e008e3d37d4915e8444c361ecc211a08d3a4e'

=====

then my task just print files (ls -R) and also shows all files were downloaded :

/tmp/build/eff7422d .: root

./root: README.md child pipeline.yml test.sh

./root/child: README.md grandchild-1 grandchild-2

./root/child/grandchild-1: README.md

./root/child/grandchild-2: README.md

=====

Hope I explained the issue well enough, if u have any question , please let me know Thanks an Regards Roy

sfroee avatar Mar 19 '20 15:03 sfroee

also seeing this on master

I was able to work around this by quoting false

submodule_recursive: "false"

sooncj avatar Mar 25 '20 20:03 sooncj

Thank You @sooncj

Using the quotes around the boolean value of false really did the work. It's still an issue to be solved , but at least the workaround is easy enough

for completeness, I updated the pipeline.yml file in my example to use the suggested solution, For anyone convenience ...

Thanks and Best Regards Roy

sfroee avatar Apr 03 '20 06:04 sfroee

hmm.. for me the workaround is not working :-(

benjaminguttmann-avtq avatar Nov 20 '20 14:11 benjaminguttmann-avtq