Debian Codegraph @

buildkit/sourcepolicy/pb/policy.proto

raw
1 syntax = "proto3";
2
3 package moby.buildkit.v1.sourcepolicy;
4
5 option go_package = "github.com/moby/buildkit/sourcepolicy/pb;moby_buildkit_v1_sourcepolicy";
6
7 // Rule defines the action(s) to take when a source is matched
8 message Rule {
9 PolicyAction action = 1;
10 Selector selector = 2;
11 Update updates = 3;
12 }
13
14 // Update contains updates to the matched build step after rule is applied
15 message Update {
16 string identifier = 1;
17 map<string, string> attrs = 2;
18 }
19
20 // Selector identifies a source to match a policy to
21 message Selector {
22 string identifier = 1;
23 // MatchType is the type of match to perform on the source identifier
24 MatchType match_type = 2;
25 repeated AttrConstraint constraints = 3;
26 }
27
28 // PolicyAction defines the action to take when a source is matched
29 enum PolicyAction {
30 ALLOW = 0;
31 DENY = 1;
32 CONVERT = 2;
33 }
34
35 // AttrConstraint defines a constraint on a source attribute
36 message AttrConstraint {
37 string key = 1;
38 string value = 2;
39 AttrMatch condition = 3;
40 }
41
42 // AttrMatch defines the condition to match a source attribute
43 enum AttrMatch {
44 EQUAL = 0;
45 NOTEQUAL = 1;
46 MATCHES = 2;
47 }
48
49 // Policy is the list of rules the policy engine will perform
50 message Policy {
51 int64 version = 1; // Currently 1
52 repeated Rule rules = 2;
53 }
54
55 // Match type is used to determine how a rule source is matched
56 enum MatchType {
57 // WILDCARD is the default matching type.
58 // It may first attempt to due an exact match but will follow up with a wildcard match
59 // For something more powerful, use REGEX
60 WILDCARD = 0;
61 // EXACT treats the source identifier as a litteral string match
62 EXACT = 1;
63 // REGEX treats the source identifier as a regular expression
64 // With regex matching you can also use match groups to replace values in the destination identifier
65 REGEX = 2;
66 }