Interactive variables for release management

2020-03-24 05:07发布

问题:

In Build definition for VSTS, you could declare a variable and allow to change it at queue time as in this snapshot

Could I do the same for the variable in Release definition?

Right now I have a Release definition which has an environment called Sharepoint. In this environment, I have a PowerShell task to upload a zip file of build artifact to Sharepoint Online. To upload a file using SharePoint API, I need a SharePoint account credential which I store as a variable for the this Sharepoint environment. The problem is Microsoft requires to change password for the Sharepoint account every 90 days (that what our IT told me). Therefore, storing my credential in the variable in the environment is not a good choice if different developers would like to request a release from this Release Definition and my password has been changed.

Is there any way I could have an interactive prompt for Sharepoint credential when a developer would like to request a release?

Also, since we use the Azure Active Directory for Office365, Sharepoint as well as VSTS, I wonder if I could extract the credential from the createdBy field returned by Release API at https://www.visualstudio.com/en-us/docs/integrate/api/rm/releases#for-a-release-definition and use it as a credential for Sharepoint Online.

回答1:

It doesn't support to change variable values When request a release in VSTS. No interactive variables like build definition.

You could vote this user voice: https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/16616269-change-release-variables-value-when-deploy-a-rele

The REST API you posted above returns user's ID and displayName, there's no passwords in the response. So this also couldn't meet your requirement.



回答2:

It is not a prompt but you can specify build run-time variable values when you are triggering a pipeline in the following manner:

  1. Add a variable in the build definition
  2. Check Settable at the queue time option
  3. Use the variable where required

This completes your setup.

When you are creating a new release, you can set the variable value before you deploy.

NOTE: People may forget to fill the variable value which defaults it to an empty string. You need validations in place for this. I believe that can be done using release gates feature.