vorburger / opendaylight-bot

Eclipse Public License 1.0
0 stars 2 forks source link

POC to read JIRA issues by filter and custom fields #7

Open vorburger opened 6 years ago

vorburger commented 6 years ago

The goal of this issue is to raise a PR with a POC that introduces code which:

ivange94 commented 6 years ago

@vorburger can you assign me to this?

ivange94 commented 6 years ago

@vorburger when I launch the bot, I see this interface

screen shot 2018-06-03 at 7 56 23 am

I'm to add fields that will receive the input above or how will this input be sent to the bot?

ivange94 commented 6 years ago

@vorburger I intend to use the Jira REST API here. I was wondering which version of jira is at https://jira.opendaylight.org. I mean is, it jira cloud or server? They seem to have separate documentations.

vorburger commented 6 years ago

@vorburger can you assign me to this?

I don't seem to be able to - not sure how GitHub determines the elibible list of assignees.

Doesn't matter - let's just say that until you say so otherwise by comment, this issue is "yours".

I'm to add fields that will receive the input above or how will this input be sent to the bot?

no fields needed; let's the goal is to show be a table (can be ugly, just <ul><li> is fine) on that homepage of the bot with the JIRA IDs resulting from running a query matching the filter shown above.

A JUnit for a new class JIRA with a method like List getIssues(String filter) would be nice.

which version of jira is at https://jira.opendaylight.org. I mean is, it jira cloud or server?

pretty sure that is JIRA v7.6.0 Server run by LF, not Cloud hosted by Atlassian, did you see the footer?

https://developer.atlassian.com/server/jira/platform/java-apis/ looks interesting BTW.

ivange94 commented 6 years ago

no fields needed; let's the goal is to show be a table (can be ugly, just <ul><li> is fine) on that homepage of the bot with the JIRA IDs resulting from running a query matching the filter shown above.

Ok

A JUnit for a new class JIRA with a method like List getIssues(String filter) would be nice.

You mean a unit test?

https://developer.atlassian.com/server/jira/platform/java-apis/ looks interesting BTW.

Was planing to use the REST API but this looks much more cooler

ivange94 commented 6 years ago

Working on something now. Should have a PR soon.

ivange94 commented 6 years ago
<dependency>
      <groupId>com.atlassian.jira</groupId>
      <artifactId>jira-api</artifactId>
      <version>7.6.1</version>
      <scope>provided</scope>
    </dependency>

I'm having trouble resolving this dependency. InteliJ can't find it. mvn clean install from the terminal in InteliJ gives

[ERROR] Failed to execute goal on project bot: Could not resolve dependencies for project org.opendaylight.bot:bot:jar:1.0.0-SNAPSHOT: Failure to find com.atlassian.jira:jira-api:jar:7.6.1 in https://nexus.opendaylight.org/content/repositories/public/ was cached in the local repository, resolution will not be reattempted until the update interval of opendaylight-mirror has elapsed or updates are forced -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command

When I force the update with the -U switch, I get this

INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project bot: Could not resolve dependencies for project org.opendaylight.bot:bot:jar:1.0.0-SNAPSHOT: Could not find artifact com.atlassian.jira:jira-api:jar:7.6.1 in opendaylight-mirror (https://nexus.opendaylight.org/content/repositories/public/) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command

Surprisingly the build passes when I run mvn clean install from my normal terminal(Not the one in IDEA). But the dependency is still not downloaded.

ls ~/.m2/repository/com/atlassian/jira/jira-api/ tells me directory doesn't exist.

For now I'll proceed with a REST client and talk to Jira via REST. Will come back to this later.

ivange94 commented 6 years ago

I had to add this https://ecosystem.atlassian.net/wiki/spaces/JRJC/pages/27164674/Download to my settings.xml for that error to disappear but I'm getting a new error. Duplicate classes found. See https://pastebin.com/tNsz33UN.

I'm leaving for school now. Will get back to this when I return.

prateekiiest commented 6 years ago

Hi @ivange94 . I would request you to check the pom.xml and settings.xml for any duplicate dependency (like adding the same dependency twice), in case if you have mistakenly done so.

Also have you checked if jira-api dependency is present on http:/repo/maven ? You can check this issue https://github.com/vorburger/opendaylight-bot/issues/20 for similar issue I faced earlier

I hope @vorburger would be able to add further on this :)

vorburger commented 6 years ago

@ivange94 yeah this is a similar problem to that @prateekiiest faced on #20; basically:

So com.atlassian.jira:jira-api is available (only) on maven.atlassian.com but not on Maven Central.

So you can add maven.atlassian.com to your settings.xml, but that is always a PITA... you locally do that, but it can confuse future contributors. And if this code ever moves to http://git.opendaylight.org, then it's a PITA again - because https://nexus.opendaylight.org does not mirror maven.atlassian.com, and requesting that may be possible but woud likely be a bigger discussion - premature, for this project.

What you can try however is to add maven.atlassian.com not to a settings.xml but into pom.xml, see here on maven.apache.org for how to do that. That approach has other disadvantages, but I think to unblock us here, it's probably a fair short term solution.

Re. duplicate-finder-maven-plugin, that's an entirely different issue. You can probably fix that by adding an exclusion like I have here for stax-api into your <dependency> for jira-api, try it. (It's because stax-api overlaps with and contains the same classes than xml-apis, which is very bad, but xml-apis contains those and more, I just checked, so the right thing to do is exclude stax-api.)