Sonarqube: How to get the id of quality gate - sonarqube

I have several quality gates created within sonarqube and I would like to know how to obtain the ids of each of them

On the official documentation you can find following methods:
GET api/qualitygates/get_by_project
Get the quality gate of a project.
Requires one of the following permissions:
- 'Administer System'
- 'Administer' rights on the specified project
- 'Browse' on the specified project
ParametersResponse
{
"qualityGate": {
"id": "AU-Tpxb--iU5OvuD2FLy",
"name": "My team QG",
"default": false
}
}
and
GET api/qualitygates/list
Get a list of quality gates
Response
{
"qualitygates": [
{
"id": "AU-Tpxb--iU5OvuD2FLy",
"name": "Sonar way",
"isDefault": true,
"isBuiltIn": true,
"actions": {
"rename": false,
"setAsDefault": false,
"copy": true,
"associateProjects": false,
"delete": false,
"manageConditions": false
}
},
{
"id": "AU-Tpxb--iU5OvuD2FLz",
"name": "Sonar way - Without Coverage",
"isDefault": false,
"isBuiltIn": false,
"actions": {
"rename": true,
"setAsDefault": true,
"copy": true,
"associateProjects": true,
"delete": true,
"manageConditions": true
}
}
],
"default": 8,
"actions": {
"create": true
}
}
Both of these methods will return ids.

I would first urge you to step back and describe exactly what you need to get done.
However, you can get information about quality gates and other SonarQube components from the WebAPI rest interface. Go into your SonarQube gui, go to the bottom of the page, and click on the "Web API" link. Enter "quality gate" in the filter to see information about all of the endpoints related to quality gates.

Related

Ansible AXW ignores extra_vars

I want to launch a Job-Template via the AWX-API including some extra_vars, but every response I get has an empty extra_vars field. I already checked the documentation about it:
https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#extra-variables
which states, that you have to set ask_variables_on_launch: true and/or have corresponding variables in a survey. My Request checks both of these conditions:
Request
POST: https://my.awx.host/api/v2/job_templates/7/launch/
Body
{
"can_start_without_user_input": false,
"passwords_needed_to_start": [],
"ask_scm_branch_on_launch": false,
"ask_variables_on_launch": true,
"ask_tags_on_launch": false,
"ask_diff_mode_on_launch": false,
"ask_skip_tags_on_launch": false,
"ask_job_type_on_launch": false,
"ask_limit_on_launch": false,
"ask_verbosity_on_launch": false,
"ask_inventory_on_launch": false,
"ask_credential_on_launch": false,
"survey_enabled": true,
"variables_needed_to_start": [
"application_server_name",
"server_location",
"application_server_type",
"ssh_keys"
],
"credential_needed_to_start": false,
"inventory_needed_to_start": false,
"job_template_data": {
"name": "template name ",
"id": 7,
"description": ""
},
"defaults": {
"extra_vars": {
"application_server_name": "some name",
"server_location": "some location",
"application_server_type": "some type",
"ssh_keys": [
{
"name": "key1"
},
{
"name": "key2"
},
{
"name": "key3"
}
]
},
"diff_mode": false,
"limit": "",
"job_tags": "",
"skip_tags": "",
"job_type": "run",
"verbosity": 2,
"inventory": {
"name": "AWX Tower (Localhost) my.awx.host",
"id": 1
},
"credentials": [
{
...
}
],
"scm_branch": ""
}}
Response
{
"variables_needed_to_start": [
"'application_server_name' value missing",
"'server_location' value missing",
"'application_server_type' value missing",
"'ssh_keys' value missing"
]}
I'm kinda confused, since I did everything according to the documentation. The values needed by the survey are even in the same Request Body. Could someone help with this problem?
I'm using AWX 16.0.0
Ansible Version 2.9.15
Thanks
So actually, you have to send just the extra vars, not the whole response + vars you get from the AWX. I don't know, if I didn't see this in the docs, or if it's just plain obvious and I did't get it.
ask_variables_on_launch still has to be true!

Where and how can I view a generated database query

I have a small question:
Where and how can I view a generated database query, via "Debug" or "Strapi.log.info(...)"?
Many greetings
You can in you config/environments/development/database.json file into the options object add the following "debug": true
You will be able to see all the database requests.
eg. for a SQLite database connection
{
"defaultConnection": "default",
"connections": {
"default": {
"connector": "bookshelf",
"settings": {
"client": "sqlite",
"filename": ".tmp/data.db"
},
"options": {
"useNullAsDefault": true,
"debug": true
}
}
}
}

Magento 2 Klarna checkout

I need to integrate the Klarna Checkout module into magento 2.1.2. I am using the version of the "klarna/m2-checkout module": 4.2.2.
When choosing a delivery method, I always get an error in the pop-up window:
Sorry, the delivery option you chose cannot be processed. Please select another delivery option.
When i choose shipping method, i get this responce:
{
"shared": {
"customer": {
"type": "person"
},
"user_preferences": {
"remember_me": true
},
"language": "en",
"locale": "en-US",
"customer_details": {
"client_token": "eyJhbGciOiJSUzUxMiJ9.eyJz",
"country": "swe",
"completed": true,
"fields_with_obfuscation": {
"email": "melosicuva#royalhost.info",
"given_name": "Testperson-se",
"family_name": "Approved",
"street_address": "Stårgatan 1",
"postal_code": "123 45",
"city": "Ankeborg",
"country": "SE",
"phone": "076-526 00 00",
"date_of_birth": "1941-03-21",
"national_identification_number": "19410321-9202"
},
"reference": "2f9a445a57a49215175178099002fc7165ee"
},
"shipping_details": {
"client_token": "eyJhbGciOiJSUzUxMiJ9.eyJzZXNzaW9uX"
},
"currency": "SEK",
"obfuscated_fields": []
},
"cart": {
"total_tax_amount": 30000,
"total_price_including_tax": 150000,
"total_price_excluding_tax": 120000,
"total_shipping_amount_excluding_tax": 0,
"total_surcharge_amount_excluding_tax": 0,
"total_discount_amount_excluding_tax": 0,
"total_shipping_amount_including_tax": 0,
"total_surcharge_amount_including_tax": 0,
"total_discount_amount_including_tax": 0,
"subtotal": 120000,
"total_store_credit": 0,
"items": [{
"type": "physical",
"reference": "1201018390010",
"name": "Armour Bib Shorts",
"quantity": 1,
"unit_price": 150000,
"total_tax_amount": 30000,
"tax_rate": 2500,
"total_price_including_tax": 150000,
"total_price_excluding_tax": 120000,
"product_url": "https://local.com/armour-bib-shorts-black.html?___store%5B_data%5D%5Bstore_id%5D=2&___store%5B_data%5D%5Bcode%5D=se&___store%5B_data%5D%5Bwebsite_id%5D=2&___store%5B_data%5D%5Bgroup_id%5D=2&___store%5B_data%5D%5Bname%5D=Sweden+Store&___store%5B_data%5D%5Bsort_order%5D=30&___store%5B_data%5D%5Bis_active%5D=1&___store%5B_data%5D%5Balias%5D=Sweden&___store%5B_data%5D%5Bavailable_currency_codes%5D%5B0%5D=SEK",
"image_url": "https://local.com//media/catalog/product/a/r/armour-bib-shorts-aw18-01.jpg"
}]
},
"errors": {
"generic": ["shipping_service_failed"]
},
"options": {
"allow_separate_shipping_address": false,
"date_of_birth_mandatory": false,
"title_mandatory": false,
"national_identification_number_mandatory": false,
"phone_mandatory": true,
"allowed_customer_types": ["person"],
"payment_selector_on_load": false
},
"preview_payment_methods": [{
"id": "-1",
"type": "invoice",
"locked": false,
"selected": false,
"data": {
"days": 14
}
}, {
"id": "-1",
"type": "direct_debit",
"locked": false,
"selected": false
}, {
"id": "-1",
"type": "credit_card",
"locked": false,
"selected": false,
"data": {
"available_cards": ["VISA", "MASTER"],
"allow_saved_card": false,
"do_save_card": false,
"collect_consent": false,
"consent_given": false
}
}],
"allowed_billing_countries": ["swe"],
"status": {
"prescreened": false
},
"analytics_user_id": "ELmpDn1f600JYxHtagC7FcsOdAXe9-2iwWhIzHSfmhM=",
"merchant": {
"hashed_id": "a9c814c7a780d46a7fb2403e452829b3",
"name": "Your business name"
},
"merchant_urls": {
"checkout": "https://local.com/checkout/klarna",
"confirmation": "https://checkout-eu.playground.klarna.com/yaco/orders/ffc4101d-00cb-5e63-81fc-0f0c15baeac3/redirect?auth_token=0el7mltb89prfz2fz2mw",
"terms": "https://local.com/terms",
"confirmation_page": "https://local.com/checkout/klarna/confirmation/id/ffc4101d-00cb-5e63-81fc-0f0c15baeac3"
}
}
Here I do not like the block:
"errors": {
"generic": ["shipping_service_failed"]
}
Does anyone know how to fix it?
Delivery error :
This error occurs when you set address_update callback and and it's not handled in the right way. This callback should be set if you need to update order's addresses, and should not take more than 10 sec.
Here's an example: https://developers.klarna.com/api/#checkout-api-callbacks-address-update
And some best practices: https://developers.klarna.com/documentation/klarna-checkout/best-practices/#address-updated
If you run Klarna Checkout on localhost, then you should make the localhost-based application reachable from Klarna via the HTTP protocol (e.g., for the address_update callback).
You can do it via services like Ngrok.
In case of this error it's good to know that:
Klarna Checkout is calling callbacks regarding the shipping on checkout page:
address_update
shipping_option_update
If Klarna doesn't receive the answer from callback request in 10s it will end the connection and eventually you will see the error message. You can find access status logs in your http server, for example access status 499 in nginx. On the other hand in Klarna Merchant Portal you will see logs with status "???".
The callback request may be not accessible or not accessible in time below 10s:
if you work on localhost configure tunnel to expose your local environment to be visible by Klarna. For example with ngrok.
make sure that magento cache is enabled.
disable xdebug (unless it's version >=3)
check internet connection quality
check php.ini and http server performance related settings
If error still occurs you can debug the callback api to find the bottleneck. For example you can use logs in Klarna Merchant Portal to create a postman request to the callback api.

Alexa Skill: Interaction model is not being updated during test

I am developing a Alexa Skill and I have an Intent named NewAppointmentIntent which originally had 7 slots.
I have added a new Slot yesterday named Doctor and successfully built the Skill.
When I invoke that intent, it still have 7 Slots and not 8. The Doctor Slot does not appears in the request and responses outputs.
The Intent in images:
The output when invocing the Intent, where slot Doctor expected in slots attribute:
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.9529849e-190d-4278-95a8-3702b3ee4d1c",
"timestamp": "2018-12-12T10:05:14Z",
"locale": "en-US",
"intent": {
"name": "NewAppointmentIntent",
"confirmationStatus": "NONE",
"slots": {
"Status": {
"name": "Status",
"confirmationStatus": "NONE"
},
"Comment": {
"name": "Comment",
"confirmationStatus": "NONE"
},
"ReasonForVisit": {
"name": "ReasonForVisit",
"confirmationStatus": "NONE"
},
"Time": {
"name": "Time",
"confirmationStatus": "NONE"
},
"EmergencyType": {
"name": "EmergencyType",
"confirmationStatus": "NONE"
},
"PatientNumber": {
"name": "PatientNumber",
"confirmationStatus": "NONE"
},
"Day": {
"name": "Day",
"confirmationStatus": "NONE"
}
}
},
"dialogState": "STARTED"
}
So I wish to know how to refresh the Skill?
Close the window, re-open and in your console -> Save the model -> Build the model. Then test again.
If still doesn't show, click on the JSON Editor(this will be the last option in the list of your Interaction model), then in your NewAppointmentIntent can you see the Docter slot in the slots array?
If not, then maybe something was broken when you created the slot. So delete the Docter slot and re-add it. Then again verify it in JSON editor and this should solve the problem.

How to set class-level permissions through CLI or Cloud Code?

The official blog mentioned setting class-level permissions through the data browser.
http://blog.parse.com/2014/07/07/parse-security-ii-class-hysteria/
Is there any way to do the same through CLI or Cloud Code?
It's needed for the automation of the installation process of our app on Parse.com.
Unfortunately those features are only available from the Data Browser.
Sounds like it could be an interesting feature request. I'm not sure if there's an official channel for making feature requests (maybe a bug report?) but you could try the Google Group page, you can find the link here:
https://parse.com/help/
You can invoke REST API like they mention here.
http://parseplatform.github.io/docs/js/guide/#pointer-permissions
(this was also obtained by looking at the inspector Parse Dashboard)
//POST http://localhost:8000/parse/schemas/Post
{
"classLevelPermissions": {
"get": {
"*": true,
"role:admin": true
},
"find": {
"*": true,
"role:admin": true
},
"create": {
"role:admin": true
},
"update": {
"role:admin": true
},
"delete": {
"role:admin": true
},
"addField": {
"*": true,
"role:admin": true
},
"readUserFields": [
"owner"
],
"writeUserFields": [
"owner"
]
},
"_method": "PUT",
"_ApplicationId": "MY_APPLICATION_ID",
"_ClientVersion": "js1.6.14",
"_MasterKey": "MY_MASTER_KEY",
"_InstallationId": "e703b6b0-c992-92af-3cf7-3b1ad09739cd"
}

Resources