Skip to main content

Format and upload Watson time logs to Jira as Tempo worklogs

Project description

CircleCI

Watson-Jira (next)

Upload Watson time logs to Jira from the CLI! Selects Watson time logs based on the configurable mapping rules, formats those logs to Tempo format, and uploads to the appropriate Jira issues. Will not double-write logs, and makes no local edits.

This fork from original project. Unfortunately original author doesn't reply. Please use this repository to open issues or pull requests.

Install

$ pip install watson-jira-next

Config

Config is stored in $XDG_CONFIG_HOME/.config/watson-jira/config.yaml.

JIRA

jira section should contain JIRA base URL and one of the authentication methods.

server: <<JIRA base URL>>

Auth: API token

See Atlassian docs. Add the following to the config file:

email: <<email>>
apiToken: <<API token>>

Auth: Personal Access Token

See Atlassian docs. Add the following to the config file:

personalAccessToken: <<PAT>>

Auth: Cookie

  1. login to JIRA in the browser
  2. open Network tab in the developer tools
  3. copy the cookie from the request header
  4. add the following to the config file:
cookie: <<cookie>>

Mappings

mappings section contains list of mapping rules.

Mapping rule has name and type. For each Watson log, Watson-Jira tries to find the name in the tags. If found, then the JIRA issue number is resolved according to the type definition.

Mapping precedence is of the following order:

Single issue

name: vacation
type: single_issue
issue: JIRA-1

This type always returns the one specified JIRA issue number.

Watson example: watson add -f 10:00 -t 18:00 none +vacation

Issue per project

name: maintenance
type: issue_per_project
projects:
  project1: JIRA-2
  project2: JIRA-3

This type returns JIRA issue number based on the project name.

Watson example: watson add -f 10:00 -t 11:00 project2 +maintenance +dependencies-upgrade

Issue specified in the tag

name: sprint
type: issue_specified_in_tag

This type resolves the JIRA issue number from the first tag which matches the issue number regex.

Example: watson add -f 10:00 -t 11:00 project1 +sprint +JIRA-123 +code

Issue specified in the project name

For any Watson log, which doesn't match any of the mappings, the JIRA issue number will be tried to be resolved from the project name.

Watson example: watson add -f 10:00 -t 11:00 JIRA-123 +investigation

Full config example

jira:
  server: http://localhost:8080
  cookie: atlassian.xsrf.token=BEHZ-5GE9-RXNS-7J78_bfa98881ae96448d36fdaa94f2b3ac6b8f205885_lout; JSESSIONID=51D8547A4C356A8355F8FDAF7CC97D51
mappings:
  - name: sprint
    type: issue_specified_in_tag
  - name: vacation
    type: single_issue
    issue: HR-123
  - name: maintenance
    type: issue_per_project
    projects:
      project1: JIRA-1
      project2: JIRA-2

Usage

Show Jira-specific logs from today

$ watson-jira logs --jira-only --tempo-format

Show existing work logs for a Jira issue

$ watson-jira logs tempo --issue JIRA-1

Upload logs from today interactively

$ watson-jira sync --from 3 --interactive

Upload logs from the last 3 days

$ watson-jira sync --from 3

Help

$ watson-jira --help

Will install TD-Watson https://github.com/TailorDev/Watson as one of its dependencies, not surprisingly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

watson_jira_next-0.3.2.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

watson_jira_next-0.3.2-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file watson_jira_next-0.3.2.tar.gz.

File metadata

  • Download URL: watson_jira_next-0.3.2.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for watson_jira_next-0.3.2.tar.gz
Algorithm Hash digest
SHA256 3ea16faf7890e2cc6a2e2c8d2f1e8fd99c6eaaad6798dc93bbd00f497662c714
MD5 592ba078ffa690dada77e4434efc6238
BLAKE2b-256 c6d84b179990881bdd5d623d4a45a5863bc9ca87679f2a07ca26ce33eba40f36

See more details on using hashes here.

File details

Details for the file watson_jira_next-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: watson_jira_next-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for watson_jira_next-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9efef2bab9da8f933c09bc3e4d6a82265f8ccb18137ee91946686c70358cc2ac
MD5 b64ff1a57441d9aba7cc1b256af84fae
BLAKE2b-256 d6ae0251f333dc18ec907956c618c5e0f1d072039f439989c2a32a85621b61c3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page