az-repos:tldr:0afee
az-repos: Add build validation on a specific repository, using an existing build pipeline, to be triggered automatically on source update.
$ az repos policy build create --repository-id ${repository_id} --build-definition-id ${build_pipeline_id} --branch main --blocking --enabled --queue-on-source-update-only true --display-name ${name} --valid-duration ${minutes}
try on your machine
This command is used to create a policy for the specified Azure DevOps repository build pipeline. Let's break down the command and explain each parameter:
az repos policy build create
: This is the command to create a build policy.--repository-id ${repository_id}
: Specifies the ID of the Azure DevOps repository. You need to replace${repository_id}
with the actual ID.--build-definition-id ${build_pipeline_id}
: Specifies the unique ID of the build pipeline associated with the repository. Replace${build_pipeline_id}
with the actual ID.--branch main
: Specifies the branch where the build policy will be applied. In this case, it's set to the "main" branch.--blocking
: Indicates that the build policy should block any action that violates the policy.--enabled
: Enables the build policy.--queue-on-source-update-only true
: This parameter ensures that the build policy is run only when there are source updates in the repository.--display-name ${name}
: Specifies the display name for the build policy. Replace${name}
with the desired display name.--valid-duration ${minutes}
: Sets the validity duration for the build policy in minutes. Replace${minutes}
with the desired duration.
By executing this command, you will create a build policy in the specified Azure DevOps repository build pipeline with the provided configuration.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.