Link a jira issue to another jira issue while exporting nunit report with XrayImportBuilder - jenkins-plugins

I'm trying to export nunit result to Jira Xray using XrayImportBuilder. I need to link a jira issue to another issue and I got below error. Am I missing something? XrayImportBuilder uses v2 create enpoints "rest/api/2/issue"
ERROR: Unable to confirm Result of the upload.....
Upload Failed! Status:400 Response:{"error":"Error creating Test Execution -
Issue create failed! - issuelinks: Field 'issuelinks' cannot be set.
It is not on the appropriate screen, or unknown."
The code I used in jenkins pipeline:
step([$class: 'XrayImportBuilder',
endpointName: '/nunit/multipart',
importFilePath: 'nunit3.xml',
importToSameExecution: 'true',
projectKey: 'AT',
serverInstance: jiraServerId,
importInParallel: 'true',
inputInfoSwitcher: 'fileContent',
importInfo: """{
"fields":{
"project":{
"key":"AT"
},
"summary":"${summary}",
"issuetype":{
"name":"Test Execution"
}
},
"update":{
"issuelinks": [{
"add": {
"values": [
{
"type": {
"id": "10102"
},
"outwardIssues": [
{
"key": "AT-23"
}
]
}
]
}
}
]
}
}"""
])
I tried to run without update fields it worked but I ran with update-issuelinks field it failed.
In the documentation it says > importInfo and testImportInfo must comply with the same format as the Jira issue create/update REST API format.
But it doesn't work as it is expected in the API doc.

First, to clarify, the Jenkins plugin is like a "wrapper" for invoking Xray REST API endpoints; it doesn't use Jira REST API endpoints.
Xray itself may use internally Jira REST API endpoints (or similar APIs).
Even though it seems possible to create a issue and link it to other issues using Jira's REST API, as long as you have the "Linked Issues" on the create screen as shown below, if you import results to Xray, using Xray API, that is not supported for the time being at least for Xray server/DC.
For Xray on Jira Cloud, if you have the "linked Issues" on the mentioned screen, it should work.
For Xray server/DC
You should only consider setting fields on the destination issue (i.e. the Test Execution that will be created) using the "fields" object in that JSON.
If you wish to upload results and then link the Test Execution issue to some other issues, you'll have to make a Jira REST API request yourself after uploading the results (example). However, there's currently a limitation that inhibts the Jenkins plugin of setting a build variable with the Test Execution issue key that was created..
Therefore, this approach may not work; we could think on a workaround like getting the last Test Execution issue that was created but that would be untrustworthy.
You may also reach out Xray support team and ask for an improvement in order to support this in the future.

Related

How to patch env_variable using REST API in App Engine Standard?

Lately I've been deploying apps on App Engine Standard and sometimes I accidentally deploy a version with a typo in my env_variables specified on app.yaml. Let's say that I don't want to deploy a new version because it takes time and this typo should be easily fixed with a "quick patch".
I followed the GAE Admin REST API doc and played around with the API Explorer. It turns out that the request body accepts envVariables so I was thinking that this API can solve my problem but for some reason it fails.
Error:
{
"error": {
"code": 400,
"message": "This operation is only supported on the following field(s): [automatic_scaling.cool_down_period_sec, automatic_scaling.cpu_utilization.target_utilization, automatic_scaling.max_idle_instances, automatic_scaling.max_total_instances, automatic_scaling.min_idle_instances, automatic_scaling.min_total_instances, automatic_scaling.standard_scheduler_settings.max_instances, automatic_scaling.standard_scheduler_settings.min_instances, automatic_scaling.standard_scheduler_settings.target_cpu_utilization, automatic_scaling.standard_scheduler_settings.target_throughput_utilization, instance_class, manual_scaling.instances, serving_status]",
"status": "INVALID_ARGUMENT"
}
}
Request Parameters:
appsId: PROJECT_ID
servicesId: SERVICE_NAME
versionsId: 2021xxxxx
updateMask: envVariables
Request Body:
{
"envVariables": {
"my_key":"my_value"
}
}
Overall question: Is it not possible to patch env_variables on App Engine Standard using REST API or I'm just missing something? Are there any alternatives to avoid redeployment?
Nope, there is no other alternative for this particular use case.
The reason you cannot modify the envVariables using GAE Rest API is that those variables are used when your app is being built in App Engine, so modifying them will imply re-build all the app which implies at the same time you need to redeploy the app.
You can modify the scaling settings since those not depend on the application or how it is built.
Now, that you're able to see envVariables as an option in the API explorer does not mean it is intended to be used with apps.services.versions.patch, in fact that option is shown as well with others just like a generic menu with all the possible options in the API but in the documentation you share it is not mentioned you can use it for the particular method you mention.

Can you edit a Logic App custom connector? and how does one deploy then maintain (update)

I created a logic app custom connector successfully (via the portal, not ARM) and it's in use (demo) working fine. It's a wrapper for an azure function but to provide better usability up front to less tech savy users i.e. expose properties VS providing json.
Any how once created my query is a simple one. Can it be edited 1. in the portal? 2. via ARM (if it was created by arm)? i.e. I want to add a better icon.
When I view the logic apps custom connector though in the portal and click EDIT all it does is populate the Connector Name and no more. See below. All original configuration, paramaters etc is missing.
So my queries.
Is this the norm?
On export of the custom connector (azure portal menu item) the template really has nothing in it. No content either of the connector details?
Is there an ARM template to deploy this?
If yes to 3, how do you go about modifying in the scenario you have to?
I also understand in using it in a logic app it created an API Connection reference. Does this stand alone, almost derived off the customer connector? And further uses say of a modified connector would create different API connections?
I feel I'm just missing some of the basic knowledge on how these are implemented. which in turn would explain the deploying, and maintenance.
Anyone :) ?
EDIT:
Think I've come to learn the portal is very buggy. The swagger editor loaded no content either and broke the screen. I've since tried a simpler connector i.e. no sample markup with escaped regex patterns and it seems to like going back into it to edit :) (Maybe one to report as a bug after all this)
That said then - Yes, edit should be possible but the other queries regarding ARM, export, redeploy and current connections still stands :)
You can deploy the Logic apps custom connector really easily. You need to do following steps
Configure you custom connector with proper settings and update it.
Once updated, click on the download link available at the top of the connector.
Download the ARM template skeleton using the Export Template.
In the properties section, just add a new property called swagger and paste the swagger you downloaded in step 2.
Parameterise your ARM template
Deploy using your choice of deployment using Azure DevOps , PowerShell etc.
Please refer to following ARM template for your perusal.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"customApis_tempconnector_name": {
"defaultValue": "tempconnector",
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Web/customApis",
"apiVersion": "2016-06-01",
"name": "[parameters('customApis_tempconnector_name')]",
"location": "australiaeast",
"properties": {
"connectionParameters": {
"api_key": {
"type": "securestring",
"uiDefinition": {
"displayName": "API Key",
"description": "The API Key for this api",
"tooltip": "Provide your API Key",
"constraints": {
"tabIndex": 2,
"clearText": false,
"required": "true"
}
}
}
},
"backendService": {
"serviceUrl": "http://petstore.swagger.io/v2"
},
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"displayName": "[parameters('customApis_tempconnector_name')]",
"iconUri": "/Content/retail/assets/default-connection-icon.e6bb72160664a5e37b9923c3d9f50ca5.2.svg",
"swagger": { "Enter Swagger Downloaded from Step 2 here" }
}
}
]
}

How to have sample dataset on AWS ElasticSearch or other service provider for SearchKitManager()?

I am trying to use SearchKit and I want to know how to set up an ElasticSearch instance indexed with sample movie dataset.
Tried using:
AWS ElasticSearch Service. But don't have an actual dataset to upload through bulk API. The one that I have doesn't have indexing.
Sample data:
[
{
"movie_title":"Avatar ",
"director_name":"James Cameron",
"actor_1_name":"CCH Pounder",
"actor_2_name":"Joel David Moore",
"genres":"Action|Adventure|Fantasy|Sci-Fi",
"language":"English",
"country":"USA",
"content_rating":"PG-13",
"budget":"237000000",
"title_year":"2009",
"plot_keywords":"avatar|future|marine|native|paraplegic",
"movie_imdb_link":"http://www.imdb.com/title/tt0499549/?ref_=fn_tt_tt_1"
},
...
]
Tried using appbase.io ready made movie-dataset. But I am not sure how to connect it with SearchKitManager().
Would really appreciate any help.
you may want to try ReactiveSearch - it's an alternative to SearchKit from appbase.io (I work there) that's actively maintained. It supports direct use of appbase.io apps.
Re: SearchKitManager(), I am not sure if that may work as we don't support cluster level routes.

Reasons why Rally Lookback Api isn't working?

Could someone help me figure out why I can't access the Rally Lookback Api? I can access the webservice just fine.
For example, when I type this into the browser:
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12345/artifact/3563764.js
(using my server name, the correct workspace and a valid ObjectID), I get the HTTP 404 not found error. Is there a specific reason for this? I've tried several different types of queries, and nothing works.
Thanks!
There is actually an endpoint for the LBAPI that is similar to the WSAPI artifact endpoint. It looks like:
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12345/artifact/67890/snapshot/query.js
(Note the oid between /artifact/ and /snapshot/.) You still have to use a find clause though, to filter which snapshots from that specific artifact you want.
Lookback API works a bit different from WSAPI - there aren't artifact-ObjectID specific endpoints such as the above. Instead, you would want to do a find query:
GET:
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12345678910/artifact/snapshot/query.js?find={"ObjectID":12345678920}&fields=["_ValidFrom","_ValidTo","ObjectID","State"]&start=0&pagesize=1
Alternatively, using a POST:
POST against:
URI: https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12345678910/artifact/snapshot/query.js
POST data:
{
"find": { "ObjectID": 12345678920},
"fields": ["_ValidFrom", "_ValidTo", "ObjectID", "State"],
"start": 0,
"pagesize": 1
}
There are some good examples of this, along with a query "scratchpad" that you can use to test queries in your browser, in the LookbackAPI docs here:
https://rally1.rallydev.com/analytics/doc/#/manual
A Rally login is required to use query samples.
Both MarkW and Joel give some great responses and pointers to where you can get more information about the Lookback API. However, the real answer to your question is that the Lookback API is currently only available to SaaS customers. So, since you have Rally inside your datacenter, you won't be able to use the Lookback API until the ability to deploy Lookback to on premise customers is released.

Invalid and/or missing SSL certificate when using Google App Engine

UPDATE: Please, if anyone can help: Google is waiting for inputs and examples of this problem on their bug tracking tool. If you have reproducible steps for this issue, please share them on: https://code.google.com/p/googleappengine/issues/detail?id=10937
I'm trying to fetch data from the StackExchange API using a Google App Engine backend. As you may know, some of StackExchange's APIs are site-specific, requiring developers to run queries against every site the user is registered in.
So, here's my backend code for fetching timeline data from these sites. The feed_info_site variable holds the StackExchange site name (such as 'security', 'serverfault', etc.).
data = json.loads(urllib.urlopen("%sme/timeline?%s" %
(self.API_BASE_URL, urllib.urlencode({"pagesize": 100,
"fromdate": se_since_timestamp, "filter": "!9WWBR
(nmw", "site": feed_info_site, "access_token":
decrypt(self.API_ACCESS_TOKEN_SECRET, self.access_token), "key":
self.API_APP_KEY}))).read())
for item in data['items']:
... # code for parsing timeline items
When running this query on all sites except Stack Overflow, everything works OK. What's weird is, when the feed_info_site variable is set to 'stackoverflow', I get the following error from Google App Engine:
HTTPException: Invalid and/or missing SSL certificate for URL:
https://api.stackexchange.com/2.2/me/timeline?
filter=%219WWBR%28nmw&access_token=
<ACCESS_TOKEN_REMOVED>&fromdate=1&pagesize=100&key=
<API_KEY_REMOVED>&site=stackoverflow
Of course, if I run the same query in Safari, I get the JSON results I'm expecting from the API. So the problem really lies in Google's URLfetch service. I found several topics here on Stack Overflow related to similar HTTPS/SSL exceptions, but no accepted answer solved my problems. I tried removing cacerts.txt files. I also tried making the call with validate_certificate=False, with no success.
I think the problem is not strictly related to HTTPS/SSL. If so, how would you explain that changing a single API parameter would make the request to fail?
Wait for the next update to the app engine (scheduled one soon) then update.
Replace browserid.org/verify with another service (verifier.loogin.persona.org/verify is a good service hosted by Mozilla what could be used)
Make sure cacerts.txt doesnt exist (looks like you have sorted but just in-case :-) )
Attempt again
Good luck!
-Brendan
I was facing the same error, google has updated the app engine now, error resolved, please check the updated docs.

Resources