Disable sandbox in custom rule - sandbox

How can I disable the sandbox in a custom Bazel rule?
I want the sandbox always disabled for every instantiation of this rule, without the user having to do anything.

When creating actions in the rule implementation, include the execution_requirements dict argument containing a no-sandbox key with a value of 1. This forces the action to never run in the sandbox.
def _impl(ctx):
ctx.actions.run_shell(
outputs = [ctx.outputs.executable],
command = "..",
execution_requirements = {
"no-sandbox": "1",
"no-cache": "1",
"no-remote": "1",
"local": "1",
},
)
See the tags attribute on the documentation for common build attributes for more information on these tags/requirements.

Related

Custom field for test plan in jira xray

I'm tring to import results to jira Xray using Rest API cucumber/mutipart with the following curl command :
curl -H "Authorization: Bearer $token" -F info=#Exec.json -F result=#file.json https://server/rest/raven/2.0/import/execution/cucumber/multipart
As this command creates a new test execution and we cannot report results to an existing one as bug mentionned https://jira.getxray.app/browse/XRAYCLOUD-2375
So I tried to add custom field related to test plan that already created
the problem that I cannot find the exact custom field's number I get always this error
{"error":"Error assembling issue data: Field \u0027customfield_11218\u0027 cannot be set. It is not on the appropriate screen, or unknown."
Here my Exec.json:
{
"fields": {
"project": {
"key": "project"
},
"summary": "Test Execution for cucumber Execution",
"issuetype": {
"name": "Test Execution"
},
"customfield_11218" : "ODI-1103"
}
}
I get the custom field for xml file exported from a test related to test plan:
<customfield id="customfield_11218" key="com.xpandit.plugins.xray:test-plans-associated-with-test-custom-field">
<customfieldname>Test Plans associated with a Test</customfieldname>
<customfieldvalues>
<customfieldvalue>[ODI-1103]</customfieldvalue>
</customfieldvalues>
</customfield>
In the case of Cucumber JSON reports, it's currently kind of an exception. If we want to link the results to a Test Plan, then we need to use the multipart endpoint that you mentioned.. which in turn always creates a new Test Execution.
The syntax for the JSON content used to customize the Test Execution fields should be something like:
{
"fields": {
"project": {
"key": "CALC"
},
"summary": "Test Execution for Cucumber execution",
"description": "This contains test automation results",
"fixVersions": [ {"name": "v1.0"}],
"customfield_11805": ["chrome"],
"customfield_11807": ["CALC-8895"]
}
}
(you can see a code example here; that repository contains examples in other languages)
In the previous example, the Test Plan custom field is "customfield_11807". Note that the value is not a string but an array of string of the issue keys of the connected Test Plans (usually just one).
From what you shares, it seems that you are referring to another custom field which has a similar name.
You should look for a custom field named "Test Plan" that has this description "Associate Test Plans with this Test Execution" (unless someone changed it).
To find the custom field id, you can ask your Jira admin to go to Custom Fields and then edit the field named "Test Plan"... Or you can also use Jira's REST API for that :)
https://yourjiraserver/rest/api/2/customFields?search=test%20plan
This will return a JSON content where you can see some custom fields, and you'll be able to depict the one you're looking for.

Unable to search for more than 20 chars in azure search

We are currently running into an issue when expanding our current azure search features.
When we have the following string indexed in azure search:
AEDE190EACWWG4VGLDE02000UHKPT
And we search for that complete string, we are not able to find it.
However, when we only use 20 chars, we are able to find it.
So the with the string below, we are able to find it
AEDE190EACWWG4VGLDE
However, when adding just 1 more char it disappears again. And this is not only within our implementation. This is also in azure itself when entering this within the query string
The field is set up as
Retrievable
Filterable
Searchable
Anyone know how to solve this issue?
I tested your scenario now, and it works fine. I cannot reproduce the problem you have. You don't specify which analyzer you use, so I'm going to assume you use the standard analyzer.
Here is how I tested.
I create a new index with two fields Id and Ordcode.
I upload two records via Postman
"value": [
{
"#search.action": "mergeOrUpload",
"Id": "1",
"Ordcode" : "AEDE190EACWWG4VGLDE02000UHKPT"
},
{
"#search.action": "mergeOrUpload",
"Id": "2",
"Ordcode": "ABC123"
}]
I search for your the string AEDE190EACWWG4VGLDE02000UHKPT using searchMode=all, queryType=full. The response is as expected.
{
"#odata.context": "https://<search-service>.search.windows.net/indexes('dg-test-65143696')/$metadata#docs(*)",
"#odata.count": 1,
"value": [
{
"#search.score": 0.2876821,
"Id": "1",
"Ordcode": "AEDE190EACWWG4VGLDE02000UHKPT"
}
]
}
I also tried to reproduce via the Search Explorer in the Azure Portal, even with simple mode and any (the default).
search=AEDE190EACWWG4VGLDE02000UHKPT&$count=true&$select=Id,Ordcode
There is a limit on the tokens produced (depending on the analyzer you use), but it's not 20 unless you have defined a shorter max token length.

Luis List Entities and Synonyms

I'm attempting to use list entities for my chat bot when dealing with environments and am having trouble finding information on using synonyms.
Lets say I have a dev, test, and prod environment. I want these environments limited to the normalized list items but I also want production to be a synonym for 'prod'. I would expect when a user asks 'Perform action x on production' that the 'environment' entity would be 'prod' because production is a synonym for prod. This is not the case though and the entity returns as 'production' instead. Perhaps I'm misunderstanding the purpose of the synonyms?
Link to screenshot: https://i.stack.imgur.com/PoPAv.png
You are proceeding almost correct. There is slight confusion while using "Test panel" inside LUIS.ai UI.
You have two options to get what you want.
1) While inspecting result in "Test panel" click "Compare with published" and then click at "Show JSON view" and you'll something like:
See https://learn.microsoft.com/en-us/azure/cognitive-services/luis/luis-interactive-test for more details.
2) use http GET towards REST API in your browser as an alternative:
https://yourLocaltion.api.cognitive.microsoft.com/luis/v2.0/apps/youAppId?subscription-key=yourSubscirptionId&q=lock%20development
The results in your case should be:
{
"query": "lock development",
"topScoringIntent": { ...
},
"entities": [
{
"entity": "development",
"type": "Environment",
"startIndex": 5,
"endIndex": 15,
"resolution": {
"values": [
"Dev"
]
...
See section "Manage" > "Keys and Endpoints" in your LUIS app administration to get details about correct url for using REST API.

How to include multiple TLDs in permissions of manifest.json?

Which is the best way for including the following urls (multiple TLDs) in manifest.json of a Chrome Extension? I want to include:
https://www.corporate.com/
https://www.corporate.de/
https://www.corporate.co.uk/
But the following form gives an error:
"permissions": [
"https://www.corporate.*/",
]
because the match pattern rules https://developer.chrome.com/apps/match_patterns indicate that the part can include a * only in the beginning.

Github API: determine if user or org

Given the URL https://github.com/foo/bar, I want to be able to get all the repos for foo. If foo is a user, I need to call api.repos.getForUser({username: 'foo'}) and if an org, I'll need to call api.repos.getForOrg({org: 'foo'}).
My problem is: how can I tell if "foo" is an org or a user?
Right now, I "solve" it in the costly way of trying to get an org called "foo", if I got it, I try to get its repos; if I end up getting an exception (I use promises) and if the code of the exception is "404", I assume "foo" is a user, and try to get user repos.
This is obviously inefficient, and has the side effect of adding calls that may trigger rate limit.
Is there an easier way to know whether "foo" is a user or an org?
As we all know, handling exceptions is costly. So instead of trying to get an org and handling the 404, you could instead look at the type property of the response to https://api.github.com/users/<username> in order to determine if the "user" is a user or organization and then proceed accordingly.
For example a call to my GitHub user API https://api.github.com/users/raghav710 returns
{
"login": "raghav710",
...
"type": "User",
...
}
And a call to an organization like https://api.github.com/users/Microsoft returns
{
"login": "Microsoft",
...
"type": "Organization",
...
}
Update: Doing it in a single call
I understand that you are already trying to access a URL https://github.com/<user or organization>/<repo name> and therein trying to get all the repos of that user or organization.
A suggestion is, instead of trying to do a GET on the above link, you could do a GET on https://api.github.com/repos/<user or organization>/<repo name>
For example doing a GET on https://api.github.com/repos/Microsoft/vscode
Gives
{
"id": 41881900,
"name": "vscode",
"full_name": "Microsoft/vscode",
"owner": {
"login": "Microsoft",
"id": 6154722,
...
"type": "Organization",
},
"private": false,
"html_url": "https://github.com/Microsoft/vscode",
...
}
As you can see the familiar type field is available under the owner key. You can use this to decide your next call
So even if there's an API call to differentiate, you'll still need that call to determine whether it's a user or not.
Considering the fact that most repositories should belong to users, why don't you reverse the checks? Try to retrieve the user repository, if that fails get the organization repository.
In addition, I'd cache as much information as necessary. Don't retrieve everything in real time while users use your tool. Many things won't change that often, if they're even able to be changed.

Resources