共用方式為


Release triggers

TFS 2017 | TFS 2015

Note

In Microsoft Team Foundation Server (TFS) 2018 and previous versions, build and release pipelines are called definitions, runs are called builds, service connections are called service endpoints, stages are called environments, and jobs are called phases.

Release triggers are an automation tool to deploy your application. When the trigger conditions are met, the pipeline will deploy your artifacts to the environment/stages you already specified.

Continuous deployment triggers

Continuous deployment triggers allow you to create a release every time a new build artifact is available. Using the build branch filters you can trigger deployment for a specific target branch. A release will be triggered only if the Git push contains a commit on the specified branch. For example, selecting main will trigger a release for a Git push which contains one or more commits to the main branch. To trigger a release for any commit to branches under features/, enter features/*. To trigger a release for commits to all branches, enter *. Note that all specified filters will be OR'ed.

Configure continuous deployment triggers

Note

Automatically creating a release does not mean it will be automatically deployed to a stage. You must set up triggers to deploy your app to the various stages.

Scheduled release triggers

Scheduled release trigger allow you to create new releases at specific times.

Select the schedule icon under the Artifacts section. Toggle the Enabled/Disabled button and specify your release schedule. You can set up multiple schedules to trigger a release.

Defining schedules to trigger releases

Stage triggers

Stage triggers allow you set up specific conditions to trigger deployment to a specific stage.

The stage trigger conditions settings

  • Select trigger: Set the trigger that will start the deployment to this stage automatically. Select "Release" to deploy to the stage every time a new release is created. Use the "Stage" option to deploy after deployments to selected stages are successful. To allow only manual deployments, select "Manual".

  • Artifacts filter: Select artifact condition(s) to trigger a new deployment. A release will be deployed to this stage only if all artifact conditions are met.

    The artifact filter trigger conditions settings

  • Schedule: Trigger a new deployment to this stage at a specific time.

    The scheduled trigger conditions settings

  • Pull-request deployment: Enabling this will allow pull request based releases to be deployed to this stage. Keep it disabled if this is a critical or production stage.

    The pull request trigger conditions settings

  • Pre-deployment approvals: Select the users who can approve or reject deployments to this stage. By default, all users must approve the deployment. If a group is added, one user in the group must approve the deployment. You can also specify the timeout (the maximum time that an approval is allowed to be pending before it is automatically rejected) and approval policies.

    Pre-deployment approvals

  • Gates: Allow you to set up specific gates to evaluate before the deployment.

    Gates set up

  • Deployment queue settings: Allow you to configure actions when multiple releases are queued for deployment.

    deployment queue settings

Note

Release triggers set a number of variables based on your pipeline configuration. You can find information about your release pipelines and/or stages by accessing the values of your release and artifacts variables.