Skip to main content
Skip table of contents

How to utilize Jigit for enterprises

Some customers have thousands of repositories that need to be scanned in Jira, but using one configuration makes it slow and can take several days to consume the data.

Tips to improve the indexation process

1. Use multiple configurations.

Try to use multiple configurations that use different users' tokens and cover a specific set of repositories.

GitLab

For GitLab, it can be configurations where every configuration handles some group of repositories.

GitHub

Try to use “GitHub App” for integration. GitHub App usually has a bigger request limit and GitHub App can be used for some subset of repositories which can be extended or narrowed.

5c6bba5f-2f5c-47d9-9936-e42bfcbcb325.png

See:
https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app
https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/managing-private-keys-for-github-apps

For instance, for 50K repositories, there can be created 5 GitHub Apps, each of which is linked to the 10K repositories.
Repositories can be added manually via UI:

39bfcb14-1ae1-4ae6-aa0b-278cea8220fe.png

Or adding repositories can be automated via GitHub REST API: https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#add-a-repository-to-an-app-installation

CODE
curl -L \
  -X PUT \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/user/installations/1/repositories/REPOSITORY_ID

To get all repositories in the organization the following API can be used: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-organization-repositories

CODE
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/orgs/ORG/repos

2. Group repositories by name.

If grouping by GitLab groups or GitHub App repositories is not a solution try to use a repositories pattern to restrict the number of repositories per configuration.
Regexp is a Java-based syntax https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html. To combine multiple patterns use “|“

daee4ebe-a697-4d29-908a-654f11191da8.png

3. Use “selected branches” branch indexation mode.

Try to avoid the “all branches” branch indexation mode. Due to the development process, sooner or later, feature and bug-fixing branches are merged into the main branch (main/master) via pull requests. During the merge process changes can be squashed and the branch is deleted or the changes can be rejected and the branch is abandoned. Indexing all branches brings more extra work for the plugin and irrelevant data which does not exist in the Git anymore. Try to index only long-living branches.

Use:

46982750-3878-484b-8175-c4306023758a.png
416efce0-a2c0-40b7-82b0-c119c35ab731.png

In case long-living branches are varied in the repositories, a branch mask can be used:

4d8c6de9-9968-475b-bd35-d9c8110105aa.png

“master|dev.*|release.*|.*feature.*” - indexes “master“, branches start with “dev”, “release” and ones which contain “feature“.

4. Avoid mixing configurations for the Development panel and commit indexation.

If it is possible try to create different configurations that use different users' tokens (GitHub Apps) for the commit indexation and Development panel. Because commit and branch indexation are different tasks that run on their own. There can be a race condition between who takes the allowed amount of requests - commit indexation might start first and when branch indexation starts no more requests can be allowed.

Commits only indexation configuration:

e66d0b02-8f28-4c4b-b7b5-09d709888422.png

Branch and pull-request indexation configuration:

56172dc0-46fc-47a3-be55-efc089e921ad.png

If different configurations for commits and the Development panel are not a solution for you, then try first to create a “Use only for Development panel“ configuration and allow it to run a few indexation iterations and then enable it for the commit indexation:

091235d5-5a99-4489-b344-1126b439d780.png

Branch indexation can be tracked on a main configuration page:

e8779591-65fa-49a1-aa0b-eb8481c07602.png

154/154 means “processed repositories count“/”total repositories count”.

5. Use Webhooks

Only works when the Git system can reach the Jira instance.

Using webhooks reduces the pressure on the plugin and brings the changes into the Jira as soon as they happen on the GitLab/GitHub side. Webhooks help to get new commits, pull requests and branches.
Use the URL displayed on the global configuration page or substitute it with the one which is reachable from the internet:

2781c036-a2c3-44c1-bee3-cc93abbdbb42.png

Webhook secret can be any value but this value should be used on the Git side as well.

GitLab webhooks:

fffab5c6-8f66-4fd9-aa7f-3316eb8a3a75.png

GitHub webhooks can be configured on a repository, organization or GitHub App level:

b8416d75-62a1-4cb4-8c13-2031d5993a7d.png
72fe7666-d5ce-4f4d-abdf-6f7eadce8d8c.png
71b888ce-7a8d-4f2b-9d29-bdab6f7f38ff.png

The plugin handles only events for the repositories handled by the configurations. If no configuration is found for the repository event then this event is skipped.

6. Use project-level configurations instead of Global configurations.

Because global level configurations affect all the Jira projects and it might not be required to have integration in all Jira projects, it’s strongly advised to create Jigit configurations by Jira project admins and include only those Git repositories which are required for the particular Jira project:

2ec65a82-a398-476f-ad8f-099b00441c0b.png

It also solves the issue with request throttling because each Jira project admin uses their own PAT in the configurations.

7. Using Git user permissions.

Usually, it’s not desirable that Jira users can see all the data from the repositories they do not have access to. For this case, the plugin can require that each user maps their token with some configuration.

Global Development panel settings:

5d3fbc34-7391-4fcc-80f0-30a0a366009a.png

User profile page:

3b6e189a-d9de-4050-893b-8af0d4152aef.png
b33e78e5-55a7-4429-986a-20c4e34b066d.png

This solution has big disadvantages in performance because each data from the repository should be checked for user Git permissions via REST call to the Git system.

Each branch and the pull-request repository are checked to ensure whether the user has access to the repository using their PAT. Also when the user tries to create a branch or pull request user permissions should be checked for the repository dropdown list:

2ef3b971-f22f-48da-a78a-bfa2e74d88e3.png

Updated:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.