October 11-13, 2022

GitKon 2022

Git Integration for Jira Self-Managed (Data Center/Server) Documentation

Scheduling Jobs

Introduction

Scheduling jobs in the Git Integration for Jira app for Jira Server and Data Center (in the General settings page) gives Jira administrators control over when jobs run.

Scheduled jobs showing repository indexing and gc

Scheduling rule types
The Git Integration for Jira app for Jira Server and Jira Data Center uses the Atlassian Jira Scheduling API for scheduling jobs. These jobs can be scheduled in two ways:

  • Scanning interval: Schedule jobs on a regular interval in minutes. If the job is still running, the job will be skipped (and not added to a job queue).
  • Cron expression: Schedule jobs via cron expression to schedule the jobs to run at specific times on specific days. (Available starting in Git Integration version 3.7+)

We recommend that scheduled jobs be given sufficient time to run completely on a regular basis. Please see section, How to find out how long jobs are running.

Scheduled Jobs

Repository reindexing

JOB DESCRIPTION
When the repository reindexing job runs, the Git Integration for Jira app performs the following operations:

  1. Auto-Connect integrations (GitHub, GitLab, etc).

    a. Perform API call to git server requesting a list of available repositories;

    b. Clone/remove repositories based on a response from a git server;

    c. Git fetch changes for existing repositories;

    d. An API call requesting pull/merge requests; and lastly,

    e. Index commits from all repositories in the integration.

  2. Plain git repositories (single repository connections).

    a. Perform a git fetch changes for each enabled git repository; and then

    b. Index commits.

DEFAULT VALUE: 5 minutes

Job name in Jira Administration ➜ Scheduler Details:
com.bigbrassband.jira.git.jiraservices.jobs.RevisionIndexJob

Recommendations
We recommend that repository reindexing be scheduled no more often than necessary. Ideally, a repository reindexing is scheduled less often (1-2 times a day) and Webhooks are configured to trigger indexing of individual repositories. Reindexing can also be triggered using the Reindexing API.

For the most control over when reindexing jobs occur, disable webhooks and schedule the reindexing job using a cron expression for the desired time(s) of day.

Garbage collection and Revision validation checkers

JOB DESCRIPTION
The garbage collection job performs the ‘git gc’ calls on the cloned repositories copies. It also performs some cleanup and validation routines.

DEFAULT VALUE: 1440 minutes (once a day)

Job name in Jira Administration ➜ Scheduler Details:
com.bigbrassband.jira.git.jiraservices.jobs.GarbageCollectionJob

Recommendations
We recommend the Garbage collection and Revision validation checker’s job be run approximately once a day. Some of you may decide to run it less often and during a specific quiet period for your Jira server. Ideally, the job would be scheduled when other significant jobs are not scheduled.

How to find out how long the job takes to run

To understand how long the above jobs take to run:

  1. Navigate to the Jira Administration ➜ Scheduler Details page.

  2. Look up the Job name posted above.

  3. Expand the job name (show more) and observe the schedule, duration, last run, duration, and next run. The duration indicates how long the last scheduled job required to run completely (Note: manually or API reindexed jobs will not show here).

When the Reindex job duration is measured in a few tens of milliseconds, this means that the reindex job was still running from the last scheduled reindex job. We recommend that the scheduled job be given more time so that jobs do not overlap.

Data Center considerations

Job scheduling for the Git Integration app for Jira Data Center is generally the same compared to Jira Server, except for the following differences:

  • The reindexing job runs on a single Jira Data Center node (including API requests, git fetch requests, etc) and stores this data in the Jira Shared Storage (sharedhome). Then, each Jira Data Center node is notified to index the changes.

  • The Git Integration app schedules the jobs with the Atlassian Jira Scheduler. The Jira Scheduler controls which node carries out the reindexing job.

Have feedback about this article? Did we miss something? Let us know!
On this page