1. Packages
  2. Azuredevops Provider
  3. API Docs
  4. BranchPolicyBuildValidation
Azure DevOps v3.4.0 published on Wednesday, Oct 30, 2024 by Pulumi

azuredevops.BranchPolicyBuildValidation

Explore with Pulumi AI

azuredevops logo
Azure DevOps v3.4.0 published on Wednesday, Oct 30, 2024 by Pulumi

    Manages a build validation branch policy within Azure DevOps.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const example = new azuredevops.Project("example", {name: "Example Project"});
    const exampleGit = new azuredevops.Git("example", {
        projectId: example.id,
        name: "Example Repository",
        initialization: {
            initType: "Clean",
        },
    });
    const exampleBuildDefinition = new azuredevops.BuildDefinition("example", {
        projectId: example.id,
        name: "Example Build Definition",
        repository: {
            repoType: "TfsGit",
            repoId: exampleGit.id,
            ymlPath: "azure-pipelines.yml",
        },
    });
    const exampleBranchPolicyBuildValidation = new azuredevops.BranchPolicyBuildValidation("example", {
        projectId: example.id,
        enabled: true,
        blocking: true,
        settings: {
            displayName: "Example build validation policy",
            buildDefinitionId: exampleBuildDefinition.id,
            queueOnSourceUpdateOnly: true,
            validDuration: 720,
            filenamePatterns: [
                "/WebApp/*",
                "!/WebApp/Tests/*",
                "*.cs",
            ],
            scopes: [
                {
                    repositoryId: exampleGit.id,
                    repositoryRef: exampleGit.defaultBranch,
                    matchType: "Exact",
                },
                {
                    repositoryId: exampleGit.id,
                    repositoryRef: "refs/heads/releases",
                    matchType: "Prefix",
                },
                {
                    matchType: "DefaultBranch",
                },
            ],
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example = azuredevops.Project("example", name="Example Project")
    example_git = azuredevops.Git("example",
        project_id=example.id,
        name="Example Repository",
        initialization={
            "init_type": "Clean",
        })
    example_build_definition = azuredevops.BuildDefinition("example",
        project_id=example.id,
        name="Example Build Definition",
        repository={
            "repo_type": "TfsGit",
            "repo_id": example_git.id,
            "yml_path": "azure-pipelines.yml",
        })
    example_branch_policy_build_validation = azuredevops.BranchPolicyBuildValidation("example",
        project_id=example.id,
        enabled=True,
        blocking=True,
        settings={
            "display_name": "Example build validation policy",
            "build_definition_id": example_build_definition.id,
            "queue_on_source_update_only": True,
            "valid_duration": 720,
            "filename_patterns": [
                "/WebApp/*",
                "!/WebApp/Tests/*",
                "*.cs",
            ],
            "scopes": [
                {
                    "repository_id": example_git.id,
                    "repository_ref": example_git.default_branch,
                    "match_type": "Exact",
                },
                {
                    "repository_id": example_git.id,
                    "repository_ref": "refs/heads/releases",
                    "match_type": "Prefix",
                },
                {
                    "match_type": "DefaultBranch",
                },
            ],
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := azuredevops.NewProject(ctx, "example", &azuredevops.ProjectArgs{
    			Name: pulumi.String("Example Project"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleGit, err := azuredevops.NewGit(ctx, "example", &azuredevops.GitArgs{
    			ProjectId: example.ID(),
    			Name:      pulumi.String("Example Repository"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType: pulumi.String("Clean"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleBuildDefinition, err := azuredevops.NewBuildDefinition(ctx, "example", &azuredevops.BuildDefinitionArgs{
    			ProjectId: example.ID(),
    			Name:      pulumi.String("Example Build Definition"),
    			Repository: &azuredevops.BuildDefinitionRepositoryArgs{
    				RepoType: pulumi.String("TfsGit"),
    				RepoId:   exampleGit.ID(),
    				YmlPath:  pulumi.String("azure-pipelines.yml"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewBranchPolicyBuildValidation(ctx, "example", &azuredevops.BranchPolicyBuildValidationArgs{
    			ProjectId: example.ID(),
    			Enabled:   pulumi.Bool(true),
    			Blocking:  pulumi.Bool(true),
    			Settings: &azuredevops.BranchPolicyBuildValidationSettingsArgs{
    				DisplayName:             pulumi.String("Example build validation policy"),
    				BuildDefinitionId:       exampleBuildDefinition.ID(),
    				QueueOnSourceUpdateOnly: pulumi.Bool(true),
    				ValidDuration:           pulumi.Int(720),
    				FilenamePatterns: pulumi.StringArray{
    					pulumi.String("/WebApp/*"),
    					pulumi.String("!/WebApp/Tests/*"),
    					pulumi.String("*.cs"),
    				},
    				Scopes: azuredevops.BranchPolicyBuildValidationSettingsScopeArray{
    					&azuredevops.BranchPolicyBuildValidationSettingsScopeArgs{
    						RepositoryId:  exampleGit.ID(),
    						RepositoryRef: exampleGit.DefaultBranch,
    						MatchType:     pulumi.String("Exact"),
    					},
    					&azuredevops.BranchPolicyBuildValidationSettingsScopeArgs{
    						RepositoryId:  exampleGit.ID(),
    						RepositoryRef: pulumi.String("refs/heads/releases"),
    						MatchType:     pulumi.String("Prefix"),
    					},
    					&azuredevops.BranchPolicyBuildValidationSettingsScopeArgs{
    						MatchType: pulumi.String("DefaultBranch"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureDevOps = Pulumi.AzureDevOps;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new AzureDevOps.Project("example", new()
        {
            Name = "Example Project",
        });
    
        var exampleGit = new AzureDevOps.Git("example", new()
        {
            ProjectId = example.Id,
            Name = "Example Repository",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Clean",
            },
        });
    
        var exampleBuildDefinition = new AzureDevOps.BuildDefinition("example", new()
        {
            ProjectId = example.Id,
            Name = "Example Build Definition",
            Repository = new AzureDevOps.Inputs.BuildDefinitionRepositoryArgs
            {
                RepoType = "TfsGit",
                RepoId = exampleGit.Id,
                YmlPath = "azure-pipelines.yml",
            },
        });
    
        var exampleBranchPolicyBuildValidation = new AzureDevOps.BranchPolicyBuildValidation("example", new()
        {
            ProjectId = example.Id,
            Enabled = true,
            Blocking = true,
            Settings = new AzureDevOps.Inputs.BranchPolicyBuildValidationSettingsArgs
            {
                DisplayName = "Example build validation policy",
                BuildDefinitionId = exampleBuildDefinition.Id,
                QueueOnSourceUpdateOnly = true,
                ValidDuration = 720,
                FilenamePatterns = new[]
                {
                    "/WebApp/*",
                    "!/WebApp/Tests/*",
                    "*.cs",
                },
                Scopes = new[]
                {
                    new AzureDevOps.Inputs.BranchPolicyBuildValidationSettingsScopeArgs
                    {
                        RepositoryId = exampleGit.Id,
                        RepositoryRef = exampleGit.DefaultBranch,
                        MatchType = "Exact",
                    },
                    new AzureDevOps.Inputs.BranchPolicyBuildValidationSettingsScopeArgs
                    {
                        RepositoryId = exampleGit.Id,
                        RepositoryRef = "refs/heads/releases",
                        MatchType = "Prefix",
                    },
                    new AzureDevOps.Inputs.BranchPolicyBuildValidationSettingsScopeArgs
                    {
                        MatchType = "DefaultBranch",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.Git;
    import com.pulumi.azuredevops.GitArgs;
    import com.pulumi.azuredevops.inputs.GitInitializationArgs;
    import com.pulumi.azuredevops.BuildDefinition;
    import com.pulumi.azuredevops.BuildDefinitionArgs;
    import com.pulumi.azuredevops.inputs.BuildDefinitionRepositoryArgs;
    import com.pulumi.azuredevops.BranchPolicyBuildValidation;
    import com.pulumi.azuredevops.BranchPolicyBuildValidationArgs;
    import com.pulumi.azuredevops.inputs.BranchPolicyBuildValidationSettingsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new Project("example", ProjectArgs.builder()
                .name("Example Project")
                .build());
    
            var exampleGit = new Git("exampleGit", GitArgs.builder()
                .projectId(example.id())
                .name("Example Repository")
                .initialization(GitInitializationArgs.builder()
                    .initType("Clean")
                    .build())
                .build());
    
            var exampleBuildDefinition = new BuildDefinition("exampleBuildDefinition", BuildDefinitionArgs.builder()
                .projectId(example.id())
                .name("Example Build Definition")
                .repository(BuildDefinitionRepositoryArgs.builder()
                    .repoType("TfsGit")
                    .repoId(exampleGit.id())
                    .ymlPath("azure-pipelines.yml")
                    .build())
                .build());
    
            var exampleBranchPolicyBuildValidation = new BranchPolicyBuildValidation("exampleBranchPolicyBuildValidation", BranchPolicyBuildValidationArgs.builder()
                .projectId(example.id())
                .enabled(true)
                .blocking(true)
                .settings(BranchPolicyBuildValidationSettingsArgs.builder()
                    .displayName("Example build validation policy")
                    .buildDefinitionId(exampleBuildDefinition.id())
                    .queueOnSourceUpdateOnly(true)
                    .validDuration(720)
                    .filenamePatterns(                
                        "/WebApp/*",
                        "!/WebApp/Tests/*",
                        "*.cs")
                    .scopes(                
                        BranchPolicyBuildValidationSettingsScopeArgs.builder()
                            .repositoryId(exampleGit.id())
                            .repositoryRef(exampleGit.defaultBranch())
                            .matchType("Exact")
                            .build(),
                        BranchPolicyBuildValidationSettingsScopeArgs.builder()
                            .repositoryId(exampleGit.id())
                            .repositoryRef("refs/heads/releases")
                            .matchType("Prefix")
                            .build(),
                        BranchPolicyBuildValidationSettingsScopeArgs.builder()
                            .matchType("DefaultBranch")
                            .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azuredevops:Project
        properties:
          name: Example Project
      exampleGit:
        type: azuredevops:Git
        name: example
        properties:
          projectId: ${example.id}
          name: Example Repository
          initialization:
            initType: Clean
      exampleBuildDefinition:
        type: azuredevops:BuildDefinition
        name: example
        properties:
          projectId: ${example.id}
          name: Example Build Definition
          repository:
            repoType: TfsGit
            repoId: ${exampleGit.id}
            ymlPath: azure-pipelines.yml
      exampleBranchPolicyBuildValidation:
        type: azuredevops:BranchPolicyBuildValidation
        name: example
        properties:
          projectId: ${example.id}
          enabled: true
          blocking: true
          settings:
            displayName: Example build validation policy
            buildDefinitionId: ${exampleBuildDefinition.id}
            queueOnSourceUpdateOnly: true
            validDuration: 720
            filenamePatterns:
              - /WebApp/*
              - '!/WebApp/Tests/*'
              - '*.cs'
            scopes:
              - repositoryId: ${exampleGit.id}
                repositoryRef: ${exampleGit.defaultBranch}
                matchType: Exact
              - repositoryId: ${exampleGit.id}
                repositoryRef: refs/heads/releases
                matchType: Prefix
              - matchType: DefaultBranch
    

    Create BranchPolicyBuildValidation Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new BranchPolicyBuildValidation(name: string, args: BranchPolicyBuildValidationArgs, opts?: CustomResourceOptions);
    @overload
    def BranchPolicyBuildValidation(resource_name: str,
                                    args: BranchPolicyBuildValidationArgs,
                                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def BranchPolicyBuildValidation(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    project_id: Optional[str] = None,
                                    settings: Optional[BranchPolicyBuildValidationSettingsArgs] = None,
                                    blocking: Optional[bool] = None,
                                    enabled: Optional[bool] = None)
    func NewBranchPolicyBuildValidation(ctx *Context, name string, args BranchPolicyBuildValidationArgs, opts ...ResourceOption) (*BranchPolicyBuildValidation, error)
    public BranchPolicyBuildValidation(string name, BranchPolicyBuildValidationArgs args, CustomResourceOptions? opts = null)
    public BranchPolicyBuildValidation(String name, BranchPolicyBuildValidationArgs args)
    public BranchPolicyBuildValidation(String name, BranchPolicyBuildValidationArgs args, CustomResourceOptions options)
    
    type: azuredevops:BranchPolicyBuildValidation
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args BranchPolicyBuildValidationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args BranchPolicyBuildValidationArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args BranchPolicyBuildValidationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BranchPolicyBuildValidationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BranchPolicyBuildValidationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var branchPolicyBuildValidationResource = new AzureDevOps.BranchPolicyBuildValidation("branchPolicyBuildValidationResource", new()
    {
        ProjectId = "string",
        Settings = new AzureDevOps.Inputs.BranchPolicyBuildValidationSettingsArgs
        {
            BuildDefinitionId = 0,
            DisplayName = "string",
            Scopes = new[]
            {
                new AzureDevOps.Inputs.BranchPolicyBuildValidationSettingsScopeArgs
                {
                    MatchType = "string",
                    RepositoryId = "string",
                    RepositoryRef = "string",
                },
            },
            FilenamePatterns = new[]
            {
                "string",
            },
            ManualQueueOnly = false,
            QueueOnSourceUpdateOnly = false,
            ValidDuration = 0,
        },
        Blocking = false,
        Enabled = false,
    });
    
    example, err := azuredevops.NewBranchPolicyBuildValidation(ctx, "branchPolicyBuildValidationResource", &azuredevops.BranchPolicyBuildValidationArgs{
    	ProjectId: pulumi.String("string"),
    	Settings: &azuredevops.BranchPolicyBuildValidationSettingsArgs{
    		BuildDefinitionId: pulumi.Int(0),
    		DisplayName:       pulumi.String("string"),
    		Scopes: azuredevops.BranchPolicyBuildValidationSettingsScopeArray{
    			&azuredevops.BranchPolicyBuildValidationSettingsScopeArgs{
    				MatchType:     pulumi.String("string"),
    				RepositoryId:  pulumi.String("string"),
    				RepositoryRef: pulumi.String("string"),
    			},
    		},
    		FilenamePatterns: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		ManualQueueOnly:         pulumi.Bool(false),
    		QueueOnSourceUpdateOnly: pulumi.Bool(false),
    		ValidDuration:           pulumi.Int(0),
    	},
    	Blocking: pulumi.Bool(false),
    	Enabled:  pulumi.Bool(false),
    })
    
    var branchPolicyBuildValidationResource = new BranchPolicyBuildValidation("branchPolicyBuildValidationResource", BranchPolicyBuildValidationArgs.builder()
        .projectId("string")
        .settings(BranchPolicyBuildValidationSettingsArgs.builder()
            .buildDefinitionId(0)
            .displayName("string")
            .scopes(BranchPolicyBuildValidationSettingsScopeArgs.builder()
                .matchType("string")
                .repositoryId("string")
                .repositoryRef("string")
                .build())
            .filenamePatterns("string")
            .manualQueueOnly(false)
            .queueOnSourceUpdateOnly(false)
            .validDuration(0)
            .build())
        .blocking(false)
        .enabled(false)
        .build());
    
    branch_policy_build_validation_resource = azuredevops.BranchPolicyBuildValidation("branchPolicyBuildValidationResource",
        project_id="string",
        settings={
            "build_definition_id": 0,
            "display_name": "string",
            "scopes": [{
                "match_type": "string",
                "repository_id": "string",
                "repository_ref": "string",
            }],
            "filename_patterns": ["string"],
            "manual_queue_only": False,
            "queue_on_source_update_only": False,
            "valid_duration": 0,
        },
        blocking=False,
        enabled=False)
    
    const branchPolicyBuildValidationResource = new azuredevops.BranchPolicyBuildValidation("branchPolicyBuildValidationResource", {
        projectId: "string",
        settings: {
            buildDefinitionId: 0,
            displayName: "string",
            scopes: [{
                matchType: "string",
                repositoryId: "string",
                repositoryRef: "string",
            }],
            filenamePatterns: ["string"],
            manualQueueOnly: false,
            queueOnSourceUpdateOnly: false,
            validDuration: 0,
        },
        blocking: false,
        enabled: false,
    });
    
    type: azuredevops:BranchPolicyBuildValidation
    properties:
        blocking: false
        enabled: false
        projectId: string
        settings:
            buildDefinitionId: 0
            displayName: string
            filenamePatterns:
                - string
            manualQueueOnly: false
            queueOnSourceUpdateOnly: false
            scopes:
                - matchType: string
                  repositoryId: string
                  repositoryRef: string
            validDuration: 0
    

    BranchPolicyBuildValidation Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The BranchPolicyBuildValidation resource accepts the following input properties:

    ProjectId string
    The ID of the project in which the policy will be created.
    Settings Pulumi.AzureDevOps.Inputs.BranchPolicyBuildValidationSettings
    Configuration for the policy. This block must be defined exactly once.
    Blocking bool
    A flag indicating if the policy should be blocking. Defaults to true.
    Enabled bool
    A flag indicating if the policy should be enabled. Defaults to true.
    ProjectId string
    The ID of the project in which the policy will be created.
    Settings BranchPolicyBuildValidationSettingsArgs
    Configuration for the policy. This block must be defined exactly once.
    Blocking bool
    A flag indicating if the policy should be blocking. Defaults to true.
    Enabled bool
    A flag indicating if the policy should be enabled. Defaults to true.
    projectId String
    The ID of the project in which the policy will be created.
    settings BranchPolicyBuildValidationSettings
    Configuration for the policy. This block must be defined exactly once.
    blocking Boolean
    A flag indicating if the policy should be blocking. Defaults to true.
    enabled Boolean
    A flag indicating if the policy should be enabled. Defaults to true.
    projectId string
    The ID of the project in which the policy will be created.
    settings BranchPolicyBuildValidationSettings
    Configuration for the policy. This block must be defined exactly once.
    blocking boolean
    A flag indicating if the policy should be blocking. Defaults to true.
    enabled boolean
    A flag indicating if the policy should be enabled. Defaults to true.
    project_id str
    The ID of the project in which the policy will be created.
    settings BranchPolicyBuildValidationSettingsArgs
    Configuration for the policy. This block must be defined exactly once.
    blocking bool
    A flag indicating if the policy should be blocking. Defaults to true.
    enabled bool
    A flag indicating if the policy should be enabled. Defaults to true.
    projectId String
    The ID of the project in which the policy will be created.
    settings Property Map
    Configuration for the policy. This block must be defined exactly once.
    blocking Boolean
    A flag indicating if the policy should be blocking. Defaults to true.
    enabled Boolean
    A flag indicating if the policy should be enabled. Defaults to true.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BranchPolicyBuildValidation resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing BranchPolicyBuildValidation Resource

    Get an existing BranchPolicyBuildValidation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: BranchPolicyBuildValidationState, opts?: CustomResourceOptions): BranchPolicyBuildValidation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            blocking: Optional[bool] = None,
            enabled: Optional[bool] = None,
            project_id: Optional[str] = None,
            settings: Optional[BranchPolicyBuildValidationSettingsArgs] = None) -> BranchPolicyBuildValidation
    func GetBranchPolicyBuildValidation(ctx *Context, name string, id IDInput, state *BranchPolicyBuildValidationState, opts ...ResourceOption) (*BranchPolicyBuildValidation, error)
    public static BranchPolicyBuildValidation Get(string name, Input<string> id, BranchPolicyBuildValidationState? state, CustomResourceOptions? opts = null)
    public static BranchPolicyBuildValidation get(String name, Output<String> id, BranchPolicyBuildValidationState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Blocking bool
    A flag indicating if the policy should be blocking. Defaults to true.
    Enabled bool
    A flag indicating if the policy should be enabled. Defaults to true.
    ProjectId string
    The ID of the project in which the policy will be created.
    Settings Pulumi.AzureDevOps.Inputs.BranchPolicyBuildValidationSettings
    Configuration for the policy. This block must be defined exactly once.
    Blocking bool
    A flag indicating if the policy should be blocking. Defaults to true.
    Enabled bool
    A flag indicating if the policy should be enabled. Defaults to true.
    ProjectId string
    The ID of the project in which the policy will be created.
    Settings BranchPolicyBuildValidationSettingsArgs
    Configuration for the policy. This block must be defined exactly once.
    blocking Boolean
    A flag indicating if the policy should be blocking. Defaults to true.
    enabled Boolean
    A flag indicating if the policy should be enabled. Defaults to true.
    projectId String
    The ID of the project in which the policy will be created.
    settings BranchPolicyBuildValidationSettings
    Configuration for the policy. This block must be defined exactly once.
    blocking boolean
    A flag indicating if the policy should be blocking. Defaults to true.
    enabled boolean
    A flag indicating if the policy should be enabled. Defaults to true.
    projectId string
    The ID of the project in which the policy will be created.
    settings BranchPolicyBuildValidationSettings
    Configuration for the policy. This block must be defined exactly once.
    blocking bool
    A flag indicating if the policy should be blocking. Defaults to true.
    enabled bool
    A flag indicating if the policy should be enabled. Defaults to true.
    project_id str
    The ID of the project in which the policy will be created.
    settings BranchPolicyBuildValidationSettingsArgs
    Configuration for the policy. This block must be defined exactly once.
    blocking Boolean
    A flag indicating if the policy should be blocking. Defaults to true.
    enabled Boolean
    A flag indicating if the policy should be enabled. Defaults to true.
    projectId String
    The ID of the project in which the policy will be created.
    settings Property Map
    Configuration for the policy. This block must be defined exactly once.

    Supporting Types

    BranchPolicyBuildValidationSettings, BranchPolicyBuildValidationSettingsArgs

    BuildDefinitionId int
    The ID of the build to monitor for the policy.
    DisplayName string
    The display name for the policy.
    Scopes List<Pulumi.AzureDevOps.Inputs.BranchPolicyBuildValidationSettingsScope>
    Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
    FilenamePatterns List<string>
    If a path filter is set, the policy will only apply when files which match the filter are changes. Not setting this field means that the policy will always apply. You can specify absolute paths and wildcards. Example: ["/WebApp/Models/Data.cs", "/WebApp/*", "*.cs"]. Paths prefixed with "!" are excluded. Example: ["/WebApp/*", "!/WebApp/Tests/*"]. Order is significant.
    ManualQueueOnly bool
    If set to true, the build will need to be manually queued. Defaults to false
    QueueOnSourceUpdateOnly bool
    True if the build should queue on source updates only. Defaults to true.
    ValidDuration int

    The number of minutes for which the build is valid. If 0, the build will not expire. Defaults to 720 (12 hours).

    Note Combine valid_duration and queue_on_source_update_only to set the build expiration.

    1. Expire immediately when branch is updated: valid_duration=0 and queue_on_source_update_only=false
    2. Expire after a period of time : valid_duration=360 and queue_on_source_update_only=true
    3. Never expire: valid_duration=0 and queue_on_source_update_only=true
    BuildDefinitionId int
    The ID of the build to monitor for the policy.
    DisplayName string
    The display name for the policy.
    Scopes []BranchPolicyBuildValidationSettingsScope
    Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
    FilenamePatterns []string
    If a path filter is set, the policy will only apply when files which match the filter are changes. Not setting this field means that the policy will always apply. You can specify absolute paths and wildcards. Example: ["/WebApp/Models/Data.cs", "/WebApp/*", "*.cs"]. Paths prefixed with "!" are excluded. Example: ["/WebApp/*", "!/WebApp/Tests/*"]. Order is significant.
    ManualQueueOnly bool
    If set to true, the build will need to be manually queued. Defaults to false
    QueueOnSourceUpdateOnly bool
    True if the build should queue on source updates only. Defaults to true.
    ValidDuration int

    The number of minutes for which the build is valid. If 0, the build will not expire. Defaults to 720 (12 hours).

    Note Combine valid_duration and queue_on_source_update_only to set the build expiration.

    1. Expire immediately when branch is updated: valid_duration=0 and queue_on_source_update_only=false
    2. Expire after a period of time : valid_duration=360 and queue_on_source_update_only=true
    3. Never expire: valid_duration=0 and queue_on_source_update_only=true
    buildDefinitionId Integer
    The ID of the build to monitor for the policy.
    displayName String
    The display name for the policy.
    scopes List<BranchPolicyBuildValidationSettingsScope>
    Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
    filenamePatterns List<String>
    If a path filter is set, the policy will only apply when files which match the filter are changes. Not setting this field means that the policy will always apply. You can specify absolute paths and wildcards. Example: ["/WebApp/Models/Data.cs", "/WebApp/*", "*.cs"]. Paths prefixed with "!" are excluded. Example: ["/WebApp/*", "!/WebApp/Tests/*"]. Order is significant.
    manualQueueOnly Boolean
    If set to true, the build will need to be manually queued. Defaults to false
    queueOnSourceUpdateOnly Boolean
    True if the build should queue on source updates only. Defaults to true.
    validDuration Integer

    The number of minutes for which the build is valid. If 0, the build will not expire. Defaults to 720 (12 hours).

    Note Combine valid_duration and queue_on_source_update_only to set the build expiration.

    1. Expire immediately when branch is updated: valid_duration=0 and queue_on_source_update_only=false
    2. Expire after a period of time : valid_duration=360 and queue_on_source_update_only=true
    3. Never expire: valid_duration=0 and queue_on_source_update_only=true
    buildDefinitionId number
    The ID of the build to monitor for the policy.
    displayName string
    The display name for the policy.
    scopes BranchPolicyBuildValidationSettingsScope[]
    Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
    filenamePatterns string[]
    If a path filter is set, the policy will only apply when files which match the filter are changes. Not setting this field means that the policy will always apply. You can specify absolute paths and wildcards. Example: ["/WebApp/Models/Data.cs", "/WebApp/*", "*.cs"]. Paths prefixed with "!" are excluded. Example: ["/WebApp/*", "!/WebApp/Tests/*"]. Order is significant.
    manualQueueOnly boolean
    If set to true, the build will need to be manually queued. Defaults to false
    queueOnSourceUpdateOnly boolean
    True if the build should queue on source updates only. Defaults to true.
    validDuration number

    The number of minutes for which the build is valid. If 0, the build will not expire. Defaults to 720 (12 hours).

    Note Combine valid_duration and queue_on_source_update_only to set the build expiration.

    1. Expire immediately when branch is updated: valid_duration=0 and queue_on_source_update_only=false
    2. Expire after a period of time : valid_duration=360 and queue_on_source_update_only=true
    3. Never expire: valid_duration=0 and queue_on_source_update_only=true
    build_definition_id int
    The ID of the build to monitor for the policy.
    display_name str
    The display name for the policy.
    scopes Sequence[BranchPolicyBuildValidationSettingsScope]
    Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
    filename_patterns Sequence[str]
    If a path filter is set, the policy will only apply when files which match the filter are changes. Not setting this field means that the policy will always apply. You can specify absolute paths and wildcards. Example: ["/WebApp/Models/Data.cs", "/WebApp/*", "*.cs"]. Paths prefixed with "!" are excluded. Example: ["/WebApp/*", "!/WebApp/Tests/*"]. Order is significant.
    manual_queue_only bool
    If set to true, the build will need to be manually queued. Defaults to false
    queue_on_source_update_only bool
    True if the build should queue on source updates only. Defaults to true.
    valid_duration int

    The number of minutes for which the build is valid. If 0, the build will not expire. Defaults to 720 (12 hours).

    Note Combine valid_duration and queue_on_source_update_only to set the build expiration.

    1. Expire immediately when branch is updated: valid_duration=0 and queue_on_source_update_only=false
    2. Expire after a period of time : valid_duration=360 and queue_on_source_update_only=true
    3. Never expire: valid_duration=0 and queue_on_source_update_only=true
    buildDefinitionId Number
    The ID of the build to monitor for the policy.
    displayName String
    The display name for the policy.
    scopes List<Property Map>
    Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
    filenamePatterns List<String>
    If a path filter is set, the policy will only apply when files which match the filter are changes. Not setting this field means that the policy will always apply. You can specify absolute paths and wildcards. Example: ["/WebApp/Models/Data.cs", "/WebApp/*", "*.cs"]. Paths prefixed with "!" are excluded. Example: ["/WebApp/*", "!/WebApp/Tests/*"]. Order is significant.
    manualQueueOnly Boolean
    If set to true, the build will need to be manually queued. Defaults to false
    queueOnSourceUpdateOnly Boolean
    True if the build should queue on source updates only. Defaults to true.
    validDuration Number

    The number of minutes for which the build is valid. If 0, the build will not expire. Defaults to 720 (12 hours).

    Note Combine valid_duration and queue_on_source_update_only to set the build expiration.

    1. Expire immediately when branch is updated: valid_duration=0 and queue_on_source_update_only=false
    2. Expire after a period of time : valid_duration=360 and queue_on_source_update_only=true
    3. Never expire: valid_duration=0 and queue_on_source_update_only=true

    BranchPolicyBuildValidationSettingsScope, BranchPolicyBuildValidationSettingsScopeArgs

    MatchType string
    The match type to use when applying the policy. Supported values are Exact (default), Prefix or DefaultBranch.
    RepositoryId string
    The repository ID. Needed only if the scope of the policy will be limited to a single repository. If match_type is DefaultBranch, this should not be defined.
    RepositoryRef string
    The ref pattern to use for the match when match_type other than DefaultBranch. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.
    MatchType string
    The match type to use when applying the policy. Supported values are Exact (default), Prefix or DefaultBranch.
    RepositoryId string
    The repository ID. Needed only if the scope of the policy will be limited to a single repository. If match_type is DefaultBranch, this should not be defined.
    RepositoryRef string
    The ref pattern to use for the match when match_type other than DefaultBranch. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.
    matchType String
    The match type to use when applying the policy. Supported values are Exact (default), Prefix or DefaultBranch.
    repositoryId String
    The repository ID. Needed only if the scope of the policy will be limited to a single repository. If match_type is DefaultBranch, this should not be defined.
    repositoryRef String
    The ref pattern to use for the match when match_type other than DefaultBranch. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.
    matchType string
    The match type to use when applying the policy. Supported values are Exact (default), Prefix or DefaultBranch.
    repositoryId string
    The repository ID. Needed only if the scope of the policy will be limited to a single repository. If match_type is DefaultBranch, this should not be defined.
    repositoryRef string
    The ref pattern to use for the match when match_type other than DefaultBranch. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.
    match_type str
    The match type to use when applying the policy. Supported values are Exact (default), Prefix or DefaultBranch.
    repository_id str
    The repository ID. Needed only if the scope of the policy will be limited to a single repository. If match_type is DefaultBranch, this should not be defined.
    repository_ref str
    The ref pattern to use for the match when match_type other than DefaultBranch. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.
    matchType String
    The match type to use when applying the policy. Supported values are Exact (default), Prefix or DefaultBranch.
    repositoryId String
    The repository ID. Needed only if the scope of the policy will be limited to a single repository. If match_type is DefaultBranch, this should not be defined.
    repositoryRef String
    The ref pattern to use for the match when match_type other than DefaultBranch. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.

    Import

    Azure DevOps Branch Policies can be imported using the project ID and policy configuration ID:

    $ pulumi import azuredevops:index/branchPolicyBuildValidation:BranchPolicyBuildValidation example 00000000-0000-0000-0000-000000000000/0
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure DevOps pulumi/pulumi-azuredevops
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azuredevops Terraform Provider.
    azuredevops logo
    Azure DevOps v3.4.0 published on Wednesday, Oct 30, 2024 by Pulumi