Renovate: Git submodules no longer being cloned

Created on 20 Nov 2020  路  17Comments  路  Source: renovatebot/renovate

What Renovate type, platform and version are you using?

Self-hosted
Bitbucket server
v 23.69.0 working
v 23.84.4 not working

Describe the bug

When renovating a repo with git submodules, Renovate is no longer cloning the git submodules.

I did see https://github.com/renovatebot/renovate/pull/7644, and have tried explicitly setting the new configuration option cloneSubmodules to true, but I still have the issue.

I note the message in the new version (23.84.4) that didn't occur previously:

DEBUG: git-submodules is disabled

Do we now have to switch on git-submodules beta feature?

Relevant debug logs

Working on v23.69.0

 INFO: Autodiscovered repositories
       "length": 1,
       "repositories": ["shar/user-service-python"]
DEBUG: No dangling containers to remove
 INFO: Repository started (repository=shar/user-service-python)
       "renovateVersion": "23.69.0"
DEBUG: Using localDir: /Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python (repository=shar/user-service-python)
DEBUG: initRepo("{
         "repository": "shar/user-service-python",
         "localDir": "/Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python"
       }") (repository=shar/user-service-python)
DEBUG: shar/user-service-python owner = SHAR (repository=shar/user-service-python)
DEBUG: resetMemCache() (repository=shar/user-service-python)
DEBUG: Setting npmrc (repository=shar/user-service-python)
DEBUG: checkOnboarding() (repository=shar/user-service-python)
DEBUG: isOnboarded() (repository=shar/user-service-python)
DEBUG: findFile(renovate.json) (repository=shar/user-service-python)
DEBUG: Initializing git repository into /Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python (repository=shar/user-service-python)
DEBUG: resetToBranch(development) (repository=shar/user-service-python)
DEBUG:  (repository=shar/user-service-python)
       "existingBranches": []
DEBUG: git fetch completed (repository=shar/user-service-python)
       "durationMs": 3665
DEBUG: Cloning git submodule at submodules/appcontroljavaapi (repository=shar/user-service-python)
DEBUG: Cloning git submodule at submodules/branchapi (repository=shar/user-service-python)
DEBUG: Cloning git submodule at submodules/codetovalueapi (repository=shar/user-service-python)
.... (and so on) ....

Not working on v23.84.4

 INFO: Autodiscovered repositories
       "length": 1,
       "repositories": ["shar/user-service-python"]
DEBUG: No dangling containers to remove
 INFO: Repository started (repository=shar/user-service-python)
       "renovateVersion": "23.84.4"
DEBUG: Using localDir: /Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python (repository=shar/user-service-python)
DEBUG: initRepo("{
         "repository": "shar/user-service-python",
         "localDir": "/Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python"
       }") (repository=shar/user-service-python)
DEBUG: shar/user-service-python owner = SHAR (repository=shar/user-service-python)
DEBUG: resetMemCache() (repository=shar/user-service-python)
DEBUG: Setting npmrc (repository=shar/user-service-python)
DEBUG: checkOnboarding() (repository=shar/user-service-python)
DEBUG: isOnboarded() (repository=shar/user-service-python)
DEBUG: findFile(renovate.json) (repository=shar/user-service-python)
DEBUG: Initializing git repository into /Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python (repository=shar/user-service-python)
DEBUG: git clone completed (repository=shar/user-service-python)
       "durationMs": 2764
DEBUG: latest commit (repository=shar/user-service-python)
       "latestCommitDate": "2020-11-19T17:03:14+11:00"
DEBUG: Setting git author name (repository=shar/user-service-python)
       "gitAuthorName": "renovate-bot"
<..snip..>
DEBUG: Matched 1 file(s) for manager docker-compose: tests/docker-compose.yml (repository=shar/user-service-python)
DEBUG: Matched 1 file(s) for manager dockerfile: scripts/Dockerfile (repository=shar/user-service-python)
DEBUG: git-submodules is disabled (repository=shar/user-service-python)
DEBUG: Matched 1 file(s) for manager pip_setup: setup.py (repository=shar/user-service-python)
DEBUG: Matched 1 file(s) for manager pipenv: Pipfile (repository=shar/user-service-python)
DEBUG: Matched 1 file(s) for manager poetry: pyproject.toml (repository=shar/user-service-python)
DEBUG: Matched 1 file(s) for manager setup-cfg: setup.cfg (repository=shar/user-service-python)
<..snip..>

To Reproduce

Sorry, my repo is "behind the firewall".

Additional context

I think perhaps the backward compatibility that was intended, has not happened due to git-submodule feature being switched off by default in beta?.. Maybe - I haven't been able to fully read and understand the code changes.

bitbucket-server priority-2-important reproduced bug

All 17 comments

Additional: I tested with the beta git-submodules support enabled, but it didn't alter the situation.

// config.js
module.exports = {
    cloneSubmodules: true,
    'git-submodules': {
        enabled: true,
    },
};

Are you using persistRepoData=true ?

In your first log there's a git fetch instead of clone, which implies that the repo data was already present on disk.

I don't have persistRepoData explicitly set - but it's possible it was on disk, as I was testing a bunch of times, and aborting some runs with ctrl+c .. which could have left the repo on disk

I'll do it again

v 23.69.0

$ rm -rf renovate-tmp && mkdir renovate-tmp
$ docker run --rm -it --user 0 --name=renobot --env-file env-file --env RENOVATE_DRY_RUN=true --env RENOVATE_AUTODISCOVER_FILTER='shar/user-service-python' -v "${RENOVATE_BASE_DIR}:${RENOVATE_BASE_DIR}" -e 'RENOVATE_BASE_DIR' -v /var/run/docker.sock:/var/run/docker.sock --env RENOVATE_DOCKER_USER=1000 --env RENOVATE_LOCK_FILE_MAINTENANCE='' renovate:23.69.0-slim
DEBUG: Using RE2 as regex engine
DEBUG: Parsing configs
<..snip..>
 INFO: Autodiscovered repositories
       "length": 1,
       "repositories": ["shar/user-service-python"]
DEBUG: No dangling containers to remove
 INFO: Repository started (repository=shar/user-service-python)
       "renovateVersion": "23.69.0"
DEBUG: Using localDir: /Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python (repository=shar/user-service-python)
DEBUG: initRepo("{
         "repository": "shar/user-service-python",
         "localDir": "/Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python"
       }") (repository=shar/user-service-python)
DEBUG: shar/user-service-python owner = SHAR (repository=shar/user-service-python)
DEBUG: resetMemCache() (repository=shar/user-service-python)
DEBUG: Setting npmrc (repository=shar/user-service-python)
DEBUG: checkOnboarding() (repository=shar/user-service-python)
DEBUG: isOnboarded() (repository=shar/user-service-python)
DEBUG: findFile(renovate.json) (repository=shar/user-service-python)
DEBUG: Initializing git repository into /Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python (repository=shar/user-service-python)
DEBUG: git clone completed (repository=shar/user-service-python)
       "durationMs": 3056
DEBUG: Cloning git submodule at submodules/appcontroljavaapi (repository=shar/user-service-python)
DEBUG: Cloning git submodule at submodules/branchapi (repository=shar/user-service-python)
DEBUG: Cloning git submodule at submodules/codetovalueapi (repository=shar/user-service-python)
<..snip..>

FYI cloning submodules should be independent of updating them

Yes, I agree.

It seems to have been that way until the recent changes.

One thing: please check that your git version is up to date. Latest version is 2.29.2. It's possible this problem is caused by that. If not..

  1. Run Renovate on this repo (newer/non-working version)
  2. Ctrl-C it some time after the git clone has been done
  3. Locate the clone directory (seems to be /Users/jayp/git/de/renovate/renovate-tmp/repos/bitbucket-server/shar/user-service-python) and then run git config --file .gitmodules --get-regexp path and paste the result here

It seems to have been that way until the recent changes.

You are misunderstanding this point. It's still independent now, it's just that one part stopped working for you.

Hi @rarkins,

The git version is 2.28.0 - but that is what is within the Docker Hub Renovate image that we use:

> docker run -it --rm --entrypoint='' renovate/renovate:23.84.8-slim git --version
git version 2.28.0

Here's the output of the git config:

> docker run -it --rm --entrypoint='bash' -v $(pwd):/mnt renovate/renovate:23.84.8-slim
$ cd /mnt/renovate-tmp/repos/bitbucket-server/shar/user-service-python/
$ git config --file .gitmodules --get-regexp path
submodule.submodules/appcontroljavaapi.path submodules/appcontroljavaapi
submodule.submodules/branchapi.path submodules/branchapi
submodule.submodules/codetovalueapi.path submodules/codetovalueapi
submodule.submodules/employeeapi.path submodules/employeeapi
submodule.submodules/organisationstructureapi.path submodules/organisationstructureapi
submodule.submodules/menuapi.path submodules/menuapi
submodule.test-scripts.path test-scripts

That seems compatible with our getSubModules() code: https://github.com/renovatebot/renovate/blob/67dc7b818ddfe6bee8662d540a4c8491aa434f2c/lib/util/git/index.ts#L192-L210

But if it returned values we should see debug lines after that:

https://github.com/renovatebot/renovate/blob/67dc7b818ddfe6bee8662d540a4c8491aa434f2c/lib/util/git/index.ts#L268-L276

@ps-jay can you replicate this in a public repo? It hopefully shouldn't matter where the submodules point to, just that it tries (e.g. prints the debug statement).

Yup. I'll give it a go on Wednesday.

Hi again,

I've setup a basic test repo that illustrates the behaviour: https://github.com/ps-jay/has-submod

v23.69.0 - working okay

$ rm -rf renovate-tmp && mkdir renovate-tmp

<..SNIP..>

 INFO: Repository started (repository=ps-jay/has-submod)
       "renovateVersion": "23.69.0"
DEBUG: Using localDir: /Users/jayp/git/de/renovate/renovate-tmp/repos/github/ps-jay/has-submod (repository=ps-jay/has-submod)
DEBUG: initRepo("ps-jay/has-submod") (repository=ps-jay/has-submod)
DEBUG: Overriding default GitHub endpoint (repository=ps-jay/has-submod)
       "endpoint": "https://api.github.com/"
DEBUG: ps-jay/has-submod default branch = main (repository=ps-jay/has-submod)
DEBUG: Using personal access token for git init (repository=ps-jay/has-submod)
DEBUG: resetMemCache() (repository=ps-jay/has-submod)
DEBUG: Setting npmrc (repository=ps-jay/has-submod)
DEBUG: checkOnboarding() (repository=ps-jay/has-submod)
DEBUG: isOnboarded() (repository=ps-jay/has-submod)
DEBUG: findFile(renovate.json) (repository=ps-jay/has-submod)
DEBUG: Initializing git repository into /Users/jayp/git/de/renovate/renovate-tmp/repos/github/ps-jay/has-submod (repository=ps-jay/has-submod)
DEBUG: git clone completed (repository=ps-jay/has-submod)
       "durationMs": 2719
DEBUG: Cloning git submodule at spindown (repository=ps-jay/has-submod)
DEBUG: Cloning git submodule at pguest (repository=ps-jay/has-submod)
DEBUG: latest commit (repository=ps-jay/has-submod)
       "latestCommitDate": "2020-11-25T08:39:01+11:00"

<CTRL+C>

$ ls -la renovate-tmp/repos/github/ps-jay/has-submod/pguest/
total 20
drwxr-xr-x 5 jayp FOO\Domain Users   160 Nov 25 08:40 .
drwxr-xr-x 8 jayp FOO\Domain Users   256 Nov 25 08:40 ..
-rw-r--r-- 1 jayp FOO\Domain Users    31 Nov 25 08:40 .git
-rw-r--r-- 1 jayp FOO\Domain Users   869 Nov 25 08:40 README.md
-rwxr-xr-x 1 jayp FOO\Domain Users 11849 Nov 25 08:40 pguest

v23.84.8 - not working

$ rm -rf renovate-tmp && mkdir renovate-tmp

<..SNIP..>

 INFO: Repository started (repository=ps-jay/has-submod)
       "renovateVersion": "23.84.8"
DEBUG: Using localDir: /Users/jayp/git/de/renovate/renovate-tmp/repos/github/ps-jay/has-submod (repository=ps-jay/has-submod)
DEBUG: initRepo("ps-jay/has-submod") (repository=ps-jay/has-submod)
DEBUG: Overriding default GitHub endpoint (repository=ps-jay/has-submod)
       "endpoint": "https://api.github.com/"
DEBUG: ps-jay/has-submod default branch = main (repository=ps-jay/has-submod)
DEBUG: Using personal access token for git init (repository=ps-jay/has-submod)
(node:6) DeprecationWarning: Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.
(Use `node --trace-deprecation ...` to show where the warning was created)
DEBUG: resetMemCache() (repository=ps-jay/has-submod)
DEBUG: Setting npmrc (repository=ps-jay/has-submod)
DEBUG: checkOnboarding() (repository=ps-jay/has-submod)
DEBUG: isOnboarded() (repository=ps-jay/has-submod)
DEBUG: findFile(renovate.json) (repository=ps-jay/has-submod)
DEBUG: Initializing git repository into /Users/jayp/git/de/renovate/renovate-tmp/repos/github/ps-jay/has-submod (repository=ps-jay/has-submod)
DEBUG: git clone completed (repository=ps-jay/has-submod)
       "durationMs": 4733
DEBUG: latest commit (repository=ps-jay/has-submod)
       "latestCommitDate": "2020-11-25T08:39:01+11:00"

<CTRL+C>

$ ls -la renovate-tmp/repos/github/ps-jay/has-submod/pguest/
total 0
drwxr-xr-x 2 jayp FOO\Domain Users  64 Nov 25 08:47 .
drwxr-xr-x 8 jayp FOO\Domain Users 256 Nov 25 08:47 ..

I've tried narrowing down the version where it stopped working.
23.69.0 - working
23.70.0 - working
23.72.0 - not working

Possibly related to https://github.com/renovatebot/renovate/pull/7644 ?

@ps-jay Thanks for the investigation. I'll start looking into it.

@JamieMagee IIRC we merged some refactoring PRs prior to #7644 so it's possibly one of those

:tada: This issue has been resolved in version 23.89.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

jeromelachaud picture jeromelachaud  路  3Comments

Siilwyn picture Siilwyn  路  4Comments

Flydiverny picture Flydiverny  路  4Comments

jgarec picture jgarec  路  3Comments