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

Use scriptrunner issueFunction to speed up things #198

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

sochotnicky
Copy link

Original code needed per-project JIRA definition because JiraUpdated was
querying all JIRA issues in a project that changed over defined period
of time. This was wasteful and for JIRA instances with scriptrunner
installed we can do things faster and with a single configuration

With this change:

  • project configuration is optional - if omitted all projects are
    reported
  • added new "login" config item needed because when lastUpdated('by
    ') is triggered with non-existing login name it causes failure
    of the JIRA plugin.

This will need further rework so that use of scriptrunner is
optional/configured properly (since it's not part of JIRA itself). Obviously docs need updates too. I'll try to clean this up later

@sochotnicky
Copy link
Author

Also of note might be that - JIRA 8.x will support this query out of the box it seems:
https://jira.atlassian.com/browse/JRASERVER-1973

@sochotnicky sochotnicky force-pushed the fix-up-jira branch 3 times, most recently from ec3f98f to 3308ccc Compare July 16, 2019 10:46
@psss psss self-assigned this Oct 1, 2019
@psss
Copy link
Owner

psss commented Oct 1, 2019

Thanks for the patch. It would be nice to be able to easily search across all projects.

@sochotnicky sochotnicky changed the title [WIP] Use scriptrunner issueFunction to speed up things Use scriptrunner issueFunction to speed up things Feb 17, 2020
@sochotnicky
Copy link
Author

Now the plugin should work with or without scriptrunner though we try to use it by default since it's a fairly common plugin (and speeds up execution)

@psss
Copy link
Owner

psss commented Apr 3, 2020

/packit build
/packit test

@psss
Copy link
Owner

psss commented Apr 3, 2020

I tried to run a Jira report against our internal instance with my current config but it did not work. Disabling the script runner using use_scriptrunner = false helped. I think it would not be good to break reports for current users with their configs already set. Could you switch the default method, so that script runner is enabled only when use_scriptrunner = true is present in the config?

@sochotnicky
Copy link
Author

I tried to run a Jira report against our internal instance with my current config but it did not work. Disabling the script runner using use_scriptrunner = false helped. I think it would not be good to break reports for current users with their configs already set. Could you switch the default method, so that script runner is enabled only when use_scriptrunner = true is present in the config?

Yeah, I left out a call to Issue.search during some rebase/merge. Hopefully that should be enough to fix it. If not I can change the defaults but fingers crossed...

@psss
Copy link
Owner

psss commented Apr 6, 2020

We're almost there ;-)

Status report for the week 15 (2020-04-06 to 2020-04-12).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Petr Šplíchal <[email protected]>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Issues created in tt: 2
    * TT-105 - Testing Tools Retrospective
    * TT-104 - Update Fedora CI documentation with tmt instructions and...
Traceback (most recent call last):
  File "/home/psss/.virtualenvs/did/bin/did", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/psss/git/did/bin/did", line 42, in <module>
    did.cli.main()
  File "/home/psss/git/did/did/cli.py", line 222, in main
    user_stats.check()
  File "/home/psss/git/did/did/stats.py", line 157, in check
    stat.check()
  File "/home/psss/git/did/did/stats.py", line 157, in check
    stat.check()
  File "/home/psss/git/did/did/stats.py", line 77, in check
    self.fetch()
  File "/home/psss/git/did/did/plugins/jira.py", line 177, in fetch
    self.stats = Issue.search(query, stats=self)
  File "/home/psss/git/did/did/plugins/jira.py", line 120, in search
    batch, listed(data["issues"], "issue")))
KeyError: 'issues'

Original code needed per-project JIRA definition because JiraUpdated was
querying all JIRA issues in a project that changed over defined period
of time. This was wasteful and for JIRA instances with scriptrunner
installed we can do things faster and with a single configuration

With this change:
 * added new "use_scriptrunner" config item that is enabled by default. With
   this enabled it's no longer necessary to specify "project" config
 * added new "login" config item needed because when lastUpdated('by
   <login>') is triggered with non-existing login name it causes failure
   of the JIRA plugin. This can be used with or without scriptrunner
 * JiraUpdated really only reports comments and does not report other
   changes such as state change (this removes duplicate when closing issues
   as a side-effect)
@psss
Copy link
Owner

psss commented Apr 7, 2020

/packit build
/packit test

@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/psss-did-198
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

psss added a commit that referenced this pull request Apr 7, 2020
@psss psss merged commit a234d20 into psss:master Apr 7, 2020
@psss
Copy link
Owner

psss commented Apr 7, 2020

Thanks, seems to be working fine now. Merged into master.

@psss psss mentioned this pull request Sep 24, 2021
psss added a commit to mweetman-redhat/did that referenced this pull request Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants