Run Pipeline REST API queue time variables not appearing - rest

I'm using this https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run%20pipeline?view=azure-devops-rest-6.1 to run a pipeline.
POST https://dev.azure.com/company/project/_apis/pipelines/38507/runs?api-version=6.1-preview.1
HEADERS
Content-Type & Accept = application/json
I was able to trigger it, however I cannot seem to put together the body to create the queue time variables.
{
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/master"
}
}
},
"parameters": {
"sequenceNumber": 65
},
"variables": {
}
}
I also tried using "runParameters", "templateParameters" was giving me an error.
Here's a screenshot of the pipeline without the queue time variables:

Did you try this:
{
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/master"
}
}
},
"variables": {
"sequenceNumber": {
"isSecret": false,
"value": 65
}
}
}

Related

GitHub GraphQL API Filter on custom text field in Project V2

We are using GitHub Projects (Beta). I created a custom text field called oma-project. I want to use the API to filter on this field, e.g., oma-project: "P0001". This should return all issues with this value in the custom field.
Looking at the Projects (beta) docs, I can list the first n issues but I don't know how I can pass a filter based on the value of the custom field.
This is as far as I have gotten.
{
node(id: "nodeid") {
... on ProjectV2 {
items(first: 2) {
nodes {
fieldValues(first: 8) {
nodes {
... on ProjectV2ItemFieldTextValue {
text
field {
... on ProjectV2FieldCommon {
name
}
}
}
}
}
content {
... on Issue {
id
title
}
}
}
}
}
}
}
returns:
{
"data": {
"node": {
"items": {
"nodes": [
{
"fieldValues": {
"nodes": [
{},
{},
{},
{
"text": "Retrieve Notes via OData",
"field": {
"name": "Title"
}
},
{},
{
"text": "P9999",
"field": {
"name": "OMA Project"
}
}
]
},
"content": {
"id": "I_kwDOFT-pvM5AZNLm",
"title": "Retrieve Notes via OData"
}
},
{
"fieldValues": {
"nodes": [
{},
{},
{
"text": "Capex Approval Type",
"field": {
"name": "Title"
}
},
{},
{},
{
"text": "P0708",
"field": {
"name": "OMA Project"
}
}
]
},
"content": {
"id": "I_kwDOFT-pvM5K85HZ",
"title": "Capex Approval Type"
}
}
]
}
}
}
}
I'm having the same issue when working on a GitHub action to move a list of items from a status to another status, and it seems currently the API doesn't support ProjectV2 item filtering.
My current workaround is to query all the items from the project and then later filter out the results using jq or JavaScript

Wiremock JSON proxyBaseUrl with one value change in response

I want to achieve a proxy from another url with changing one value within the response
So having something like that (not working, just an idea)
{
"request": {
"method": "GET",
"urlPathPattern": "/api/search-service"
},
"response": {
"proxyBaseUrl" : "https://external-search-service",
"transformerParameters": {
"results[*].hasAccess": true
}
}
}
}
When you call GET https://external-search-service/api/search-service the response is
{
"meta": {
"results": 2
},
"results": [
{
"id": "1",
"path": "/path/1",
"hasAccess": false
},
{
"id": "2",
"path": "/path/2",
"hasAccess": false
}
]
}
And when I want to temper with response using wiremock when you call GET https://wiremock/api/search-service the response I expect is
{
"meta": {
"results": 2
},
"results": [
{
"id": "1",
"path": "/path/1",
"hasAccess": true
},
{
"id": "2",
"path": "/path/2",
"hasAccess": true
}
]
}
How this can be achieved with JSON notation?
This isn't achievable purely using JSON configuration, but you can create a Java extension to transform responses, which will work with proxied responses.
To do this you would need to create an implementation of ResponseTransformer and register it with WireMock on startup.
Full details of how to do this are here: https://wiremock.org/docs/extending-wiremock/#response-transformation

FAILURE answer from kie-server (using kie-server-showcase and business-central-workbench-showcase)

I am testing business-central with kie-server both running in docker, both are "showcase" versions. I've made project in business-central with "Cow" model (pic) and decision table (pic) for it. Build & Deploy is successful.
After sending json with request body
{
"commands:": [
{
"insert": {
"object": {
"Cow": {
"name": "cow1",
"age": 11
}
},
"out-identifier": "Cow",
"return-object": true
}
},
{
"fire-all-rules": {}
}
]
}
to endpoint
http://localhost:8180/kie-server/services/rest/server/containers/instances/Cow
receiving an error:
{
"type": "FAILURE",
"msg": "Bad request, no commands to be executed - either wrong format or no data",
"result": null
}
Is there anything that I am doing wrong? Why my request doesn't proceed?
I think in your request you need the canonical class name com.axaukraine.Cow, but you are using just the simple name Cow.
{
"commands:": [
{
"insert": {
"object": {
"com.axaukraine.Cow": {
"name": "cow1",
"age": 11
}
},
"out-identifier": "Cow",
"return-object": true
}
},
{
"fire-all-rules": {}
}
]
}

Cloudformation SNS template validation error

I am trying to create sns subscription but I am getting template validation error.
'MySNSTopic' is the Logical ID of the cloudformation stack called testsnstopic.
Is this correct. Can anyone explain what value I should give for 'Ref' here
"TopicArn" : {
"Ref": "MySNSTopic"
}
Template validation error:
Template format error: Unresolved resource dependencies [MySNSTopic] in the Resources block of the template
code:
{
"Resources": {
"MySubscription" : {
"Type" : "AWS::SNS::Subscription",
"Properties" : {
"Endpoint" : "test#abc.com",
"Protocol" : "email",
"TopicArn" : {
"Ref": "MySNSTopic"
}
}
}
}
}
To use properties across different stacks, you need to explicitly export the values on the one end and import into the other stack.
In your case you would propably need something like this:
Stack: sns-test
{
"Resources": {
"MySNSTopic": {
"Type": "AWS::SNS::Topic"
}
},
"Outputs": {
"MySNSTopicOutput": {
"Description": "SNS topic arn",
"Value": {
"Ref": "MySNSTopic"
},
"Export": {
"Name": {
"Fn::Sub": "${AWS::StackName}-MySNSTopicExport"
}
}
}
}
}
Stack: sns-subscription
{
"Resources": {
"MySubscription": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Endpoint": "jens#apimeister.com",
"Protocol": "email",
"TopicArn": {
"Fn::ImportValue" : "sns-test-MySNSTopicExport"
}
}
}
}
}

CloudFormation - Access Output of Parent Stack in Child Nested stack

I have a master Cloudformation template which invokes two child templates. I have my first template run and the Outputs captured in the Outputs section of the resource. I have given lot of tries in using the ChildStack01 Output values in the Second Template which is nested and I am not sure why I get Template format error: Unresolved resource dependencies [XYZ] in the Resources block of the template. Here is my master template.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"LambdaStack": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"TemplateURL": "https://s3.amazonaws.com/bucket1/cloudformation/Test1.json",
"TimeoutInMinutes": "60"
}
},
"PermissionsStack": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"TemplateURL": "https://s3.amazonaws.com/bucket1/cloudformation/Test2.json",
"Parameters": {
"LambdaTest": {
"Fn::GetAtt": ["LambdaStack", "Outputs.LambdaTest"]
}
},
"TimeoutInMinutes": "60"
}
}
}
}
Here is my Test1.json Template
{
"Resources": {
"LambdaTestRes": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Description": "Testing AWS cloud formation",
"FunctionName": "LambdaTest",
"Handler": "lambda_handler.lambda_handler",
"MemorySize": 128,
"Role": "arn:aws:iam::3423435234235:role/lambda_role",
"Runtime": "python2.7",
"Timeout": 300,
"Code": {
"S3Bucket": "bucket1",
"S3Key": "cloudformation/XYZ.zip"
}
}
}
},
"Outputs": {
"LambdaTest": {
"Value": {
"Fn::GetAtt": ["LambdaTestRes", "Arn"]
}
}
}
}
Here is My Test2.json which has to use the output of Test1.json.
{
"Resources": {
"LambdaPermissionLambdaTest": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:invokeFunction",
"FunctionName": {
"Ref": "LambdaTest"
},
"Principal": "apigateway.amazonaws.com",
"SourceArn": {
"Fn::Join": ["", ["arn:aws:execute-api:", {
"Ref": "AWS::Region"
}, ":", {
"Ref": "AWS::AccountId"
}, ":", {
"Ref": "TestAPI"
}, "/*"]]
}
}
}
},
"Parameters": {
"LambdaTest": {
"Type": "String"
}
}
}
It is not enough to just have output, you need to export that output.
Look here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-exports.html
So you need something like:
"Outputs": {
"LambdaTest": {
"Value": {
"Fn::GetAtt": ["LambdaTestRes", "Arn"]
}
"Export": {
"Name": "LambdaTest"
}
}
}
You have two unresolved Ref resource dependencies in Test2.json, one to LambdaTest and one to TestAPI.
For LambdaTest, it looks like you're trying to pass this as a parameter from the parent stack, but you haven't specified it as an input Parameter in the child Test2.json template. Add an entry in Test2.json's Parameters section, like this:
"Parameters": {
"LambdaTest": {
"Type": "String"
}
},
Regarding TestAPI, this reference doesn't seem to appear anywhere else in your templates, so you should either specify this as a fixed string directly, or add another input Parameter in your Test2.json stack (see above) and then provide it from the parent stack.
The error is coming from test1.json(LambdaStack).
Logical ID
An identifier for the current output. The logical ID must be alphanumeric (a-z, A-Z, 0-9) and unique within the template.
It seems you have two logical ID with the same name "LambdaTest", one in resource section and other in output section.