1

I have a two stage release:

  1. Stage 1 creates a test DB
  2. pre-deploy approval on Stage 2
  3. Stage 2 test DB just created is destroyed

This setup allows devs time to test changes before approving automated cleanup.

My question is, is it possible to dynamically set the pre-deploy approval (step #2 above) to the user who submitted the release? If not, perhaps there is a better way to pause the release until the submitter manually allows it to continue?

Mark Arnold
  • 279
  • 2
  • 9

1 Answers1

1

For this issue , you can try to set approver through the Definitions - Update rest api.

You can add approver in "preDeployApprovals" argument. For example:

"preDeployApprovals": {
                "approvals": [{
                    "approver": {
                        "id": "9f723013-a332-64e5-aea9-6e3ebxxxxx",
                        "displayName": "hughl01",
                        "isContainer": false
                    },
                    "isAutomated": false,
                    "isNotificationOn": false,
                    "rank": 1,
                    "id": 0
                }]
            },

Then you can set the pre-deploy approval to the user who submitted the release through pre-defined variables:

  • Release.RequestedFor The display name of identity that triggered the release.
  • Release.RequestedForId The ID of identity that triggered the release.

In the request body ,you can use $(Release.RequestedFor) to dynamically get the name of the user who triggered the release and use it as the name of approver. The same goes for $(Release.RequestedForId).

Here are some references for you:

set approver with PowerShell

release pre-defined variables

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25