Netflix Conductor not retrying failed HTTP call? - netflix-conductor

I have a conductor workflow which makes an HTTP call to a service. When the service is completely down (not started), conductor just set the task and the workflow states to FAILED. I have added retry parameters to the HTTP task and am expecting the tool to retry the call 5 times before failing. I am doing anything wrong?
I am running conductor locally using docker.
Here is my workflow:
{
"createTime": 1674599429945,
"updateTime": 1674599615808,
"accessPolicy": {},
"name": "make_api_call",
"description": "A workflow that makes an api call",
"version": 2,
"tasks": [
{
"name": "make_call",
"taskReferenceName": "make_call_ref",
"inputParameters": {
"http_request": {
"uri": "${workflow.input.API_ENDPOINT}",
"method": "POST",
"headers": {
"Authorization": "Bearer ${workflow.input.token}"
},
"body": {
"email": "${workflow.input.email}"
},
"connectionTimeOut": 5000,
"readTimeOut": 5000
}
},
"type": "HTTP",
"startDelay": 0,
"optional": false,
"asyncComplete": false,
"retryCount": 5,
"timeoutSeconds": 30,
"timeoutPolicy": "RETRY"
}
],
"inputParameters": [],
"outputParameters": {
"data": {
"response": "${make_call_ref.output.response.body}"
}
},
"schemaVersion": 2,
"restartable": true,
"workflowStatusListenerEnabled": true,
"ownerEmail": "example#email.com",
"timeoutPolicy": "TIME_OUT_WF",
"timeoutSeconds": 5000,
"variables": {},
"inputTemplate": {}
}
and the input json:
{
"API_ENDPOINT": "http://host.docker.internal:4555/v1/users",
"token": "xxx",
"email": "johndoe#my-app.com"
}

Related

Sharepoint REST API - post comment on behalf of another user

There is a way of how to add comments to Sharepoint site using REST API. It is explained here https://beaucameron.com/2021/01/18/add-comments-to-sharepoint-list-items-using-the-rest-api/ for example.
But when I add comment like this, it adds it on behalf of my name - because REST endpoint is accessed using access token, which is linked to my e-mail.
I'd like to migrate comments from one site to the other, and keep original authors.
Is there a way to post comments on behalf of other users?
I tried this POST body:
{
"__metadata": {
"type": "Microsoft.SharePoint.Comments.comment"
},
"text": "Some new comment",
"author": {
"__metadata": {
"type": "SP.Sharing.Principal"
},
"email": "AlexW#OnMicrosoft.com",
"id": 18,
"loginName": "i:0#.f|membership|alexw#onmicrosoft.com",
"name": "Alex Wilber",
"principalType": 1
}
}
But still, comment is posted on behalf of my name. The response is like the following:
{
"d": {
"__metadata": {
"id": "https://sharepoint.com/_api/web/lists('017dd808-5a37-4d65-89f9-b5ce994554b4')/GetItemById(1)/Comments(15)",
"uri": "https://sharepoint.com/_api/web/lists('017dd808-5a37-4d65-89f9-b5ce994554b4')/GetItemById(1)/Comments(15)",
"type": "Microsoft.SharePoint.Comments.comment"
},
"likedBy": {
"__deferred": {
"uri": "https://sharepoint.com/_api/web/lists('017dd808-5a37-4d65-89f9-b5ce994554b4')/GetItemById(1)/Comments(15)/likedBy"
}
},
"replies": {
"__deferred": {
"uri": "https://sharepoint.com/_api/web/lists('017dd808-5a37-4d65-89f9-b5ce994554b4')/GetItemById(1)/Comments(15)/replies"
}
},
"author": {
"__metadata": {
"type": "SP.Sharing.Principal"
},
"email": "myName.mySurname#onmicrosoft.com",
"expiration": null,
"id": 12,
"isActive": true,
"isExternal": false,
"jobTitle": null,
"loginName": "i:0#.f|membership|myName.mySurname#onmicrosoft.com",
"name": "myName mySurname",
"principalType": 1,
"userId": null,
"userPrincipalName": null
},
"createdDate": "2022-05-24T08:40:19.0841947Z",
"id": "15",
"isLikedByUser": false,
"isReply": false,
"itemId": 1,
"likeCount": 0,
"listId": "017dd808-5a37-4d65-89f9-b5ce994554b4",
"mentions": null,
"parentId": "0",
"replyCount": 0,
"text": "Some new comment"
}
}
So still, I'm the author of the comment...

Elasticsearch NodeJS client shows inaccessible node as alive

I have a simple function in NodeJS which creates an Elasticsearch client with a cluster of nodes and returns one of the node URLs that is active:
// Elastic cluster nodes
const ELASTIC_CLUSTER_NODES = [
'http://node1.domain.com:9200',
'http://node2.domain.com:9200',
'http://node3.domain.com:9200',
];
async function getElasticsearchUrl() {
const { Client } = require('#elastic/elasticsearch');
const client = new Client({
nodes: ELASTIC_CLUSTER_NODES,
sniffOnStart: true,
sniffOnConnectionFail: true,
snifferTimeout: 60,
auth: {
username: 'username',
password: 'password'
}
});
// Return the first alive connection URL.
return (await client).connectionPool.connections.find((connection) => {
return connection.status === "alive";
}).url;
}
exports.getElasticsearchUrl = getElasticsearchUrl;
node1 is currently down. The expectation is that the client will sniff the hosts and return only 2 nodes that are alive - node2 and node3.
However, the client returns all 3 nodes as alive:
"connections": [
{
"url": "http://node1.domain.com:9200/",
"id": "http://node1.domain.com:9200/",
"headers": {},
"deadCount": 0,
"resurrectTimeout": 0,
"_openRequests": 1,
"status": "alive",
"roles": {
"master": true,
"data": true,
"ingest": true,
"ml": false
}
},
{
"url": "http://node2.domain.com:9200/",
"id": "http://node2.domain.com:9200/",
"headers": {},
"deadCount": 0,
"resurrectTimeout": 0,
"_openRequests": 0,
"status": "alive",
"roles": {
"master": true,
"data": true,
"ingest": true,
"ml": false
}
},
{
"url": "http://node3.domain.com:9200/",
"id": "http://node3.domain.com:9200/",
"headers": {},
"deadCount": 0,
"resurrectTimeout": 0,
"_openRequests": 0,
"status": "alive",
"roles": {
"master": true,
"data": true,
"ingest": true,
"ml": false
}
}
],
This causes the application to use node1's URL which is inaccessible, resulting in the application breaking. I cross-checked with the _nodes API which accurately returns 2 nodes as being alive:
{
"_nodes": {
"total": 2,
"successful": 2,
"failed": 0
},
"cluster_name": "my-cluster",
"nodes": {
"OcQeD7-cgRV_rMEkw21oAm": {
"name": "node3",
"transport_address": "xx.xxx.xx.100:9300",
"host": "xx.xxx.xx.100",
"ip": "xx.xxx.xx.100",
"version": "7.13.0",
"build_flavor": "default",
"build_type": "rpm",
"build_hash": "528ef91cc5cba6855f0a35386d966390ec1b20c5",
"roles": [
"data",
"data_cold",
"data_content",
"data_frozen",
"data_hot",
"data_warm",
"ingest",
"master",
"ml",
"remote_cluster_client",
"transform"
],
"attributes": {
"ml.machine_memory": "8201256960",
"ml.max_open_jobs": "512",
"xpack.installed": "true",
"ml.max_jvm_size": "4102029312",
"transform.node": "true"
},
"http": {
"bound_address": [
"xx.xxx.xx.100:9200"
],
"publish_address": "xx.xxx.xx.100:9200",
"max_content_length_in_bytes": 104857600
}
},
"N--DVxaQzbvDQqkUju9-Uu": {
"name": "node2",
"transport_address": "xx.xxx.xx.99:9300",
"host": "xx.xxx.xx.99",
"ip": "xx.xxx.xx.99",
"version": "7.13.0",
"build_flavor": "default",
"build_type": "rpm",
"build_hash": "3169552cdbce523538ec0f1fc98a6a665cb98500",
"roles": [
"data",
"data_cold",
"data_content",
"data_frozen",
"data_hot",
"data_warm",
"ingest",
"master",
"ml",
"remote_cluster_client",
"transform"
],
"attributes": {
"ml.machine_memory": "8201273344",
"xpack.installed": "true",
"transform.node": "true",
"ml.max_open_jobs": "512",
"ml.max_jvm_size": "4102029312"
},
"http": {
"bound_address": [
"xx.xxx.xx.99:9200"
],
"publish_address": "xx.xxx.xx.99:9200",
"max_content_length_in_bytes": 104857600
}
}
}
}
Is there anything wrong with the code or the logic to fetch the first available working Elasticsearch node URL? Any information on this would be really helpful.
Note: All sensitive info has been obfuscated.

Azure Logic App, deployed using DevOps, first step "When a HTTP request is received", how to get the URL as output variable

Long title: Azure Logic App, deployed using DevOps, first step "When a HTTP request is received", how to get the URL as output variable for use in deployment of App Service calling this Logic App?
My azure application is composed of two parts:
a Logic App
an App Service (web)
which are both deployed using DevOps.
The first step of the logic app is "When a HTTP request is received".
The web has a dependency on the generated url
(e.g. https://prod-23.usgovarizona.logic.azure.us:443/workflows/.../triggers/request/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Frequest%2Frun&sv=1.0&sig=...) of the logic app.
How do I get the URL of the logic apps' first step as an output variable,
so that I can supply that value in the deployment of the App Service,
which calls the Logic App?
I looked at https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-outputs?tabs=azure-powershell but that didn't help me.
release.json
{
"source": 2,
"revision": 59,
"description": null,
"lastRelease": {
"id": 853,
"name": "Release-37",
"artifacts": [],
"_links": {},
"description": "Triggered by SMS Scheduler 2020.206.01.",
"releaseDefinition": {
"id": 14,
"projectReference": null,
"_links": {}
},
},
"variables": {
"depr_AppTeam": {
"value": "SDIS"
},
"depr_DeptAbbr": {
"value": "ENT"
},
"depr_ResourceGroupName": {
"value": "$AppTeam+ \"-\"+ $AppName +\"-\"+$Env + \"-rg\""
}
},
"variableGroups": [
43
],
"environments": [
{
"id": 24,
"name": "DEV",
"rank": 1,
"variables": {},
"variableGroups": [],
"deployStep": {
"id": 90
},
"deployPhases": [
{
"deploymentInput": {
"parallelExecution": {
"parallelExecutionType": 0
},
"agentSpecification": {
"identifier": "vs2017-win2016"
},
"skipArtifactsDownload": false,
"artifactsDownloadInput": {
"downloadInputs": []
},
"queueId": 64,
"demands": [],
"enableAccessToken": false,
"timeoutInMinutes": 0,
"jobCancelTimeoutInMinutes": 1,
"condition": "succeeded()",
"overrideInputs": {}
},
"rank": 1,
"phaseType": 1,
"name": "Agent job",
"refName": null,
"workflowTasks": [
{
"environment": {},
"taskId": "94a...",
"version": "2.*",
"name": "Azure Deployment:Create Or Update Resource Group action on $(AppTeam)-$(AppName)-$(Release.EnvironmentName)-rg",
"refName": "",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"ConnectedServiceName": "nov...",
"action": "Create Or Update Resource Group",
"resourceGroupName": "$(AppTeam)-$(AppName)-$(Release.EnvironmentName)-rg",
"location": "USGov Arizona",
"templateLocation": "Linked artifact",
"csmFileLink": "",
"csmParametersFileLink": "",
"csmFile": "$(System.DefaultWorkingDirectory)/_ent_sms_scheduler/Job1/template.json",
"csmParametersFile": "$(System.DefaultWorkingDirectory)/_ent_sms_scheduler/Job1/parameters.json",
"overrideParameters": "",
"deploymentMode": "Incremental",
"enableDeploymentPrerequisites": "None",
"deploymentGroupEndpoint": "",
"project": "",
"deploymentGroupName": "",
"copyAzureVMTags": "true",
"runAgentServiceAsUser": "false",
"userName": "",
"password": "",
"outputVariable": "",
"deploymentName": "",
"deploymentOutputs": "",
"addSpnToEnvironment": "false"
}
},
]
}
],
},
],
"triggers": [
{
"artifactAlias": "_ent_sms_scheduler",
"triggerConditions": [],
"triggerType": 1
}
],
"releaseNameFormat": "Release-$(rev:r)",
"tags": [],
"properties": {
"DefinitionCreationSource": {
"$type": "System.String",
"$value": "ReleaseNew"
},
"IntegrateJiraWorkItems": {
"$type": "System.String",
"$value": "false"
},
"IntegrateBoardsWorkItems": {
"$type": "System.String",
"$value": "False"
}
},
"id": 14,
"name": "SMS SCHEDULER",
"path": "\\",
"projectReference": null,
"url": "https://vsrm.dev.azure.com/.../.../_apis/Release/definitions/14",
"_links": {
"self": {
"href": "https://vsrm.dev.azure.com/.../.../_apis/Release/definitions/14"
},
"web": {
"href": "https://dev.azure.com/.../.../_release?definitionId=14"
}
}
}
release task:
steps:
- task: AzureResourceGroupDeployment#2
displayName: 'Azure Deployment:Create Or Update Resource Group action on $(AppTeam)-$(AppName)-$(Release.EnvironmentName)-rg'
inputs:
azureSubscription: 'ENT-eComm-Deployment-NonProd-Gov-Connection'
resourceGroupName: '$(AppTeam)-$(AppName)-$(Release.EnvironmentName)-rg'
location: 'USGov Arizona'
csmFile: '$(System.DefaultWorkingDirectory)/_ent_sms_scheduler/Job1/template.json'
csmParametersFile: '$(System.DefaultWorkingDirectory)/_ent_sms_scheduler/Job1/parameters.json'
It seems that you deploy Azure Logic App first, and then App Service.
You can add an Azure Powershell task after you deploy the Azure Logic app. Call Get-AzLogicAppTriggerCallbackUrl
command to get specific Logic App trigger callback URL. Example:
Get-AzLogicAppTriggerCallbackUrl -ResourceGroupName "ResourceGroup11" -Name "LogicApp1" -TriggerName "manual"
Value
-----
https://prod-03.westus.logic.azure.com:443/workflows/c4ed9335bc864140a11f4508d19acea3/triggers/manual/run?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=
And then you can define variables whose value is the response URL. Follow use variables as inputs and detailed sample to output this variable to following tasks.

Create the message route in azure iothub using rest api

I am able to create the "message route" in azure portal and able to route messages to servicebusqueue if the query matching, I want to create the message route using the restapi instead of using azure portal, I have seen many documents but unable to find the proper one. Whether creating the message route using restapi is possible or not? if yes,How can I achieve this and please provide the respective links to refer?
I haven't tried this through REST API, but as Roman suggested,
You can check the IotHubResource_CreateOrUpdate which will help you understand how to Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub.
Sample Request:
PUT https://management.azure.com/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub?api-version=2018-04-01
Request Body:
{
"name": "iot-dps-cit-hub-1",
"type": "Microsoft.Devices/IotHubs",
"location": "centraluseuap",
"tags": {},
"etag": "AAAAAAFD6M4=",
"properties": {
"operationsMonitoringProperties": {
"events": {
"None": "None",
"Connections": "None",
"DeviceTelemetry": "None",
"C2DCommands": "None",
"DeviceIdentityOperations": "None",
"FileUploadOperations": "None",
"Routes": "None"
}
},
"state": "Active",
"provisioningState": "Succeeded",
"ipFilterRules": [],
"hostName": "iot-dps-cit-hub-1.azure-devices.net",
"eventHubEndpoints": {
"events": {
"retentionTimeInDays": 1,
"partitionCount": 2,
"partitionIds": [
"0",
"1"
],
"path": "iot-dps-cit-hub-1",
"endpoint": "sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"
},
"operationsMonitoringEvents": {
"retentionTimeInDays": 1,
"partitionCount": 2,
"partitionIds": [
"0",
"1"
],
"path": "iot-dps-cit-hub-1-operationmonitoring",
"endpoint": "sb://iothub-ns-iot-dps-ci-245306-76aca8e13b.servicebus.windows.net/"
}
},
"routing": {
"endpoints": {
"serviceBusQueues": [],
"serviceBusTopics": [],
"eventHubs": [],
"storageContainers": []
},
"routes": [],
"fallbackRoute": {
"name": "$fallback",
"source": "DeviceMessages",
"condition": "true",
"endpointNames": [
"events"
],
"isEnabled": true
}
},
"storageEndpoints": {
"$default": {
"sasTtlAsIso8601": "PT1H",
"connectionString": "",
"containerName": ""
}
},
"messagingEndpoints": {
"fileNotifications": {
"lockDurationAsIso8601": "PT1M",
"ttlAsIso8601": "PT1H",
"maxDeliveryCount": 10
}
},
"enableFileUploadNotifications": false,
"cloudToDevice": {
"maxDeliveryCount": 10,
"defaultTtlAsIso8601": "PT1H",
"feedback": {
"lockDurationAsIso8601": "PT1M",
"ttlAsIso8601": "PT1H",
"maxDeliveryCount": 10
}
},
"features": "None"
},
"sku": {
"name": "S1",
"tier": "Standard",
"capacity": 1
}
}

Node.js: Sending Cucumber JSON results to Jira's Xray - jira-client-xray gives HTTP 405 error

I'm struggling 5th day with sending test results to Jira. Our Jira has latest Xray plugin.
I use Node.js for test automation. I went easiest way to try Xray's capability of swallowing test automation results: 'jira-client-xray' dependency + Cucumber test.
In Jira I have Test Execution (id is KELLO-2426), what includes 1 Test (id is KELLO-2427) with Cucumber steps - Jira_Xray_Auto_Test.PNG.
I have 1 feature file - Feature_file.PNG.
After running the test/feature I got JSON-file with results:
[
{
"keyword": "Feature",
"description": "",
"line": 1,
"name": "Sample Snippets test",
"uri": "Can not be determined",
"tags": [],
"elements": [
{
"keyword": "Scenario",
"description": "",
"name": "open URL",
"tags": [
{
"name": "#KELLO:2426",
"location": {
"line": 6,
"column": 5
}
}
],
"id": "sample-snippets-test;open-url",
"steps": [
{
"arguments": [],
"keyword": "Before",
"name": "Hook",
"result": {
"status": "passed",
"duration": 1301000000
},
"line": "",
"match": {
"location": "can not be determined with webdriver.io"
}
},
{
"arguments": [],
"keyword": "Given",
"name": "the page url is not \"http://webdriverjs.christian-bromann.com/\"",
"result": {
"status": "passed",
"duration": 257000000
},
"line": 8,
"match": {
"location": "can not be determined with webdriver.io"
}
},
{
"arguments": [],
"keyword": "And",
"name": "I open the url \"http://webdriverjs.christian-bromann.com/\"",
"result": {
"status": "passed",
"duration": 1221000000
},
"line": 9,
"match": {
"location": "can not be determined with webdriver.io"
}
},
{
"arguments": [],
"keyword": "Then",
"name": "I expect that the url is \"http://webdriverjs.christian-bromann.com/\"",
"result": {
"status": "passed",
"duration": 244000000
},
"line": 10,
"match": {
"location": "can not be determined with webdriver.io"
}
},
{
"arguments": [],
"keyword": "And",
"name": "I expect that the url is not \"http://google.com\"",
"result": {
"status": "passed",
"duration": 205000000
},
"line": 11,
"match": {
"location": "can not be determined with webdriver.io"
}
},
{
"arguments": [],
"keyword": "After",
"name": "Hook",
"result": {
"status": "passed",
"duration": 186000000
},
"line": "",
"match": {
"location": "can not be determined with webdriver.io"
}
}
]
}
],
"id": "sample-snippets-test",
"metadata": {
"browser": {
"name": "chrome",
"version": "72.0.3626.121"
},
"device": "Device name not known",
"platform": {
"name": "Platform name not known",
"version": "Version not known"
}
}
}
]
Next, I have 'jira.client.xray.js' file, where sending the results is written:
var JiraApiWithXray = require('jira-client-xray');
// Initialize
var jiraXray = new JiraApiWithXray({
strictSSL: false,
protocol: 'https',
username: 'your_username',
password: 'your_password',
host: 'your_host',
apiVersion: '1.0' //Check version from DevTools -> Network tab
});
const testExecResults = './results/sample-snippets-test.1574077621820.json';
try {
jiraXray.importExecResultsFromCucumber(testExecResults).then(function (testExecIssueId) {});
} catch(ex) {
console.log('Error:');
console.log(ex);
}
Initiating delivery of the test results by command node jira.client.xray.js from projects root directory gives me the following error:
UnhandledPromiseRejectionWarning: StatusCodeError: 405 - undefined
What is wrong? Suggest me please.
Yours sincerely,
JS comrade
Here shows the error you are receiving
https://restfulapi.net/http-status-codes/
That would lead me to believe it is a problem with your request being sent. My initial thoughts are testExecResults is in the wrong structure based on the documentation https://www.npmjs.com/package/jira-client-xray
Please post the request being sent.

Resources