Skip to content

essentialkaos/jira-reindex-runner

GitHub Actions CI Status GoReportCard Codebeat badge GitHub Actions CodeQL Status

InstallationUsageBuild StatusContributingLicense


jira-reindex-runner is an app for periodical running Jira re-index process.

Due to the lack of Jira functionality, it is impossible to check if a re-index is required or not. For using this app, you must have ScriptRunner add-on installed on your Jira instance. Then you have to create a new REST endpoint in ScriptRunner with the following code:

import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.DefaultReindexMessageManager

import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response

@BaseScript CustomEndpointDelegate delegate

reindexRequired(httpMethod: "GET", groups: ["jira-administrators"]) { MultivaluedMap queryParams, String body ->
  def rmm = ComponentAccessor.getComponent(DefaultReindexMessageManager.class)
  def msg = rmm.getMessageObject()

  if (msg == null) {
    return Response.ok(new JsonBuilder([required: false]).toString()).build();
  }

  return Response.ok(new JsonBuilder([required: true, user: msg.getUserName(), date: msg.getTime()]).toString()).build();
}

Using this endpoint, our app can check if re-index is required and run it.

Installation

From source

Make sure you have a working Go 1.19+ workspace (instructions), then:

go install github.com/essentialkaos/jira-reindex-runner
sudo yum install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm
sudo yum install jira-reindex-runner

Build Status

Branch Status
master CI
develop CI

Contributing

Before contributing to this project please read our Contributing Guidelines.

License

Apache License, Version 2.0