-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathterragrunt-monorepo-ignore-changes-outside-root.rego
66 lines (51 loc) · 1.55 KB
/
terragrunt-monorepo-ignore-changes-outside-root.rego
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package spacelift
import future.keywords.contains
import future.keywords.if
import future.keywords.in
# This example Git push policy ignores all changes that are outside a project's
# root. Other than that, it follows the defaults - pushes to the tracked branch
# trigger tracked runs, pushes to all other branches trigger proposed runs, tag
# pushes are ignored.
#
# You can read more about push policies here:
# https://docs.spacelift.io/concepts/policy/git-push-policy
track if {
affected
input.push.branch == input.stack.branch
}
propose if {
affected
}
ignore if {
not affected
}
ignore if {
input.push.tag != ""
}
# Here's a definition of an affected file - its path must:
# a) start with the Stack's project root, and;
# b) end with ".tf", indicating that it's a Terraform source file;
affected if {
some filepath in input.push.affected_files
startswith(filepath, input.stack.project_root)
endswith(filepath, ".tf")
}
# OR
# a) start with the Stack's project root, and;
# b) end with ".hcl", indicating that it's a Terraform source file;
affected if {
some filepath in input.push.affected_files
startswith(filepath, input.stack.project_root)
endswith(filepath, ".hcl")
}
# OR
# a) start with the Stack's project root, and;
# b) end with ".rego", indicating that it's a rego policy file;
affected if {
some filepath in input.push.affected_files
startswith(filepath, input.stack.project_root)
endswith(filepath, ".rego")
}
# Learn more about sampling policy evaluations here:
# https://docs.spacelift.io/concepts/policy#sampling-policy-inputs
sample := true