Adding custom status page to Jenkins instance - rest

I want to use the REST API that comes with Jenkins to generate a status page which shows all my projects, the environments they're currently deployed to, latest build versions etc.
Jenkins provides a nice REST API to expose this info however consuming the service is limited by cross domain restrictions. I have looked briefly at creating a CORS filter for my Jenkins instance but its overkill for what I'm trying to achieve.
Can someone tell me if its possible to modify my Jenkins WAR (instance) and add some HTML which i can then modify to call the RESTful endpoints? Ideally i want something whereby i can simply navigate to http://myjenkins/project-status and see the required information.

I assume your status page has some Javascript executing XMLHttpRequests. You could drop your status page files into $JENKINS_HOME/userContent directory on the master. This way they are served by Jenkins and should be able to access Jenkins REST APIs.

Related

How to access Azure DevOps deploy comments from REST API

I've been able to successfully access all kinds of details around a release in Azure DevOps by leveraging the .NET client libraries (ex: Microsoft.VisualStudio.Services.Release.Client) that wrap the REST API. However, I can't seem to find what the object/property combination is that I would use to retrieve the comments that can be entered when kicking off a deployment to a specific environment.
To be clear, the comments I'm looking for are entered by hovering over an environment of a release and selecting "Deploy". On the right hand side there is a dialog in which comments can be entered and then another "Deploy" button is selected to kickoff the deployment.
Does anyone have any ideas on how these deployment comments can be read by using the Azure DevOps REST APIs or .NET client libraries?
You can use get release history REST API to get deploy comments:
Get https://vsrm.dev.azure.com/{Organization name}/{Project name}/_apis/Release/releases/{Release Id}/history?api-version=6.1-preview.1
Here is my sample:

Identifying work items which have been released via VSTS API

Trying to determine which VSTS Work Items have been released to a given Environment (production). Ideally looking for a Service Hook to tell me when work items are deployed so we can keep the rest of the company updated on when items are deployed.
Cannot find this available in the VSTS API.
In the VSTS UI under the Release Summary tab it shows linked Work Items. However linked Work Items don't appear to be available via the API.
VSTS API docs for Get Release
In the VSTS UI under each Work Item, it shows when it was integrated into a build, however not when that build has been released.
Any ideas?
There's a REST API, you're just looking in the wrong place for it. BTW, you can find this stuff easily by looking at the network traffic in the F12 tools in your browser.
https://<accountUrl>/<Project>/_apis/Release/releases/<ReleaseID>/workitems?baseReleaseId=<ReleaseToCompareAgainst>&%24top=250
For your question:
Ideally looking for a Service Hook to tell me when work items are
deployed so we can keep the rest of the company updated on when items
are deployed.
The deployed work items information is already included in the Release Deployment Service Hooks as below:
So you just need to create a Service Hook for Release deployment completed event and create a web service to listen on this.

VSTS Get Individual Artifact REST Client API

I have some build artifacts that have some debug information in them that I would like to display in a build summary. However, the only APIs I'm seeing for getting artifacts is as a zip file. If you go to the artifact screen and explore the artifacts, then copy the download URL, you get an API as:
https://{account}/_apis/resources/Containers/{container}?itemPath={file_name}
However, I can't seem to find a REST Client API to utilize this function in my ts script in the extension.
Any thoughts on how to get the actual files from this? The TS script needs to just grab the file and display it in the browser.
There isn’t such REST client API to do it.
You can call that API through HTTP request directly. To get container’s Id, you can use Get build artifacts REST API (in resource > data value).
There is an article about make http request.
5 Ways to Make HTTP Requests in Node.js
On the other hand, you don’t need to do it through extension, just call Logging Command (call command during build/release) to add additional information to build/release summary. (##vso[task.uploadsummary]local file path)

Upload/Update XSP application to Bluemix through Cloud Foundry API

I'm using Cloud Foundry API to modify apps on IBM Bluemix.
I got oauth key and succeeded in calling simple REST requests, like v2/apps.
However, as I want to update XSP application I need to send a nsf file to bluemix.
I tried to use /v2/apps/:guid request, but according to documentation I can only send application parameters, but I cannot send whole application file.
Is there an endpoint to do that?
There is also an API to Upload the bits for an App, but if my understanding is correct what you are asking is basically to emulate a cf push via REST API. Please note that cf push is complex and is not something that is recommended recreating via API on Cloud Foundry. I don't know what your requirements are, but I'd suggest you to use cf push to do that. Anyway if you want more information on what are the steps it performs (from an high level perspective) you can take a look here. I suggest you also to see this Github Cloud Foundry issue where the user is trying to programmatically recreate the cf push.

Accessing ExecutedMojo data from Jenkins REST API

I can access most of a maven build's information through the Jenkins REST API, but I've not been able to find the ExecutedMojos, which I need for their timing information. I see that this information is available through Jenkins' Java API, but I'm not sure how to go interacting with Jenkins programmatically either.