Skip to content

Commit 4c6f76a

Browse files
authored
Merge pull request #188 from ruwinrmrrr/main-test-1
Refactor CI trigger configuration in Github Build Definition module
2 parents 12d788d + 1a4f4c6 commit 4c6f76a

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

modules/azuredevops/GitHub-Build-Definition/github_build_definition.tf

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,24 @@ resource "azuredevops_build_definition" "devops_build_definition" {
1717
queue_status = var.status
1818

1919
ci_trigger {
20-
use_yaml = true
20+
use_yaml = var.use_yaml == true ? true : null
21+
22+
dynamic "override" {
23+
for_each = var.use_yaml == false ? var.ci_trigger_overrides : []
24+
content {
25+
batch = override.value.batch
26+
max_concurrent_builds_per_branch = override.value.max_concurrent_builds_per_branch
27+
polling_interval = override.value.polling_interval
28+
branch_filter {
29+
exclude = override.value.branch_filter_exclude_list
30+
include = override.value.branch_filter_include_list
31+
}
32+
path_filter {
33+
exclude = override.value.path_filter_exclude_list
34+
include = override.value.path_filter_include_list
35+
}
36+
}
37+
}
2138
}
2239

2340
repository {

modules/azuredevops/GitHub-Build-Definition/variables.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,23 @@ variable "status" {
6767
description = "The queue status of the build definition. Valid values: enabled or paused or disabled"
6868
type = string
6969
}
70+
71+
variable "use_yaml" {
72+
default = true
73+
description = "Use YAML for CI trigger"
74+
type = bool
75+
}
76+
77+
variable "ci_trigger_overrides" {
78+
default = []
79+
description = "Overrides for the CI trigger. Only used when use_yaml is false."
80+
type = list(object({
81+
batch = bool
82+
max_concurrent_builds_per_branch = number
83+
polling_interval = number
84+
branch_filter_exclude_list = list(string)
85+
branch_filter_include_list = list(string)
86+
path_filter_exclude_list = list(string)
87+
path_filter_include_list = list(string)
88+
}))
89+
}

0 commit comments

Comments
 (0)