How to access Azure DevOps deploy comments from REST API - azure-devops

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:

Related

Renaming Azure Devops Build and Release pipeline through REST API

trying to rename the pipelines build and release through REST API, I have gone through the official Microsoft documentation but didn't find any API's for this task. Did i miss any or we have such API's where by using build id/build name we can rename the pipeline
have you tried to make the change in the azure release page and look at the request that is being sent in the dev tools network tab? A couple of months ago I was able to learn how to retrieve some information that I was looking for by doing that.
Best regards.
You could use Definitions-Get API to retrieve the requested body by pipeline definition ID.
Copy the response as body and use Definitions-Update to rename the pipeline. Update the pipeline name of this revision.
Check the DevOps UI output.
The above workflow also applies to release pipeline, your need to change the REST API.
Using Releases-Get release to get the latest revision and using Releases - Update Release to rename it

Updating Azure DevOps Environment Resource Tags through the API

I am trying to figure out how to update the associated tags with an Azure DevOps Environment Resource (virtual machine) through the Azure DevOps API.
I have figured out how to get the resources for a specific Environment - https://dev.azure.com/{organization}/{project}/_apis/distributedtask/environments/{environmentId}?api-version=6.0-preview.1
However, if I try to update and then post back the Environment JSON with the updated resource tags, it does not actually update the resources. I think it is only for updating the Environment Name and Description?
I have trying to figure out how to use the following API endpoint (I think this is the one I should be using?) - https://dev.azure.com/{organization}/{project}/_apis/distributedtask/environments/{environmentId}/providers/virtualmachinegroups/{resourceId}/virtualmachines?api-version=6.0-preview.1.
The API endpoint wants a "resourceId" but I am not able to get anything back besides a 404 error when I put in the Environment Resource Id's for my Environment. I am not sure if I am doing something wrong, or this is the wrong end point.
Does anyone have an experience with using the API to update resource tags?
I can reproduce above issue. Currently, You have to manually edit the Environment Virtual machine Resource Tags.
Azure devops Environment Resource Rest API is not fully developed yet. Some features may be broken and unavailable currently.
You can report this issue to Microsoft Development Team. Hope they will fix it in the future sprint.

How would I go about setting up a web hook listener on Azure DevOps?

Goal:
We have a Translation Management System project with a set of string translations, which can be exported as iOS, Android, and web formats. This can be done via its API, CLI, or manually with the UI. We need to integrate with our git-based repository, which lives in DevOps, so that when changes are made to the TMS translations, the code base is updated automatically (preferably a PR would be created with the changes).
What I Have Tried:
I am a mobile developer with little web hook experience, but it seems that they are the key to the solution. I can configure the web hook on the TMS side, but need to provide a URL with a listener. Going through the Azure DevOps service hooks settings and reading documentation extensively, I can't find any leads on a way to set up a custom listener to subscribe to another service's web hook, consume its payload, and trigger an action in DevOps.
I'm aware this may be limited by the capabilities of the TMS and DevOps, but how would this be tackled viewing it from a high level perspective? It doesn't seem like there's any built-in solution, so what would a custom solution entail? If something along the lines of what I'm looking for isn't possible, I would like to know that as well.
Thanks in advance!
So that when changes are made to the TMS translations, the code base
is updated automatically (preferably a PR would be created with the
changes).
Sorry but as I know it's not supported scenario in Azure Devops Service.
1.The service hooks option in azure devops service is that when something(event) happens in Azure Devops Service, it runs task(action) on target service. But what you want is when something happens in external service, it runs task(action) in azure devops service. For now this behavior is not supported.
2.And different service in Service Hooks has different supported actions. Let's take Jenkins service(one service hooks) as example, see step5 in trigger Jenkins: Azure Devops can trigger Jenkins build.
As for Web Hooks(another service hooks), it can't trigger actions like the code base is updated automatically. It just sends the Json representation.
So the scenario you want is not supported for now by Azure Devops Service.
In addition: Not sure about how your TMS works, but you can consider using Azure Devops Rest API to trigger actions in Azure Devops Service. (These rest apis can be used to queue build, release or do git-related actions )
When changes are made to your TMS translations, you may call corresponding Azure Devops rest api to manage git repos in Azure Devops if your TMS supports this kind of behavior.
Hope all above resolves your puzzle why your scenario is not supported by Web Hooks in Azure Devops:)
When you Authorize your GitHub repo through the devops settings, webhook will be automatically created on your repo with configurable hook events.

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.

Adding custom status page to Jenkins instance

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.