mikepenz/xray-action

Xray server (as a Jira server plugin)

opayelle opened this issue · 29 comments

Hello, have you planned to take in charge xray server ?

The main differences are:

  • Xray URL
  • Jira based authentication (basic auth)
  • Endpoint (/rest/raven/1.0/ instead of /api/v1)

Maybe you are interesting by a Pull Request for this feature ?
We want to use GitHub actions in my organization to update Xray and I think your action is a good base to do that.

Thanks

@opayelle thank you so much the issue.

Yes that sounds absolutely helpful to extend support to the xray server. Would have loved to include it too, but without the instance to test against I decided to better wait.

Absolutely would appreciate a Pull request for this feature.

Thank you so much!

Thanks

We need to add at least one parameter (xrayBaseUrl).

How do you want to determine which version of xray (server or cloud) ?

  1. xrayBaseUrl is optional. xray server if it filled, cloud otherwise (but what about if itś filled with xray cloud url ?)
  2. adding xrayServer parameter (or xrayCloud) with a default value (cloud for example)

I'd say we add a new action.yml config which allows to pass in the variant type.

E.g. we could make it to be a boolean. as I think there's only xray-cloud or jira possible right?

so we should introduce (and I like your proposed naming already)

xrayCloud=true (default) -> current behavior
xrayCloud=false -> using jira endpoint

and then the

xrayBaseUrl

https://github.com/mikepenz/xray-action/blob/main/src/xray.ts#L8-L11
Would say we add it there.

ok !

@opayelle , it would be great to add it; it would be helpful for many teams!
Anything you need from my side let me know; you can find me on twitter
I'm not a JS guru but I can help with any doubts from Xray side or even on testing this

Thank you so much @bitcoder That's really appreciated.

I think one of the biggest things I'd love to solve is to have the capability to actually test against an instance. currently I have been testing locally against an internal instance which I sadly couldn't use here in automation.

If there was a demo account / instance we could use to run imports against that would be amazing!

Also if you have suggestions / improvements on some features, e.g. if something is implement different than it would be expected to work please let me know!

You can use this sandbox instance based on a Jira server/DC: https://sandbox.xpand-it.com/ . This environment is reset every sunday.
You'll need to create a user account before using it though.
I can try to workout having some preconfigured account; I'll need to discuss it internally.

Oh that sandbox looks great. will have a look to setup things against that sandbox

I've created a dummy project there with the key "GHXA".
https://sandbox.xpand-it.com/projects/GHXA/issues/?filter=allopenissues

@bitcoder thank you so much. signed up and I can see it :).

EDIT so this sandbox is a xray server setup? and not a cloud installation? (just to ensure I get it right :D)

@opayelle have you already started to make changes? if not I may find time the next few days to work on it, thanks to the help of @bitcoder by providing a demo instance to work against

@mikepenz ,

EDIT so this sandbox is a xray server setup? and not a cloud installation? (just to ensure I get it right :D)

yes, it's a xray server setup (with a public IP).

several important things about differences between Xray server and Xray Cloud, to have in mind before you implement it:

  • authentication is different (in Cloud you need to obtain a token first; in Xray server, it uses Jira REST API authentication mechanism, based either on oauth or basic auth)
  • unfortunately, the endpoints syntax is slightly different (e.g. parameter names may differ, syntax of request/response); there are no major differences though but I would say that maybe it needs a distinct implementation (or else you'll have a bunch of "ifs")

I've created an open-source project with Postman collections showcasing the endpoints, which may be useful.
Anything, please let me know :)

Postman collections for Xray

@bitcoder thanks again for the collection.

I've been working on this a bit today. and introduced a split between cloud and server.

I think basic support is given now, but I feel like this can get a ton of additional improvements. @opayelle if you want to build upon the base for improvements.

@bitcoder I wonder what the reason for the inconsistencies between the 2 APIs are?
it seems a xml junit result can for example only be imported as multipart (even for the non multipart endpoint) for server. which seems strange (based on the naming of the endpoints)

I am pretty sure I missed a few more of those special cases though

released the initial variant as v0.9.5

@mikepenz , well for several reasons (legacy reasons, products with a different architecture, roadmap).
We're aiming to clean that up in the future.

A JUnit XML can be imported both using the "standard" endpoint or the "multipart" endpoint (all endpoints are avaiable herE).

@bitcoder let me maybe rephrase it a bit. so to do the "standard" import I have to do a "multipart" request. it is not possible with a post request on the server endpoint, whereas it is possible on the cloud endpoint.

I am mainly wondering why the standard import request has to be multipart (even though it's a single file only) (your postman collection does the same btw.)

Is it because the jira raven endpoint does not allow for xml to be sent as post? (sending the single xml file as post was returning a 415 status code)

@mikepenz as I've said, the API needs some improvements including consistency.
Your question is totally valid: it should support the content type for XML files; however, for legacy reasons it is like that as of today. "Multipart" endpoints end with ".../multipart" and mean that they have multiple contents, besides the report file itself. As it is today is not totally, semanticaly correct; a "cleanup"/uniformization needs to be done, in a posterior version of the API.

Thanks for your clarification.

was mainly referencing to:

A JUnit XML can be imported both using the "standard" endpoint or the "multipart" endpoint (all endpoints are avaiable herE).

I think we should be good for the start. I believe junit should work which I mainly tested. Haven't checked every single variant yet though

@mikepenz , I tried using this in a GH project I have but it fails due to xrayBaseUrl.
I had it setup as something like "https://sandbox.xpand-it.com".
In generic terms it's an URL, so it can be "http://whatever_subdomain.domain.com/some_optional_path" (some Jira admin configure Jira for example to be served at / or at /jira,, for example).

It seems you're assuming a hostname and then prepending it with http or https.
Do you think it's feasible to change it to process a base URL, whatever the user defines for it?

@bitcoder makes sense wonder though if having it as their own fields e.g.

protocol,
baseUrl,
path

is safer than doing a parsing of a url and then extracting the paths :/

@mikepenz do you need to extract the procotol and the path? Couldn't you just use the base URL as provided by the user to build the HTTP request?

@bitcoder ok I think #75 would do it.

One thing which bothers me a ton is that I have not been able to make the form-data request work with got. as such I use got library for post requests and form-data library for form-data requests. would be so much cleaner if I figured out what's off with got and form-data

concerning got/form-data, I understand but unfortunately it's not something I can provide much help :(
anyway, I tested JUnit XML ("standard") in a simple project and it worked fine. I can try to do some more exhaustive tests later on

Yeah no worries :D, some day I will find the thing which is bothering me :D


I believe that would be great, perhaps we can setup some automated testing, not sure yet though how I can do that best as the user on the demo instance will be deleted each sunday and that may be a bit too much overhead re-creating it each week :D

I/we will provide a proper environment for integration purposes so we can overcome that issue we have with the current sandbox ;)

Hello sorry, I was on vacation...
Yes we started to work on this. We must to find more time ;-)

@opayelle no worries. if you have a look at the latest release, you can find initial support. as I was not sure and thanks to the provided demo instance from @bitcoder I have built support for it

at least junit support is working, so please let me know if anything else is needed for your xray server usecase.

Hi @mikepenz , please use this environment for a Xray server/datacenter kinda of instance : https://xray-demo3.xpand-it.com/
I have created a Jira project named GHXA, that you can access at: https://xray-demo3.xpand-it.com/secure/RapidBoard.jspa?rapidView=14&projectKey=GHXA&view=planning.nodetail&issueLimit=100
Anything, please let me know
Note: I've sent you the credentials through another channel :)

@bitcoder I have enabled automated tests now. thanks a ton!

Happy to take improvements to the things (including the tests) to make them be more real life scenarios