Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

hmcts/dtsse-dashboard-jira-ingestion

Repository files navigation

dtsse-dashboard-jira-ingestion

K8S job to import stats from JIRA to the DTSSE dashboard database.

Getting Started

Prerequisites

Running the script requires the following tools to be installed in your environment:

Running the script

Install dependencies by executing the following command:

$ yarn install

Run:

$ yarn start

Local environment variables

To run the script locally you will need some environment variables set in .env:

JIRA_TOKEN=[your PAT token]
DATABASE_URL=postgres://localhost:5432/dashboard

You will also need to have a local postgres database running on port 5432 with a database called dashboard and a schema called jira.

Developing

Queries

All queries in ./src/main/query will be executed and the rows returned will be persisted in the database. The store function expects a table with the file name of the query to have been created with the migration scripts. Hyphens will be converted to underscores, so results from query/issue.ts will be stored in the issue table.

To run an individual query use:

yarn start:dev [your-query-file-name] # e.g. yarn start:dev issue

Migrations

Run: yarn migration:create [name] to create a new migration.

Migrations are automatically run when before the queries are executed.

To roll back a migration run: Run: yarn migration:down [name]`.

Code style

We use ESLint

Running the linting with auto fix:

$ yarn lint --fix

Running the tests

This template app uses Jest as the test engine. You can run unit tests by executing the following command:

$ yarn test

License

This project is licensed under the MIT License - see the LICENSE file for details