Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opsgenie functionality ported to jira:// #1273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

caronc
Copy link
Owner

@caronc caronc commented Jan 18, 2025

Description:

Related issue (if applicable): #1272

JIRA API support added to allow those who used Opsgenie to continue to do so after Atlassian's acquisition of it.

Syntax

The syntax is as follows:

  • jira://{apikey}/
  • jira://{apikey}/@{user}
  • jira://{apikey}/@{user1}/@{user2}/@{userN}
  • jira://{apikey}/*{schedule}
  • jira://{apikey}/*{schedule1}}/*{schedule2}/*{scheduleN}
  • jira://{apikey}/^{escalation}
  • jira://{apikey}/^{escalation1}/^{escalation2}/^{escalationN}
  • jira://{apikey}/#{team}
  • jira://{apikey}/#{team1}/#{team2}/#{teamN}

Note: If no prefix character is specified, then the target is presumed to be a user (an @ symbol is presumed to be in front of it).

You can also mix/match the targets:

  • jira://{apikey}/@{user}/#{team}/*{schedule}/^{escalation}

Parameter Breakdown

Variable Required Description
apikey Yes This is the API Key associated with your Jira account.
user No The user you wish to notify; this can be a username, email, or uuid4. This is the assumed default target type to notify, but it is advised you prefix all users with a @ symbol to eliminate any ambiguity.
team No The team you wish to notify; this can be the team name itself, or or uuid4 associated with it.
Note: Teams must be prefixed with a # symbol.
schedule No The schedule you wish to notify; this can be the schedule name itself, or or uuid4 associated with it.
Note: Schedules must be prefixed with a * symbol.
escalation No The escalation you wish to notify; this can be the escalation name itself, or or uuid4 associated with it.
**Note:**Escalations must be prefixed with a ^ symbol.
region No The 2 character region code. By default this is set to us if not specified. Europeans must set this to eu to work correctly.
Note: This was ported over from the legacy Opsgenie plugin for backwards compatibility, but t this time this switch does not change anything.
batch No Set it to Yes if you want all identified targets to be notified notified in batches (instead of individually). By default this is set to No.
tags No A comma separated list of tags you can associate with your Jira message
priority No The priority to associate with the message. It is on a scale between 1 and 5. The default value is 3 if not specified.
alias No The alias to associate with the message.
entity No The entity to associate with the message.

New Service Completion Status

  • apprise/plugins/jira.py
  • KEYWORDS
    • add new service into this file (alphabetically).
  • README.md
    • add entry for new service to table (as a quick reference)
  • packaging/redhat/python-apprise.spec
    • add new service into the %global common_description

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • No lint errors (use flake8)
  • 100% test coverage

Testing

Anyone can help test this source code as follows:

# Create a virtual environment to work in as follows:
python3 -m venv apprise

# Change into our new directory
cd apprise

# Activate our virtual environment
source bin/activate

# Install the branch
pip install git+/~https://github.com/caronc/apprise.git@1272-opsgenie-to-jira

# Assuming our {apikey} is a6k4ABnck26hDh8AA3EDHoOVdDEUlw3nty
apprise -vv -t "Test Message Title" -b "Test Message Body" \
   jira://a6k4ABnck26hDh8AA3EDHoOVdDEUlw3nty

Include Details (Key/Value Pairs)

Jira allows you to provide details composed of key/value pairs you can set with messages. This can be accomplished by just sticking a plus symbol (+) in front of any parameter you specify on your URL string.

# Below would set the key/value pair of foo=bar:
# Assuming our {apikey} is a6k4ABnck26hDh8AA3EDHoOVdDEUlw3nty
apprise -vv -t "Test Message Title" -b "Test Message Body" \
   "jira://a6k4ABnck26hDh8AA3EDHoOVdDEUlw3nty/?+foo=bar"

# Multiple key/value pairs just require more entries:
# Below would set the key/value pairs of:
#    foo=bar
#    apprise=awesome
#
# Assuming our {apikey} is a6k4ABnck26hDh8AA3EDHoOVdDEUlw3nty
apprise -vv -t "Test Message Title" -b "Test Message Body" \
   "jira://a6k4ABnck26hDh8AA3EDHoOVdDEUlw3nty/?+foo=bar&+apprise=awesome"

Copy link

codecov bot commented Jan 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.37%. Comparing base (a2a2216) to head (8272e39).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1273    +/-   ##
========================================
  Coverage   99.36%   99.37%            
========================================
  Files         159      160     +1     
  Lines       20718    20959   +241     
  Branches     3724     3781    +57     
========================================
+ Hits        20587    20828   +241     
  Misses        121      121            
  Partials       10       10            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caronc caronc linked an issue Jan 18, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpsGenie becoming Jira Service Management
1 participant