微软 DevOps &Azure Functions:实现递归更新 [英] Microsoft DevOps & Azure Functions: Implement recursive updates

查看:39
本文介绍了微软 DevOps &Azure Functions:实现递归更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一项任务要实现一个 Azure 函数,该函数由 Microsoft DevOps (VSTS) 中定义的 HTTP-Webhook 触发.

I have a task to implement an Azure Function which is triggered by an HTTP-Webhook defined in Microsoft DevOps (VSTS).

思路如下:

  • 我们有一个 backlog 结构(比方说:Epic > Feature > User Story > Task)
  • 如果我将任何这些项目的状态设置为完成",所有基础项目也应更改为完成"

到目前为止我做了什么

  • 我在 DevOps 中启用了一个 webhook,它会在任何工作项的更新时触发,并将此项作为 JSON 发送到 Azure 函数
  • 我编写了由 HTTP 请求调用的 Azure 函数,并获取触发请求的项目的 URL
    • 该函数然后获取作为第一个工作项的子项的所有项
    • 该函数用第一项的状态修补所有找到的子项
    • 所有直接子代都在 DevOps 上更新

    我需要什么
    我正在尝试找出启用递归更新的选项.不仅应该更新直接子代,还应该更新其所有子代(如果有的话)等等.我想了以下方法来实现这一点,需要您的指导:

    What i need
    I'm trying to figure out an option to enable recursive update. Not only direct children should be updated, but also all their children (if they have some) and so on. I thought about the following ways to accomplish this and need your guidance:

    • 获取所有直接子项作为 JSON,然后将 HTTP 请求发送到同一个函数,传递所有子项

    • Get all direct children as JSON and then send HTTP-request's to the same function, passing all child item's

    在函数内调用函数(甚至不知道这是否有效)并将子代作为 JSON 传递

    call the function within the function (don't even know if this works) and pass the children as JSON

    找到一种方法来处理这个单一函数中的所有逻辑(愚蠢的 foreach 嵌套以确保处理所有 backlog-hierarchy 级别)

    find a way to handle all the logic in this single function (dumb foreach-nesting to ensure all backlog-hierarchy levels are processed)

    如果需要任何代码片段,请告诉我,我将提供所需的部分(现在我不确定我应该发布代码的哪一部分并且会有所帮助)

    If any code snippets are needed just tell me and i will provide the requested parts (right now i'm quite unsure what part of my code i should publish and would be helpful)

    推荐答案

    来自您的方法列表:

    在函数内调用函数(甚至不知道这是否有效)并将孩子作为 JSON
    [不建议这样做.请参阅此处了解最佳做法]

    call the function within the function (don't even know if this works) and pass the children as JSON
    [This is not recommended. Please see here for best practices]

    找到一种方法来处理这个单一函数中的所有逻辑(愚蠢
    foreach-nesting 以确保处理所有 backlog-hierarchy 级别)[同样在这里.不建议这样做.一般来说,最好的做法是避免长时间运行的函数]

    find a way to handle all the logic in this single function (dumb
    foreach-nesting to ensure all backlog-hierarchy levels are processed) [Same here. This is not recommended. In general it best practice to avoid long running functions]

    这篇关于微软 DevOps &Azure Functions:实现递归更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆