mikepenz / xray-action

... a GitHub action to import test results into "Xray" - A complete Test Management tool for Jira.
Apache License 2.0
48 stars 18 forks source link

Endpoint with double backslashes resulting in failure of exporting results to JIRA using mikepenz/xray-action@v3.0.4 #832

Closed manjirigaikwad205 closed 6 months ago

manjirigaikwad205 commented 6 months ago

I am using mikepenz/xray-action@v3.0.4 to import junit xml results to JIRA. It was working well earlier this year and suddenly started failing with below error in github: Error: 🔥 Failed to import: /__w/repo_name/repo_name/project_name/target/surefire-reports/junitreports/TEST-com.project.quality.project_name.test.cucumber.options.TestRunner.xml ({"name":"HTTPError","code":"ERR_NON_2XX_3XX_RESPONSE","timings":{"start":1713549674111,"socket":1713549674112,"lookup":1713549674112,"connect":1713549674112,"secureConnect":1713549674112,"upload":1713549674112,"response":1713549710288,"end":1713549710289,"phases":{"wait":1,"dns":0,"tcp":0,"tls":0,"request":0,"firstByte":36176,"download":1,"total":36178}}})

After debugging it further, I can see the endpoint in debug logs -

[debug]Using endpoint: https://xray.cloud.getxray.app//api/v2/import/execution/junit

Due to extra slash before the 'api', it's failing. Tried with different formats, these endpoints comes with 2 slashes.

Can you please help in getting this resolved. As it look like this is an in-built endpoint?

XRAY action call in workflow file:

name: "Import Regression Test results to Xray" if: always() uses: mikepenz/xray-action@v3.0.4 with: username: ${{ secrets.XRAY_CLIENT_ID }} password: ${{ secrets.XRAY_CLIENT_SECRET }} testFormat: "junit" testPaths: "project_name/target/surefire-reports/junitreports/TEST-com.project.quality.project_name.test.cucumber.options.TestRunner.xml" projectKey: "PROJECT_KEY" testExecKey: ${{ github.event.inputs.jiraRegressionTestExecKey }} failOnImportError: false

bitcoder commented 6 months ago

Can you please identify the version that worked well before?

manjirigaikwad205 commented 6 months ago

Tried with mikepenz/xray-action@v2.4.5 which was working well earlier.

Now it's failing with the similar reason: ##[debug]Using endpoint: https://xray.cloud.getxray.app//api/v2/import/execution/junit Warning: 🔥 Failed to import: /__w/repo_name/repo_name/project_name/target/cucumber-reports/Cucumber.xml (Response code 400 (Bad Request)) ℹ️ Processed 0 of 1 elements. Failed to import: 1

Tried to import Cucumber.xml report as it was working well earlier.

bitcoder commented 6 months ago

Tried with mikepenz/xray-action@v2.4.5 which was working well earlier.

Now it's failing with the similar reason: ##[debug]Using endpoint: https://xray.cloud.getxray.app//api/v2/import/execution/junit Warning: 🔥 Failed to import: /__w/repo_name/repo_name/project_name/target/cucumber-reports/Cucumber.xml (Response code 400 (Bad Request)) ℹ️ Processed 0 of 1 elements. Failed to import: 1

Tried to import Cucumber.xml report as it was working well earlier.

I think then the problem is different. I would recommend trying submiting the file directly to the REST API endpoint to see what's happening and what is being returned on the HTTP body

raihle commented 6 months ago

I am having similar issues, although I was never using this action earlier:

 Warning: 🔥 Server responded with error (Unexpected token < in JSON at position 0): <?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404</status-code><message>null for uri: https://jira.xxxxxx//rest/raven/2.0/import/execution/xunit/multipart</message></status>

When trying to use the API "manually" I get an identical failure if I use a double slash, but it works fine without it.

I suspect some servers / reverse-proxies will silently eliminate the double slash, but mine apparently doesn't.

mikepenz commented 6 months ago

Thank you for the feedback @raihle

I'll have a look to see where the additional / comes from.