AzureDevOps
BranchPolicyBuildValidation
Deprecated:
azuredevops.policy.BranchPolicyBuildValidation has been deprecated in favor of azuredevops.BranchPolicyBuildValidation
Manages a build validation branch policy within Azure DevOps.
Relevant Links
Example Usage
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
class MyStack : Stack
{
public MyStack()
{
var exampleProject = new AzureDevOps.Project("exampleProject", new AzureDevOps.ProjectArgs
{
});
var exampleGit = new AzureDevOps.Git("exampleGit", new AzureDevOps.GitArgs
{
ProjectId = exampleProject.Id,
Initialization = new AzureDevOps.Inputs.GitInitializationArgs
{
InitType = "Clean",
},
});
var exampleBuildDefinition = new AzureDevOps.BuildDefinition("exampleBuildDefinition", new AzureDevOps.BuildDefinitionArgs
{
ProjectId = exampleProject.Id,
Repository = new AzureDevOps.Inputs.BuildDefinitionRepositoryArgs
{
RepoType = "TfsGit",
RepoId = exampleGit.Id,
YmlPath = "azure-pipelines.yml",
},
});
var exampleBranchPolicyBuildValidation = new AzureDevOps.BranchPolicyBuildValidation("exampleBranchPolicyBuildValidation", new AzureDevOps.BranchPolicyBuildValidationArgs
{
ProjectId = exampleProject.Id,
Enabled = true,
Blocking = true,
Settings = new AzureDevOps.Inputs.BranchPolicyBuildValidationSettingsArgs
{
DisplayName = "Example build validation policy",
BuildDefinitionId = exampleBuildDefinition.Id,
ValidDuration = 720,
FilenamePatterns =
{
"/WebApp/*",
"!/WebApp/Tests/*",
"*.cs",
},
Scopes =
{
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",
},
},
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", nil)
if err != nil {
return err
}
exampleGit, err := azuredevops.NewGit(ctx, "exampleGit", &azuredevops.GitArgs{
ProjectId: exampleProject.ID(),
Initialization: &GitInitializationArgs{
InitType: pulumi.String("Clean"),
},
})
if err != nil {
return err
}
exampleBuildDefinition, err := azuredevops.NewBuildDefinition(ctx, "exampleBuildDefinition", &azuredevops.BuildDefinitionArgs{
ProjectId: exampleProject.ID(),
Repository: &BuildDefinitionRepositoryArgs{
RepoType: pulumi.String("TfsGit"),
RepoId: exampleGit.ID(),
YmlPath: pulumi.String("azure-pipelines.yml"),
},
})
if err != nil {
return err
}
_, err = azuredevops.NewBranchPolicyBuildValidation(ctx, "exampleBranchPolicyBuildValidation", &azuredevops.BranchPolicyBuildValidationArgs{
ProjectId: exampleProject.ID(),
Enabled: pulumi.Bool(true),
Blocking: pulumi.Bool(true),
Settings: &BranchPolicyBuildValidationSettingsArgs{
DisplayName: pulumi.String("Example build validation policy"),
BuildDefinitionId: exampleBuildDefinition.ID(),
ValidDuration: pulumi.Int(720),
FilenamePatterns: pulumi.StringArray{
pulumi.String("/WebApp/*"),
pulumi.String("!/WebApp/Tests/*"),
pulumi.String("*.cs"),
},
Scopes: BranchPolicyBuildValidationSettingsScopeArray{
&BranchPolicyBuildValidationSettingsScopeArgs{
RepositoryId: exampleGit.ID(),
RepositoryRef: exampleGit.DefaultBranch,
MatchType: pulumi.String("Exact"),
},
&BranchPolicyBuildValidationSettingsScopeArgs{
RepositoryId: exampleGit.ID(),
RepositoryRef: pulumi.String("refs/heads/releases"),
MatchType: pulumi.String("Prefix"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("exampleProject")
example_git = azuredevops.Git("exampleGit",
project_id=example_project.id,
initialization=azuredevops.GitInitializationArgs(
init_type="Clean",
))
example_build_definition = azuredevops.BuildDefinition("exampleBuildDefinition",
project_id=example_project.id,
repository=azuredevops.BuildDefinitionRepositoryArgs(
repo_type="TfsGit",
repo_id=example_git.id,
yml_path="azure-pipelines.yml",
))
example_branch_policy_build_validation = azuredevops.BranchPolicyBuildValidation("exampleBranchPolicyBuildValidation",
project_id=example_project.id,
enabled=True,
blocking=True,
settings=azuredevops.BranchPolicyBuildValidationSettingsArgs(
display_name="Example build validation policy",
build_definition_id=example_build_definition.id,
valid_duration=720,
filename_patterns=[
"/WebApp/*",
"!/WebApp/Tests/*",
"*.cs",
],
scopes=[
azuredevops.BranchPolicyBuildValidationSettingsScopeArgs(
repository_id=example_git.id,
repository_ref=example_git.default_branch,
match_type="Exact",
),
azuredevops.BranchPolicyBuildValidationSettingsScopeArgs(
repository_id=example_git.id,
repository_ref="refs/heads/releases",
match_type="Prefix",
),
],
))
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("exampleProject", {});
const exampleGit = new azuredevops.Git("exampleGit", {
projectId: exampleProject.id,
initialization: {
initType: "Clean",
},
});
const exampleBuildDefinition = new azuredevops.BuildDefinition("exampleBuildDefinition", {
projectId: exampleProject.id,
repository: {
repoType: "TfsGit",
repoId: exampleGit.id,
ymlPath: "azure-pipelines.yml",
},
});
const exampleBranchPolicyBuildValidation = new azuredevops.BranchPolicyBuildValidation("exampleBranchPolicyBuildValidation", {
projectId: exampleProject.id,
enabled: true,
blocking: true,
settings: {
displayName: "Example build validation policy",
buildDefinitionId: exampleBuildDefinition.id,
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",
},
],
},
});
Coming soon!
Create a BranchPolicyBuildValidation Resource
new BranchPolicyBuildValidation(name: string, args: BranchPolicyBuildValidationArgs, opts?: CustomResourceOptions);
@overload
def BranchPolicyBuildValidation(resource_name: str,
opts: Optional[ResourceOptions] = None,
blocking: Optional[bool] = None,
enabled: Optional[bool] = None,
project_id: Optional[str] = None,
settings: Optional[_policy.BranchPolicyBuildValidationSettingsArgs] = None)
@overload
def BranchPolicyBuildValidation(resource_name: str,
args: BranchPolicyBuildValidationArgs,
opts: Optional[ResourceOptions] = 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:Policy:BranchPolicyBuildValidation
properties: # The arguments to resource properties.
options: # 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.
- 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.
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
The BranchPolicyBuildValidation resource accepts the following input properties:
- Project
Id string The ID of the project in which the policy will be created.
- Settings
Pulumi.
Azure Dev Ops. Policy. Inputs. Branch Policy Build Validation Settings Args 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 string The ID of the project in which the policy will be created.
- Settings
Branch
Policy Build Validation Settings Args 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 String The ID of the project in which the policy will be created.
- settings
Branch
Build Validation Settings Args 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 string The ID of the project in which the policy will be created.
- settings
Branch
Policy Build Validation Settings Args 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
Branch
Policy Build Validation Settings Args 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 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 an 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[_policy.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.
- 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 string The ID of the project in which the policy will be created.
- Settings
Pulumi.
Azure Dev Ops. Policy. Inputs. Branch Policy Build Validation Settings Args 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 string The ID of the project in which the policy will be created.
- Settings
Branch
Policy Build Validation Settings Args 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 String The ID of the project in which the policy will be created.
- settings
Branch
Build Validation Settings Args 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 string The ID of the project in which the policy will be created.
- settings
Branch
Policy Build Validation Settings Args 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
Branch
Policy Build Validation Settings Args 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 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
- Build
Definition intId The ID of the build to monitor for the policy.
- Display
Name string The display name for the policy.
- Scopes
List<Pulumi.
Azure Dev Ops. Policy. Inputs. Branch Policy Build Validation Settings Scope> Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
- Filename
Patterns 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.- Manual
Queue boolOnly If set to true, the build will need to be manually queued. Defaults to
false
- Queue
On boolSource Update Only 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 to720
(12 hours).
- Build
Definition intId The ID of the build to monitor for the policy.
- Display
Name string The display name for the policy.
- Scopes
[]Branch
Policy Build Validation Settings Scope Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
- Filename
Patterns []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.- Manual
Queue boolOnly If set to true, the build will need to be manually queued. Defaults to
false
- Queue
On boolSource Update Only 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 to720
(12 hours).
- build
Definition IntegerId The ID of the build to monitor for the policy.
- display
Name String The display name for the policy.
- scopes
List<Branch
Build Validation Settings Scope> Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
- filename
Patterns 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.- manual
Queue BooleanOnly If set to true, the build will need to be manually queued. Defaults to
false
- queue
On BooleanSource Update Only True if the build should queue on source updates only. Defaults to
true
.- valid
Duration Integer The number of minutes for which the build is valid. If
0
, the build will not expire. Defaults to720
(12 hours).
- build
Definition numberId The ID of the build to monitor for the policy.
- display
Name string The display name for the policy.
- scopes
Branch
Policy Build Validation Settings Scope[] Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
- filename
Patterns 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.- manual
Queue booleanOnly If set to true, the build will need to be manually queued. Defaults to
false
- queue
On booleanSource Update Only True if the build should queue on source updates only. Defaults to
true
.- valid
Duration number The number of minutes for which the build is valid. If
0
, the build will not expire. Defaults to720
(12 hours).
- build_
definition_ intid The ID of the build to monitor for the policy.
- display_
name str The display name for the policy.
- scopes
Branch
Policy Build Validation Settings Scope] 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_ boolonly If set to true, the build will need to be manually queued. Defaults to
false
- queue_
on_ boolsource_ update_ only 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 to720
(12 hours).
- build
Definition NumberId The ID of the build to monitor for the policy.
- display
Name 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.
- filename
Patterns 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.- manual
Queue BooleanOnly If set to true, the build will need to be manually queued. Defaults to
false
- queue
On BooleanSource Update Only True if the build should queue on source updates only. Defaults to
true
.- valid
Duration Number The number of minutes for which the build is valid. If
0
, the build will not expire. Defaults to720
(12 hours).
BranchPolicyBuildValidationSettingsScope
- Match
Type string The match type to use when applying the policy. Supported values are
Exact
(default) orPrefix
.- Repository
Id string The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- Repository
Ref string The ref pattern to use for the match. If
match_type
isExact
, this should be a qualified ref such asrefs/heads/master
. Ifmatch_type
isPrefix
, this should be a ref path such asrefs/heads/releases
.
- Match
Type string The match type to use when applying the policy. Supported values are
Exact
(default) orPrefix
.- Repository
Id string The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- Repository
Ref string The ref pattern to use for the match. If
match_type
isExact
, this should be a qualified ref such asrefs/heads/master
. Ifmatch_type
isPrefix
, this should be a ref path such asrefs/heads/releases
.
- match
Type String The match type to use when applying the policy. Supported values are
Exact
(default) orPrefix
.- repository
Id String The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- repository
Ref String The ref pattern to use for the match. If
match_type
isExact
, this should be a qualified ref such asrefs/heads/master
. Ifmatch_type
isPrefix
, this should be a ref path such asrefs/heads/releases
.
- match
Type string The match type to use when applying the policy. Supported values are
Exact
(default) orPrefix
.- repository
Id string The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- repository
Ref string The ref pattern to use for the match. If
match_type
isExact
, this should be a qualified ref such asrefs/heads/master
. Ifmatch_type
isPrefix
, this should be a ref path such asrefs/heads/releases
.
- match_
type str The match type to use when applying the policy. Supported values are
Exact
(default) orPrefix
.- repository_
id str The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- repository_
ref str The ref pattern to use for the match. If
match_type
isExact
, this should be a qualified ref such asrefs/heads/master
. Ifmatch_type
isPrefix
, this should be a ref path such asrefs/heads/releases
.
- match
Type String The match type to use when applying the policy. Supported values are
Exact
(default) orPrefix
.- repository
Id String The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- repository
Ref String The ref pattern to use for the match. If
match_type
isExact
, this should be a qualified ref such asrefs/heads/master
. Ifmatch_type
isPrefix
, this should be a ref path such asrefs/heads/releases
.
Import
Azure DevOps Branch Policies can be imported using the project ID and policy configuration ID
$ pulumi import azuredevops:Policy/branchPolicyBuildValidation:BranchPolicyBuildValidation example 00000000-0000-0000-0000-000000000000/0
Package Details
- Repository
- https://github.com/pulumi/pulumi-azuredevops
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azuredevops
Terraform Provider.