Setting up a pre-deployment gate which validates status of linked work items - azure-devops

I'm trying to setup a pre-deployment gate which validates that all the work items that are linked to the build have a certain status. Eg: Approved for Deployment. I thought I would be able to do this with Query Work Items gate but now I don't think it can be used that way.
The other option that I can think of is to use Invoke Azure Function or Invoke REST API gates that will take the releaseId and then use api calls to find the linked work items and then their statuses.
Is that the right way to do this?

You can use Query Work Items as a workaround since it ensures the number of matching items returned by a work item query is within the configured thresholds.
So you can edit the Queries validating status of linked work items to meet the requirements. The Query Work Items in pre-deployment gate like the following shows:
You can also use REST API to add an Invoke REST API in pre-deployment gate like the following shows:
For how to get Work Item Type States and and validate status of work items, you can call the List REST API as follows:
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitemtypes/{type}/states?api-version=6.0-preview.1

Related

Clio API Filter data based on nested resource

Filtering data based on a top level resource is straightforward, but what is the proper syntax for the url when attempting to filter based on a nested resource? For example, if I want to return all tasks but only for open matters, how should I enter that into the URL endpoint since the Matter Status is a nested resource under Tasks?
I do not see the method for filtering based on nested resources covered in the Clio API documentation.
As far as I understand, you can only filter by the options Clio's API provides. For example when querying a Matter, you can filter by an originating_attorney_id but not a user_id as the API doesn't provide a way to do that. You'll just have to pull in all the data and filter it in your code logic.
You can reach out to the Clio API team and ask them to add a specific filter option and see if they'll do that for you. I've found that they are at least willing to have a dialog.

Is it possible to retrieve build definition ID related to a work item using Azure DevOps REST API?

The requirement is to fetch all the work items between different releases and create a report. The list of work items can be fetched using below API call.
https://vsrm.dev.azure.com/{organizationName}/{projectName}/_apis/release/releases/{currentReleaseId}/workitems??api-version=6.0&baseReleaseId={baseReleaseId}
Now, for each of this work item, we also need to know the build version when it is delivered. I'm not able to find any entries related to build/release in the work item data fetched using
https://dev.azure.com/{organizationName}/_apis/wit/workItems/{ID}
Is there any relationship between work item tasks and respective build or release definition ID when it was delivered?
Is it possible to retrieve build definition ID related to a work item using Azure DevOps REST API?
The answer is yes.
You could use the REST API Work Items - Get Work Item with $expand to get the commit links:
Get https://dev.azure.com/{org name}/{project name}/_apis/wit/workitems/{id}?$expand=relations&api-version=6.0
Then you would see the commits in relations part of the response body:
Then we could use the REST API Statuses API for Commit. It seems that when starting and ending build, the appropriate status is posted.
So when we call
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/statuses?api-version=6.0
We will get all last builds associated with the Commit and their statuses.

How to get all items by feature in Azure DevOps

How to get all task items by feature id?
I want to get all the items that belong to a particular feature. Is it possible to do it by using the Rest API?
You can do it with the Work Items - Get Work Item API with the $expand parameter:
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?$expand=relations&api-version=5.1
The $expand=relations parameter will return all the items that linked to the work item.

Dialogflow agent entities to be contacted through REST APIs

I am developing an agent, and have an entity within the agent.
now what i need is to add some new details to the entity, but not by opening dialogflow.
I want to make a REST API to add it for me.
Is it possible?
It sounds like you're looking for the API to either create or patch entities.
From reading the docs, it doesn't look like this is possible via HTTP requests.
You could try automated expansion:
Automated expansion of developer entities allows an agent to recognize
values that have not been explicitly listed in the entity.
If a user's request includes an item that isn't listed in the entity,
automatic expansion recognizes the undefined item as a parameter in
the entity. The agent sees the user's request is similar to the
examples provided, so it can derive what the item is in the request.
For example, consider a shopping list with items to buy:
If a user says "I need to buy some vegetables", "vegetables" will be
picked up as a value, even though it's not included in the #item
entity. With automated expansion enabled, the agent sees the user's
query is similar to the training phrases provided in the intent and
can pick out what should be extracted as a new value.
The closer the user's input is to the examples provided in the
training phrases section, the better the results the automated
expansion feature provides. This is another reason to provide as many
examples as possible.

Get changes associated with a build in Azure Devops using REST API

In Azure Devops under the "Summary" tab associated with a build, there are a list of changes (Git hashes, etc.) associated with the build. I'm trying to figure out how to get these via the rest API.
I found this REST API to get the changes between the two builds.
It works if I have the previous build id in the pipeline, however in the situation I'm interested in, I have the current build id, I need to somehow use the REST API to find the previous id.
Is there a way to do this using the REST API, or a better way to accomplish what I'm trying to do here?
As far as I can see, there's a special REST API call for that. You pass the buildId as a part of the URL and get the collection of changes (Change[]) in response.