Azure DevOps service hook - "build for ![repo item].... ![Branch icon]" - azure-devops

I've just set up a service hook for one of the projects in our on-site DevOps server, that uses a "Incoming Webhook" connector to an Outlook Group.
The hook seems to work fine - I'm getting the notifications I'm expecting through just fine. However, there seems to be an issue with what I assume is supposed to be graphics.
For example, for the "build succeeded" service hook, I receive the following email:
Looking at the status message, it states:
"Build for !Repo Icon.... !Branch Icon..."
I assume these are SUPPOSED to be images, but I can't figure out why they're not being shown as such?
Examining the request JSON that is sent from DevOps to Office 365, I can see it's passing through that specific text, but I think its being perceived as a link markdown, rather than an image:
"text": "Build for ![Repo Icon](https://cdn.vsassets.io/content/notifications/teams-pushrepo.png) [JamalHartnettUserBranch](https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/_git/71777fbc-1cf2-4bd1-9540-128c1c71f766) ![Branch Icon](https://cdn.vsassets.io/content/notifications/teams-branch.png) [master](https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/_git/71777fbc-1cf2-4bd1-9540-128c1c71f766/#version=GBmaster), finished 04/07/2015 17:24:20 UTC"
Anyone have an idea how I'd fix this?
I know there's a specific Azure DevOps connector, but that only works with cloud-based DevOps instances, not private on-site ones (at least, as far as I can tell)
For reference, here's the full json request message (with private urls removed):
Method: POST
URI: https://outlook.office.com/webhook/<obfuscated>/IncomingWebhook/<obfuscated>/<obfuscated>
HTTP Version: 1.1
Headers:
{
Content-Type: application/json; charset=utf-8
}
Content:
{
"sender": "Azure DevOps Services",
"summary": "Build 20150407.2 - succeeded",
"themeColor": "#107c10",
"title": null,
"text": null,
"sections": [{
"title": null,
"markdown": true,
"images": null,
"activityTitle": "[CustomerAddressModule / 20150407.2](https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/71777fbc-1cf2-4bd1-9540-128c1c71f766/_apis/build/Builds/1) (Succeeded)",
"activitySubtitle": "Trigger: batchedCI for [Jamal Hartnett](mailto:Jamal.Hartnett#Fabrikamcloud.com)",
"text": "Build for ![Repo Icon](https://cdn.vsassets.io/content/notifications/teams-pushrepo.png) [JamalHartnettUserBranch](https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/_git/71777fbc-1cf2-4bd1-9540-128c1c71f766) ![Branch Icon](https://cdn.vsassets.io/content/notifications/teams-branch.png) [master](https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/_git/71777fbc-1cf2-4bd1-9540-128c1c71f766/#version=GBmaster), finished 04/07/2015 17:24:20 UTC",
"activityImage": "https://cdn.vsassets.io/content/notifications/teams-build-succeeded.png",
"activityImageType": "article"
}],
"potentialAction": [{
"#context": "http://schema.org",
"#type": "ViewAction",
"name": "View build",
"target": [
"https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/71777fbc-1cf2-4bd1-9540-128c1c71f766/_apis/build/Builds/1"]
}]
}

Related

Create GitHub service connection using azure rest api giving error

I am trying to create GitHub service connection using azure Devops rest api -
In postman I put following Json Body-
{
"name": "release-1",
"type": "github",
"url": "https://github.com",
"authorization": {
"scheme": "PersonalAccessToken",
"parameters": {
"accessToken": "<Github_Personal_Access_Token>"
}
}
}
This Creates service connection but It gives error when I open service connection in UI and try to verify but if I edit and replace with same Github token In UI then it works. seems like its not taking token I am providing in Json body -
I also see information here on this ongoing issue - https://ljvmiranda921.github.io/notebook/2019/12/28/workaround-azure-github-pat/
I want to automate GitHub service connection creation.
How to create GitHub service connection using Azure Devops rest api ?
How to create GitHub service connection using Azure Devops rest api ?
Are you creating this GitHub service connection?
If so, you should use EndPoints-Create API and your Json Body can follow this format:
{
"authorization": {
"scheme": "Token",
"parameters": {"AccessToken": "YourGitHubPAT"}
},
"data": {},
"description": "",
"name": "YourServiceConnectionName",
"serviceEndpointProjectReferences": [{
"description": "",
"name": "YourServiceConnectionName",
"projectReference": {
"id": "YourProjectID",
"name": "YourProjectName"
}
}],
"type": "github",
"url": "https://github.com",
"isShared": false
}
We should enter the value of YourGitHubPAT, YourServiceConnectionName(twice in two points), YourProjectID and YourProjectName with your own values to make the body work. We can get YourProjectID via Projects-List API.
After running that in PostMan, I can verify it successfully without issues. I guess your issue may have something to do with your parameters. Use
"authorization": {
"scheme": "Token",
"parameters": {"AccessToken": "<Github_Personal_Access_Token>"}
},
Instead of
"authorization": {
"scheme": "PersonalAccessToken",
"parameters": {"accessToken": "<Github_Personal_Access_Token>"}
Update about how to enable grant access to all pipelines:
Dislike other elements like Token, Name and Description, Grant Access Permissions to all pipelines option is managed by another API.
API to enable this option:
https://dev.azure.com/{YourOrganizationName}/{YourProjectName}/_apis/pipelines/pipelinePermissions/endpoint/{YourEndPointID}?api-version=5.1-preview.1
Body:
{
"resource": {
"id": "YourEndPointID",
"type": "endpoint",
"name": ""
},
"pipelines": [],
"allPipelines": {
"authorized": true,
"authorizedBy": null,
"authorizedOn": null
}
}
Note: We need to enter EnterPointID in URL and Body. (Twice!)
In PostMan, you should use PATCH method and application/json type. The YourEndPointID is ServiceConnectionID, you can get this value from EndPoints-Create API's response.
So normally to create a service connection with "Grant Access to All..." enabled, we should run Endpoints-Create first and then run the second API to enable this option.
(And this is the same behavior in Web Portal. When we click Verify and Save button in web browser, it actually also calls these two APIs to complete the process.)

S4HC Extensibility: SCBO_AUTHORIZATION/000: You are not authorized to create instance

I developed a side-by-side app using Java + SAP Cloud SDK (Neo). The app adds records to a custom business object.
The app was working fine when I concluded development in February. Now, I need to do some additional improvements, but I can add records anymore.
I am getting the error SCBO_AUTHORIZATION/000 - You are not authorized to create XXXXXXX instance.
I assigned CBO to a business role, the custom communication scenario along with communication arrangement is in place. I tested already the service (metadata) and the user is not locked.
HereĀ“s the error sent back from the backend:
2020 05 27 19:36:55#+00#ERROR#com.sap.cloud.extensibility.services.CockpitServiceImp##PHENRIQUE#https-jsse-nio-8041-exec-8#na#fzrl99axqb#csccapplication2#web#fzrl99axqb#na#na#na#na#Error building up cockpit. com.sap.cloud.sdk.s4hana.datamodel.odata.helper.ODataVdmErrorResultHandler$ErpODataException: The endpoint responded with HTTP error code 400.
You're not authorized to create CSCCOCKPIT instance.
Full error message:
{
"error": {
"code": "SCBO_AUTHORIZATION/000",
"message": {
"lang": "en",
"value": "You\\u0027re not authorized to create CSCCOCKPIT instance."
},
"innererror": {
"application": {
"component_id": "BC-ESI-ESF-GW",
"service_namespace": "/SAP/",
"service_id": "YY1_CSCCOCKPIT_CDS",
"service_version": "0001"
},
"transactionid": "338BDCAE69170270E005EC3E361F2498",
"timestamp": "20200527193655.5607910",
"Error_Resolution": {
"SAP_Transaction": "For backend administrators: use ADT feed reader \\"SAP Gateway Error Log\\" or run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details",
"SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"
},
"errordetails": [
{
"code": "SCBO_AUTHORIZATION/000",
"message": "You\\u0027re not authorized to create CSCCOCKPIT instance.",
"propertyref": "",
"severity": "error",
"transition": true,
"target": ""
}
]
}
}
}
Could someone give a clue on where could the issue be?
BR,
Pietro
The error happened because all the fields in the custom business object in S/4Hana Cloud were set as "read-only".

how to create a valid webhook which can be triggered by Provider_verification_published event in pact broker?

to automate contract testing by leveraging pact broker webhooks, I created customized contract_content_changed event with a jenkins job. but when I was trying to add webhook for customer pipeline which is triggered by verification result publishing, it failed several times.
{"consumer": {
"name": "Consumer Service"
},
"provider": {
"name": "Provider Service"
},
"events": [
{
"name": "provider_verification_published"
}
],
"request": {
"method": "POST",
"url": "http://jenkinsserver/jobforconsumerdeployment",
"headers": {
"Accept": "application/json"
},
"body": {"VerificationResultURL","${pactbroker.verificationResultUrl}"
}
}
after removing body element, it created successfully.
by passing body to customer job, it could parse fail/pass and decide whether deployment should go or not go.
if body is not allowed, how consumer pipeline to get the result and continue next step (or stop deployment)?
I am referring to Pact Broker Webhooks.
Configure Jenkins job to "Trigger builds remotely" from Build Triggers section
Generate Jenkins-Crumb by the following link
Steps to create Jenkins-Crumb
Following post request in Pact-Broker is working fine for me on my
local jenkins setup (need to check jenkin permissions to enable
web-hook execution)
{
"events": [{
"name": "provider_verification_published"
}],
"request": {
"method": "GET",
"url": "http://username:password#jenkins_url/job/jenkin_consumer/build?token=abc",
"user" : "username:password",
"headers": {
"Jenkins-Crumb": "c787ce16220300f5ef8287a4474d9acxd"
}
}
}
if body is not allowed, how consumer pipeline to get the result and
continue next step (or stop deployment)?
Yes, body is not allowed in case of 'provider_verification_published' event. So to confirm the verification results, we need to use "can-i-deploy" cli to deply or stop the deployment can-i-deploy. More information provided on Pact Broker Webhooks

Alexa Skill Won't Play My Streaming Audio

I've been banging my head against the wall on this one for 2 days, and will post the resolution in the hopes it helps someone in the past. I created an Alexa skill to stream a radio station, and just couldn't get it to play, even using the sample code. Finally I just hardcoded the values sent down the wire, and it still didn't work. Here's what I was sending:
{
"version": "1.0",
"response": {
"shouldEndSession": 1,
"response": {
"outputSpeech": {
"text": "Playing Somgwriters island",
"type": "PlainText"
},
"directives": [
{
"playBehavior": "REPLACE_ALL",
"audioItem": {
"stream": {
"url": "http://la2-ssd.myautodj.com:8198/stream.mp3",
"token": "",
"offsetInMilliseconds": 0
}
},
"type": "AudioPlayer.Play"
}
],
"reprompt": {},
"card": {}
}
},
"sessionAttributes": {},
"statusCode": "200"
}
I finally found the cause in their documentation:
audioItem.stream.url:
Identifies the location of audio content at a remote HTTPS location.
The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used. Many content hosting services provide this. For example, you could host your files at a service such as Amazon Simple Storage Service (Amazon S3) (an Amazon Web Services offering).

Does Cygnus already accept NGSI2?

Based on this post (Fiware - Context broker: Issue with NGSIv2 subscriptions) a few months ago it was under discussion whether Cygnus supported NGSIv2 or not. It was commented that the issue were schedule but not yet implemented.
Question: Is it implemented already? how can we know?
My confusion reminds because when creating a subscription based on NGSIv2, and outcome of successfully created message pop up (i.e., 201), but still cannot monitor my subscription record into Orion.
I'm creating my subscription like this:
Content-Type:application/json
Accept: application/json
Fiware-Service: test
Fiware-ServicePath: /device
{
"description": "One subscription to rule them all",
"subject": {
"entities": [ {
"idPattern": ".*",
"type": "smarthphone" } ],
"condition": {
"attrs": [ "battery" ],
"expression": { "q": "battery!=0" }
}
},
"notification": {
"http": {
"url": "<MY COSMOS IP>:5050/notify" },
"attrs": [ "battery" ]
},
"expires": "2120-04-05T14:00:00.00Z",
"throttling": 1
}
And this is what I get:
Connection: Keep-Alive
Content-Length: 0
Location: /v2/subscriptions/587c62fcfebdbe5f74bad77b
Fiware-Correlator: f9a96bd0-dbb1-11e6-93ea-0242ac110004
Date: Mon, 16 Jan 2017 06:06:52 GMT
But when I retrieve such subscription it does't show:
.../v2/subscriptions/587c62fcfebdbe5f74bad77b
Any hint of what am I doing wrong?
"Cygnus does not support NGSIv2" means no NGSIv2 notifications are accepted in the service port (by default, TCP/5050). For the time being, only NGSIv1 notifications are accepted.
Nevertheless, what we have added to Cygnus API is a convenience operation about subscribing to Orion, either using NGSIv1 or NGSIv2 subscription format. I guess that's what you have tested (without success). Internally, such an operation implements just a forwarding (to the given Orion endpoint) of the given subscription. If Cygnus API says everything went OK, it is because Orion said everuything went OK.
Anyway, I'll edit this post once I perform a test by my side. In the meantime, you can ignore Cygnus API and use Orion API directly.
If you have entities created with headers Fiware-Service: test and
Fiware-ServicePath: /device , you also need to use these headers in your requests (GET, PUT, etc.).