Code Monkey home page Code Monkey logo

sentry-jira's Introduction

sentry-jira

DEPRECATED: This project now lives in sentry-plugins

A flexible extension for Sentry which allows you to create issues in JIRA based on sentry events. It is capable of rendering and saving many custom fields, and will display the proper fields depending on which issue type you are trying to create.

Requires Sentry 8+

Installation

Install the package via pip:

pip install sentry-jira

Configuration

Go to your project's configuration page (Dashboard -> [Project] -> Settings), select the Issue Tracking tab, and then click the JIRA button under available integrations.

Enter the JIRA credentials and Project configuration and save changes. Filling out the form is a two step process (one to fill in data, one to enter additional options).

More Documentation

Have a look at the readthedocs page for more detailed configuration steps and a changelog: https://sentry-jira.readthedocs.io/en/latest/

License

sentry-jira is licensed under the terms of the 3-clause BSD license.

Contributing

All contributions are welcome, including but not limited to:

  • Documentation fixes / updates
  • New features (requests as well as implementations)
  • Bug fixes (see issues list)
  • Update supported JIRA types as you come across them

sentry-jira's People

Contributors

andialbrecht avatar dcramer avatar honza avatar ineu avatar macqueen avatar mattrobenolt avatar mitsuhiko avatar rogerhu avatar thurloat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sentry-jira's Issues

Gracefully handle unset form values

KeyError: 'instance_url'

Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "sentry/web/decorators.py", line 77, in _wrapped
    return func(request, project, *args, **kwargs)
  File "django/utils/decorators.py", line 91, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "sentry/web/frontend/projects.py", line 250, in configure_project_plugin
    action, view = plugin_config(plugin, project, request)
  File "sentry/web/helpers.py", line 174, in plugin_config
    if form.is_valid():
  File "django/forms/forms.py", line 124, in is_valid
    return self.is_bound and not bool(self.errors)
  File "django/forms/forms.py", line 115, in _get_errors
    self.full_clean()
  File "django/forms/forms.py", line 271, in full_clean
    self._clean_form()
  File "django/forms/forms.py", line 299, in _clean_form
    self.cleaned_data = self.clean()
  File "sentry_jira/forms.py", line 76, in clean
    jira = JIRAClient(cd["instance_url"], cd["username"], cd["password"])

TypeError: 'NoneType' object has no attribute '__getitem__'

TypeError: 'NoneType' object has no attribute '__getitem__'

Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "sentry/web/decorators.py", line 154, in wrapped
    return func(request, *args, **kwargs)
  File "sentry/web/decorators.py", line 77, in _wrapped
    return func(request, project, *args, **kwargs)
  File "sentry/web/frontend/groups.py", line 340, in group_plugin_action
    response = plugin.get_view_response(request, group)
  File "sentry/plugins/base.py", line 309, in get_view_response
    response = self.view(request, group)
  File "sentry_jira/plugin.py", line 98, in view
    ignored_fields=self.get_option("ignored_fields", group.project))
  File "sentry_jira/forms.py", line 123, in __init__
    project = meta["projects"][0]

Instance URL must end without /

Currently if you pass a instance URL that's ending with / the rest of the code will fail. The system should either strip the / or use a different function that doesn't duplicate the /.

Add support for User Selection widgets

JIRA sends back an autocompleter url that will return filtered users. Implement some sort of autocompleter widget that uses this.

note: currently there is no easy way to include your own static media as a plugin, so JS would have to be included directly in the template ๐Ÿ‘Ž -- ๐Ÿ‘ can now since sentry 4.10.0

Epic Name required

Passing on a report, but it seems that when you change the issue type (e.g. to Bug), the Epic Name field is still required.

To the actual report, which might contain some more useful information:

"The Epic Name field is required (This field is required. if submitted empty), but is not present on our Bugs, which leads to "Field 'customfield_12101' cannot be set. It is not on the appropriate screen, or unknown." if I submit with a value in the field, "

Could there be an issue with how its refreshing required fields when you select other issue types?

issue type is required error

On creating new jira issue getting this error even issue type is set. Tried to change it and change other fields doesn't help.

Empty project list causes 500

IndexError: list index out of range

Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "sentry/web/decorators.py", line 154, in wrapped
    return func(request, *args, **kwargs)
  File "sentry/web/decorators.py", line 77, in _wrapped
    return func(request, project, *args, **kwargs)
  File "sentry/web/frontend/groups.py", line 363, in group_plugin_action
    response = plugin.get_view_response(request, group)
  File "sentry/plugins/base.py", line 313, in get_view_response
    response = self.view(request, group)
  File "sentry_jira/plugin.py", line 131, in view
    ignored_fields=self.get_option("ignored_fields", group.project))
  File "sentry_jira/forms.py", line 138, in __init__
    project = meta["projects"][0]

Can't select project for hosted JIRA

Using the SaaS Sentry (getsentry.com) and JIRA OnDemand (COMPANY.atlassian.net), we can set the URL, the username, and the password correctly and get the message โ€œYour settings were saved successfully.โ€; this does not result in the second phase of configuration (selecting a project, etc.).

getsentry.com is reporting that it's using version 0.8.0 of sentry-jira. If it matters, our JIRA OnDemand also has a Confluence instance attached. I don't think it does; it seems that there's something else wrong, but I don't have enough information or insight into what it is.

Because I can't select a project, I also don't see the option to submit an issue via JIRA. Any advice?

Supporting more complex custom fields (select type)

a custom field that is of type select will require parsing of allowedValues, and sending back the result in a JSON object to the API.

currently, if you fill out the field, it will fail with a message like: "Could not find valid 'id' or 'value' in Parent Option object"

sample field schema that will be supported:

{
   u'required':False,
   u'schema':{
      u'type':u'string',
      u'custom':      u'com.atlassian.jira.plugin.system.customfieldtypes:select',
      u'customId':10420
   },
   u'name':u'Severity',
   u'operations':[
      u'set'
   ],
   u'allowedValues':[
      {
         u'self':         u'https://xxx/rest/api/2/customFieldOption/10010',
         u'value':u'Critical',
         u'id':u'10010'
      },
      {
         u'self':         u'https://xxx/rest/api/2/customFieldOption/10011',
         u'value':u'Major',
         u'id':u'10011'
      },
      {
         u'self':         u'https://xxx/rest/api/2/customFieldOption/10012',
         u'value':u'Minor',
         u'id':u'10012'
      },
      {
         u'self':         u'https://xxx/rest/api/2/customFieldOption/10013',
         u'value':u'Trivial',
         u'id':u'10013'
      }
   ]
}

cc @wolfe

Feature Request: Choose Jira Project on the Fly

When creating a jira ticket, it would be nice if we can choose the project on the fly. The use case for this would be a sentry project associated with multiple jira projects where the jira project could refer to different departments (eg. QA, Dev, OPS, Marketing, etc.) So, when a jira ticket is created, it would assigned to different departments first for investigation.

As you have mentioned before, the crumby part about allowing to configure the project
per issue is that it is a 3 step process. This would be to select a project, query the project meta from the API, select the issue type, grab the custom fields for that type, then display the form.

Enhancement: Append Events to Existing Tickets

When multiple events are triggered in Sentry, it would be great to be able to create tickets and append other events onto the creation of that ticket.

Also, it would be nice to just be able to define a pre-existing ticket to link the event to, maybe even have it comment on the ticket.

Unable to connect to JIRA: Bad Response

When attempting to configure the plugin I get Unable to connect to JIRA: Bad Response. We're using Atlassian Ondemand Jira, which up until a recently, this plugin worked with. Not sure if there's something on the Ondemand side that broke this.

Use resource_links hook

I added a resource_links attribute in plugins to improve the interface. It renders like this in master:

http://cl.ly/image/1k2d0K0T3G1c

Just set resource_links to a list of tuples, like this:

    resource_links = [
        ('Bug Tracker', 'https://github.com/getsentry/sentry-github/issues'),
        ('Source', 'https://github.com/getsentry/sentry-github'),
    ]

Add support for invalid issues

submitting an invalid issue (that is form valid, but not JIRA valid) throws a key error.

take the response from JIRA and display it in a nice way, and re-display the form accordingly.

nicetohave: align the error message with the field in the form

Notification email should be sent from logged in user (or Reporter)

At the moment, notifications of the JIRA being created is set in the configuration.

That means it is always sent from the one person.

Since the person whom the JIRA is assigned may follow up with more questions.

They would be confused to know the person who sent them the email (presumably the person raising the JIRA) does not know anything about the JIRA.

So to eliminate the confusion, I propose that notification emails should be sent from the logged in user, or alternatively the Reporter.

Can't connect to JIRA instance with a self-signed certificate over SSL

Our JIRA is firewalled (visible to Sentry, though), and we only have a self-signed certificate for it. When I put in my JIRA configuration and credentials, the connection fails with a log message like this:

ERROR:root:Error in request to https://jira/rest/api/2/priority: [Errno 1] _ssl.c:499: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Our certificate doesn't verify against any standard CA, so the answer is probably figuring out how to get a CA installed in a way that's visible to our sentry install so that this libssl (or whatever) call can validate it.

Chances are this is a wont-fix, because there's really nothing you can do about a bad certificate, but I'm making a ticket anyway, just in case someone else has solved this problem. I'll update if I find a good solution, of course.

Reporter field as optional

"Another nice related tweak (I'm looking to have the fewest number of required fields) would be to make Reporter optional, and if it's not supplied, use the user that was specified when setting up the connection to Jira. My workflow for this is that we've got one "user" which is only used for the Sentry connection, so having all the things be "reported" by them would make it really easy to track all the bugs that come from Sentry."

cc/ @dlanger

Implement a better create workflow

different issue types can have different required fields or displayed fields.

use the createmeta jira api to get a list of required fields and display those dynamically.

Provide ability in JIRA configuration to filter out fields

some JIRA configurations have a TON of fields that are optionally available for issues, so the configuration form should give you the ability to filter out some of those optional fields.

minimum viable: comma separated list of field names to exclude
nicetohave: interactive list or visual form editor

Google Account login support

Should I be able to use this plugin with my Google Apps account?

When I try those credentials, I get:

Unable to connect to JIRA: 401

Jira incorrectly reports auth not configured

The not_configured template render line should be:

            return self.render(self.not_configured_template, {
                'title': self.get_title(),
                'project': group.project,
                'has_auth_configured': has_auth_configured,
                'required_auth_settings': required_auth_settings,
            })

We should probably make this easier to extend. Open to ideas

Unable to select project

When configuring the plugin, I enter the following information:
Instance URL: https://company.atlassian.net
Username: tolmstead
Password: mypassword

I click save changes, the page refreshes, but I am not presented with the option to select a project.

I am an administrator for this JIRA instance. I've tried with both firefox and chrome.

JIRAIssueForm doesn't have issue_type

effects: plugin v 0.6.11 , sentry v 5.1.0, and JIRA v ???
env: hosted sentry

Only logged once, I suspect that there's some weird way around the configuration that's allowing the form to never get it's issue_type populated.

should both assert that the issue_type is there, and plug the configuration hole.

AttributeError: 'JIRAIssueForm' object has no attribute 'issue_type'

Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "sentry/web/decorators.py", line 154, in wrapped
    return func(request, *args, **kwargs)
  File "sentry/web/decorators.py", line 77, in _wrapped
    return func(request, project, *args, **kwargs)
  File "sentry/web/frontend/groups.py", line 364, in group_plugin_action
    response = plugin.get_view_response(request, group)
  File "sentry/plugins/base.py", line 313, in get_view_response
    response = self.view(request, group)
  File "sentry_jira/plugin.py", line 131, in view
    ignored_fields=self.get_option("ignored_fields", group.project))
  File "sentry_jira/forms.py", line 135, in __init__
    "Error communicating with JIRA, Please check your configuration."]
  File "django/forms/forms.py", line 115, in _get_errors
    self.full_clean()
  File "django/forms/forms.py", line 271, in full_clean
    self._clean_form()
  File "django/forms/forms.py", line 299, in _clean_form
    self.cleaned_data = self.clean()
  File "sentry_jira/forms.py", line 203, in clean
    fs = self.issue_type["fields"]

tagging @dcramer so he's in the loop.

Force refresh of config from JIRA

I've successfully configured against an OnDemand instance, but I need to refresh the config to update the list of available projects. I don't see how do to this, and further I can't seem to even clear the config. (I've tried disabling the plugin, changing values, etc. but nothing seems to work).

issueKey isnt always present in query

KeyError: 'issueKey'

Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "sentry/web/decorators.py", line 154, in wrapped
    return func(request, *args, **kwargs)
  File "sentry/web/decorators.py", line 77, in _wrapped
    return func(request, project, *args, **kwargs)
  File "sentry/web/frontend/groups.py", line 344, in group_plugin_action
    response = plugin.get_view_response(request, group)
  File "sentry/plugins/base.py", line 313, in get_view_response
    response = self.view(request, group)
  File "sentry_jira/plugin.py", line 122, in view
    return self.handle_autocomplete(request, group, **kwargs)
  File "sentry_jira/plugin.py", line 181, in handle_autocomplete
    del query['issueKey'] # some reason JIRA complains if this key is in the URL.

forms.py:189 'NoneType' object has no attribute 'keys'

For whatever reason, the issue_type dict doesn't have a 'fields' key when it gets to line 189 in forms.py. This causes the get() call to return None, which doesn't have .keys() method.

I wrote a quick fix to keep things running, but I'm not sure if this is a symptom of a deeper problem.

Sentry v5.4.1
sentry-jira@master

Configuration screen is fragile

show error messages for:

  • unable to contact JIRA instance
  • bad un / pw
  • could connect, but wrong URL

make sure instance url gets saved without the "/"

Filtering out JIRA custom fields doesn't work

Using getsentry.com's sentry-jira, filtering out custom JIRA fields doesn't seem to work.

As an example, I'll fill that field on the configuration screen with "components", but the Components field still shows up on the "Create JIRA Issue" screen.

Fix Version/s seems to be a required field

I am using the following: Python 2.6, Sentry 5.0.14, sentry-jira plugin 0.6.7 and jira 5.1.4

This seems to be related to this issue (#20 and #23).

When I am submitting the jira ticket, it now complains about the "Fix version/s" which gives this error and it does not allow the jira ticket to be submitted.

"Field 'fixVersions' cannot be set. It is not on the appropriate screen, or unknown."

I tried to put any values but it does not seem to be accepting it.

As a workaround, I had to comment out the following in forms.py:

# fixVersions = forms.MultipleChoiceField(
#    label=_("Fix Version/s"),
#    required=False
#)

....

# self.fields["fixVersions"].choices = self.make_choices(versions)

This seem to work. But I'm not sure what the effect of this would be.

Blank Issue Type when Creating Jira Ticket

I am using the following: Python 2.6, Sentry 5.0.14, sentry-jira plugin 0.6.6 and jira 5.1.4

I am able to successful configure the plugin and successfully linked the plugin to the jira server. I am also using the credentials of the jira administrator.

When I am creating a jira ticket based on a sentry issue, I see the following:
Error Communicating with JIRA, Please Check your configuration

and Issue Type is blank (there is nothing in the drop down menu).

I know that sentry can talk to the jira server because when I was configuring it was able to pull the different projects where it will be linked.

Let me know if you need any other information or if you need me to do something else.

Jira Credential SSL Errors (OrderedDict / Python 2.6 issue)

I am using the following: sentry 5.0.12, sentry-jira 0.6.1, python 2.6.5.

When I try to add my jira credentials to Sentry, I get the following errors.

Internal Server Error

Then when I click on the associated sentry error that it generated, I got this and I'm just adding some snippets that I think are relevant.

sentry.web.decorators._wrapped
root AttributeError: 'module' object has no attribute 'OrderedDict'

Location: sentry_jira/jira.py, init:85

"SSLError(SSLError(SSLError(1, '_ssl.c:480: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknow"
{'content-type': 'application/json'}
'get'
'<sentry_jira.jira.JIRAClient object at 0x98b7a4c>'
u'https://192.168.56.110:8080/rest/api/2/priority'

The sentry server can talk to the jira server on the specified port. So, I am not sure what is going on. Let me know if you need more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.