Submodules - how does it work?

Git Submodules allow you to keep a git repository as a subdirectory of another git repository. They are helpful to maintain a shared configuration file for your team, that can then be applied to multiple git repositories.

Codacy supports this workflow for GitHub, Bitbucket (not Stash/Bitbucket Server) and GitLab.

Unfortunately, enabling this feature causes repositories with submodules to stop being reviewed! For that reason, only our support agents can enable it. So if you’re interested contact us and we‘ll help you get started.

Note: Some tools don’t search for configuration files recursively. You may need to include a configuration file in the root of your repository referencing the configuration file in the submodule.

 


 Enabling submodules (Enterprise)

We just enabled submodules for you. First of all, you’ll need to update licenseNow, if your submodules are public repositories make sure their url is using the https protocol. That’s all you’ll need.

Otherwise, if your submodules are private repositories, make sure their url is using the SSH protocol. If you already have projects added on Codacy that have submodules, for each one:

  1. Navigate to the Project Settings tab
  2. Click the ‘Generate New User Key’ button

Screen_Shot_2018-06-01_at_16.15.20.png

You’ll need to remember to repeat these steps every time you’re adding new projects to Codacy that have submodules. Alternatively, you can make this the default behaviour by turning on ‘Add project key to the user’ in Administration Settings.

 

Screen_Shot_2018-06-01_at_17.19.53.png

How does it work?

When you add a project to Codacy, it generates a new SSH key that is added to your repository using a GitHub/Bitbucket/GitLab integration. Every time Codacy needs to clone that repository that key will be used. If you are using submodules, Codacy will need to clone an additional repository which it has no access to. Since there is no way to identify the submodules of repository before cloning it, to make sure Codacy keys have the required access to a repository and all its submodules, it’ll add the SSH keys to the user’s account, thus having access to all repositories the user has.

 


Enabling submodules (Cloud)

We just enabled submodules for you (after your request). Now, if your submodules are public repositories make sure their url is using the https protocol. That’s all you’ll need.

Otherwise, if your submodules are private repositories, make sure their url is using the ssh protocol. If you already have projects added on Codacy that have submodules, for each one:

  1. Navigate to the Project Settings tab
  2. Click the ‘Generate New User Key’ button

Screen_Shot_2018-06-01_at_16.15.20.png

 

How does it work?

When you add a project to Codacy, it generates a new SSH key that is added to your repository using a GitHub/Bitbucket/GitLab integration. Everytime Codacy needs to clone that repository that key will used. If you are using submodules, Codacy will need to clone an additional repository which it has no access to. Since there is no way to identify the submodules of repository before cloning it, to make sure Codacy keys have the required access to a repository and all its submodules, it’ll add the SSH keys to the user’s account, thus having access to all repositories the user has.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.