最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

tfs - Azure Devops Server Pipelines: Any way to have a Stage result as "Succeeded" even if a constituent Job r

programmeradmin2浏览0评论

Some tasks are expected to fail. Fortunately we have "continueOnError" for that. However, that results in the job being marked as "succeededWithIssues" which would be fine except it then taints the stage with the orange exclamation mark, which in turn taints the whole pipeline with the orange exclamation mark.

Is there a way to say "this stage is fully succeeded even though one of its constituent jobs succeeded with issues"?

Some tasks are expected to fail. Fortunately we have "continueOnError" for that. However, that results in the job being marked as "succeededWithIssues" which would be fine except it then taints the stage with the orange exclamation mark, which in turn taints the whole pipeline with the orange exclamation mark.

Is there a way to say "this stage is fully succeeded even though one of its constituent jobs succeeded with issues"?

Share Improve this question asked Jan 29 at 23:18 PxtlPxtl 9641 gold badge9 silver badges21 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Any way to have a Stage result as "Succeeded" even if a constituent Job reported "SucceededWithIssues"?

I'm afraid it's not supported to change the stage result, but it supports to change the whole build result as succeed with rest api. You can put the script in last stage to update the build result.

        - powershell: |
            # Define parameters
            $anization = "test"
            $project = "testproject"

            # Base64-encode the personal access token
            $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$(token)"))

            # Define the API URL
            $uri = "https://dev.azure/$anization/$project/_apis/build/builds/$(Build.BuildId)" + "?api-version=7.1"

            echo $uri

            # Define the body of the request
            $body = @{
                status = "completed"
                result = "succeeded"
            } | ConvertTo-Json

            # Make the API request
            $response = Invoke-RestMethod -Uri $uri -Method Patch -Body $body -ContentType "application/json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}

            # Output the response
            $response

The stageA is succeededwithIssue, the whole build is succeed.

If you have only one stage, it will show stage result with green mark.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论