CCNetIntegrationStatus is always UNKNOWN when used in the publishers section - cruisecontrol.net

I have a build process running with CCNET v1.8.5. When the build completes, successfully or not I want to send a notification to Slack. I have the notification piece working with Slack's web hooks (see below) but I cannot seem to obtain the status of the current build via the CCNetIntegrationStatus property. The result of using $[$CCNetIntegrationStatus] in my config is always Unknown.
I have a hunch that the reason is that these CCNET integration properties (at least they way that I am declaring them) are processed and defined when the build starts. Of course, when the build starts the build status would be UNKNOWN.
I have also tried:
$[CCNetIntegrationStatus], the result is an empty/blank string.
$(CCNetIntegrationStatus), ccnet.config cannot be processed, variable not found
$CCNetIntegrationStatus, the result is the literal string $CCNetIntegrationStatus
Ultimately, what I want to achieve is to send an HTTP request (notification) once the build is complete that includes the current builds integration status, the prior builds integration status, the version number, and project name. How would I go about doing this?
Here is the sample configuration:
<!-- block definition to send slack notification -->
<cb:define name="SlackNotificationBlock">
<checkHttpStatus>
<httpRequest>
<method>POST</method>
<uri>$(slackUrl)</uri>
<body> {{
"username": "Build Bot",
"icon_emoji": ":build:",
"attachments": [
{{
"fallback": "Warning! A New Build Approaches!",
"pretext": "Warning! A New Build Approaches!",
"color": "#D00000",
"username": "Build Bot",
"icon_emoji": ":build",
"fields": [
{{
"title": "Project",
"value": "$[$CCNetProject]",
"short": true
}},
{{
"title": "Version",
"value": "$[$CCNetLabel]",
"short": true
}},
{{
"title": "Status",
"value": "$[$CCNetIntegrationStatus]",
"short": true
}},
{{
"title": "Last Status",
"value": "$[$CCNetLastIntegrationStatus]",
"short": true
}},
{{
"title": "Location",
"value": "$(appUrl)",
"short": false
}}
]
}}
]
}}
</body>
<timeout>5000</timeout>
</httpRequest>
</checkHttpStatus>
</cb:define>
<!-- my publishers block -->
<publishers>
<xmllogger/>
<cb:scope slackUrl="url-to-slack"
appUrl="application-url">
<cb:SlackNotificationBlock/>
</cb:scope>
</publishers>

First I had to chuckle at the variations you tried like $(CCNetIntegrationStatus]. I mean really? But your hunch is right. The ccnet config code is static. The only way to make it dynamic is to source stuff from a file that you change during the build. This can be done with the build label but not apparently with the httpRequest.
I would do the url stuff in Nant. That gives you more flexibility. You can call it whenever you want.

I found a solution via the CCNetSlackPublisher. It accomplishes via a custom task what I was attempting to do entirely within the CCNET configuration syntax. Specifically, by implementing a custom task CCNetSlackPublisher is able to correctly obtain the current integration status. It then send that along to my configured slack channel. An additional benefit is that my CCNET configuration is simpler as well!
I was never able to 100% confirm my hunch that the CCNetIntegrationStatus property is evaluated once when the build starts. However, given the behavior that I was seeing I believe this to be the case.

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.

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.

In Azure Functions, using a Bash script, is it possible to access properties from the queue message trigger?

Using Azure Functions, I'd like use the properties from a dequeued message as arguments in my Bash script. Is this possible? And if so, how? It seems documentation on Bash azure functions is a bit sparse.
I have looked at:
This documentation on binding to custom input properties. It gives C#/Javascript examples, but no bash samples.
And this GitHub sample with a similar Batch function.
However, after trying to apply the similar concepts to my function, I've come up short.
Here is my setup:
Functions.json
{
"bindings": [
{
"name": "inputMessage",
"type": "queueTrigger",
"direction": "in",
"queueName": "some-queue",
"connection": "AzureWebJobsStorage"
}
],
"disabled": false
}
Run.sh
echo "My name is $FirstName $LastName"
Sample Queue Message
{
"FirstName": "John",
"LastName": "Doe"
}
Actual Result
My name is:
What I'm hoping for
My name is: John Doe
Any thoughts on how to accomplish this, either by updating Functions.json or Run.sh?
For bash queue trigger queue message returns as string and you need to parse JSON yourself in run.sh. Note bash queue trigger is experimental. I think it's not easy to implement bash json parser as you can't install third party libs like jq in function app sandbox.
You can easily extract json objects from queue message using other languages (JS/C#/Powershell)

XPages Extlib REST update (HTTP PUT) on calendar event is returning error code (cserror : 1028)

I am trying to update a calendar event in Domino Mail Calendar by using the REST data service "calendar" from the latest xpages extlib release "ExtensionLibraryOpenNTF-901v00_13.20150611-0803".
Has anybody done this with a successful return?
Unfortunately I haven't had any success trying to update a calendar event. I was successful getting the list of events, creating events, deleting an event, but to update an event seems to be somehow special. The PDF documentation for the calendar service is quite short on this point. My domino server is accepting all protocols including PUT. I am using the JSON format for my REST calls. The UPDATE I tried as described in the documentation with iCAL as well, but getting the same error.
I am using the Firefox REST Plugin for checking out the service, before I am implementing it.
Im using PUT, with content-type "text/calendar" as well "application/json".
My URL:
http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D
My Body looks like this, which is the easiest event type, a reminder (but I tried it with meeting and appointment as well):
{"events":[{"UID:"4D750E2B8159D254C1257E9C0066D48D","summary":"Ein Reminder update","start":{"date":"2015-08-13","time":"13:00:00","utc":true}}]}
This is how I return the event by a GET:
{
"href": "/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated",
"id": "4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated",
"summary": "Ein Reminder",
"start": {
"date": "2015-08-12",
"time": "07:00:00",
"utc": true
},
"class": "public",
"transparency": "transparent",
"sequence": 0,
"x-lotus-summarydataonly": {
"data": "TRUE"
},
"x-lotus-appttype": {
"data": "4"
}
}
This is the error I get:
{
"code": 400,
"text": "Bad Request",
"cserror": 1028,
"message": "Error updating event",
"type": "text",
"data": "com.ibm.domino.calendar.store.StoreException: Error updating event\r\n\tat com.ibm.domino.calendar.dbstore.NotesCalendarStore.updateEvent(NotesCalendarStore.java:229)\r\n\tat ... 65 more\r\n"
}
The attributes in the body I tried a lot of different things, using the id, no id, an UID like in the calendar service doumentation, ...
What am I doing wrong here?
The solution:
Using the PUT method, the URL which worked looks like this:
http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated
the BODY looks like this:
{"events":[{"id":"4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated","summary":"Some Reminder update #6","start":{"date":"2015-08-13","time":"10:00:00","utc":true}}]}
What I figured out was, that the "id" attribute is required ! a bit strange, because it is already in the URL.
I just checked against the documentation for Domino Access Services (DAS) 9.0.1 - and the example they have there actually works.
I tried a few things before that, e.g. if I could PATCH (change individual fields) or PUT (change ALL fields) just specifying the non-system fields. None of these worked. But taking the response from creating (or getting) the event and put it into a PUT request and adjust e.g. start time works fine.
Looking at your example I think the issue is similar as you do not include the end time in the request. But even so you seem to have to include the entire record as it is returned from the service - and please note that the url must end on the ENTIRE id (i.e. including "...-Lotus_Auto_Generated") :-)
/John
Edit:
It seems you don't need to add all fields... But be aware of the side effects of not specifying fields... You need to test it for yourself!

gitlab api How to get Last Commit? logs_tree?

gitlab api How to get Last Commit?
GET /projects/:id/repository/tree
{
"name": "assets",
"type": "tree",
"mode": "040000",
"id": "6229c43a7e16fcc7e95f923f8ddadb8281d9c6c6"
},?
How to get logs_tree? Last Commit?
Since at least version 12.10 GitLab supports pagination.
That's why the call return only one commit.
GET /api/v4/projects/:id/repository/commits?per_page=1&page=1
At the current version of API we have only one way to solve this problem
GET /api/v4/projects/:id/repository/commits
The first commit in the array will be the desired one. You can extract it with jq '.[0]'
You can use this API.
GET /projects/:id/repository/branches/:branch
The result of this API includes the latest commit of the branch.
https://docs.gitlab.com/ee/api/branches.html#get-single-repository-branch
I would recommend follow the spec listed here which says that you can use
GET /projects/:id/repository/commits/tree
to return the following example data:
{
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
"short_id": "6104942438c",
"title": "Sanitize for network graph",
"author_name": "randx",
"author_email": "dmitriy.zaporozhets#gmail.com",
"created_at": "2012-09-20T09:06:12+03:00",
"message": "Sanitize for network graph",
"committed_date": "2012-09-20T09:06:12+03:00",
"authored_date": "2012-09-20T09:06:12+03:00",
"parent_ids": [
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"status": "running"
}
This is the latest commit. In terms of finding logs_tree the full documentation may help you

Resources