Xray-App / xray-maven-plugin

Xray Maven Plugin
BSD 3-Clause "New" or "Revised" License
26 stars 12 forks source link

The maven goals import-features and import-results are not working anymore for my project #77

Closed bfongank closed 4 months ago

bfongank commented 6 months ago

I am writing today because I am using you xray-maven-plugin for Maven projects. It was working perfectly fine for the last months, but recently I noticed it is not working as expected. The maven goals "mvn xray:import-features -Dxray.inputFeatures=/path" and "mvn xray:import-results -Dxray.reportFile=/path" is not working anymore. I receive constanly 400 error message, Bad request. As I as a user don't directly create the request with the maven goal, I think that something went broken in the configurations. Could it possible to investigate the problem and let me know if it is a problem on your side or not? It would be very kind to fix this issue.

bitcoder commented 6 months ago

You need to provide more details @bfongank so others are able to help you out.

  1. which version worked before and which version exactly isn't working?
  2. can you share the logs you obtain? maybe run it in verbose mod
  3. are you importing to Xray on Jira DC or Xray on Jira Cloud?
bfongank commented 6 months ago

Hello @bitcoder, sorry for the late response. I will try my best to provide all information about this issue:

  1. I am working with the latest version of xray-maven-plugin (0.7.5)

  2. I will share first the logs for the xray-maven-plugin configuration on my pom-xml: `

    app.getxray
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.7.5</version>
            <configuration>
                <cloud>true</cloud>
                <clientId>XRAY_CLIENTID</clientId>
                <clientSecret>XRAY_CLIENTSECRET</clientSecret>
                <projectKey>ED</projectKey>
                <projectId>11444</projectId>
                <reportFormat>junit</reportFormat>
                <testInfoJson>src/test/java/project/data/xray/xrayInfo.json</testInfoJson>
            </configuration>
        </plugin>`
        Now here are the logs for xray:import-features (mvn xray:import-features -Dxray.inputFeatures=src/test/java/project/feature/) (I am trying to import Karate feature files and they are all located in the /feature folder)
        `[INFO] --- xray:0.7.5:import-features (default-cli) @ karate-senec-api ---

    [ERROR] java.io.IOException: Unexpected HTTP code Response{protocol=http/1.1, code=400, message=Bad Request, url=https://xray.cloud.getxray.app/api/v2/import/feature?projectKey=ED&projectId=11444} at app.getxray.xray.XrayFeaturesImporter.importCloud (XrayFeaturesImporter.java:405) at app.getxray.xray.XrayFeaturesImporter.importFrom (XrayFeaturesImporter.java:259) at app.getxray.maven.plugin.xray.ImportFeaturesMojo.execute (ImportFeaturesMojo.java:135) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) [ERROR] Unexpected HTTP code Response{protocol=http/1.1, code=400, message=Bad Request, url=https://xray.cloud.getxray.app/api/v2/import/feature?projectKey=ED&projectId=11444} Now here are the logs for xray:import-features (mvn xray:import-results -Dxray.reportFile=reports/karate-reports/project.feature.powersocket.powersocket.xml) (here an example of a powersocket.xml result): [INFO] --- xray:0.7.5:import-results (default-cli) @ karate-senec-api --- [ERROR] Here are the information of my local machine: Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9) Maven home: /Users/bfongan/Downloads/apache-maven-3.9.4 Java version: 11.0.20, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home Default locale: de_DE, platform encoding: UTF-8 OS name: "mac os x", version: "14.4.1", arch: "aarch64", family: "mac"`

  3. I am importing to Xray on Jira Cloud If you need more precise information please let me know (I did not know if you need the XRAY CLIENTID and XRAY CLIENTSECRET)

bitcoder commented 6 months ago

Did you run it with verbose mode enabled? Can you please checkout the code locally and use the REST API endpoints directly to see it in more detail? The body of the HTTP request can perhaps provide more clues.

Here's an example of a shell script you can try to adapt to see if you get the body of the HTTP call.

#!/bin/bash
BASE_URL=https://xray.cloud.getxray.app
PROJECT=CALC

rm -f features.zip
zip -r features.zip src/test/resources/webdemo/ -i \*.feature

token=$(curl -H "Content-Type: application/json" -X POST --data @"cloud_auth.json" "$BASE_URL/api/v2/authenticate"| tr -d '"')
curl -H "Content-Type: multipart/form-data" -H "Authorization: Bearer $token"  -F "file=@features.zip" "$BASE_URL/api/v2/import/feature?projectKey=$PROJECT"
bitcoder commented 5 months ago

closing for lack of feedback

bfongank commented 5 months ago

oh... really really sorry I didn't see the last notification. I will try this curl command now.

bfongank commented 5 months ago

Hmm strange when trying to run the shell command I receive this error `<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

ERROR: The request could not be satisfied

503 ERROR

The request could not be satisfied.


The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.

Generated by cloudfront (CloudFront)
Request ID: dEV7cFwvtxOKK8o5rgc30K3q1EbhcW4tF3Lu598BkJM1vOcsuSmJkw==
%` I will try again later maybe it is a temporary issue?
bfongank commented 5 months ago

Hi, I tried several times again today but still receive the 503 error. Should we try another way?

bitcoder commented 5 months ago

Hi, I tried several times again today but still receive the 503 error. Should we try another way?

I think that if it doesn't work for you using curl, then you should reach out Xray support team directly, as there may be some issue with the endpoint.

bfongank commented 5 months ago

Hi, I tried several times again today but still receive the 503 error. Should we try another way?

I think that if it doesn't work for you using curl, then you should reach out Xray support team directly, as there may be some issue with the endpoint.

Ok thank you and sorry for the inconvenience!

bitcoder commented 4 months ago

@bfongank , before closing this.. were you able to solve this out with the Xray support team?

bfongank commented 4 months ago

@bitcoder yes they could provide the help that I needed, thank you again!

bitcoder commented 4 months ago

What was the problem by the way?

bfongank commented 4 months ago

The issue was initially causes by the configuration of the JIRA of the Enterprise. Labels were no more allowed when importing features or results. And when trying to call the goals I just Go the 400 Bad request without more information but with the curl command the error was directly shown for labels.

bitcoder commented 4 months ago

I'll close this then @bfongank . I'll add more info on the output on an upcoming version