-
Notifications
You must be signed in to change notification settings - Fork 0
/
step.go
158 lines (153 loc) · 3.95 KB
/
step.go
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package task_run
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func tektonStepFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "Name of the step",
Required: true,
},
"image": {
Type: schema.TypeString,
Description: "Image of the step",
Optional: true,
},
"command": {
Type: schema.TypeList,
Description: "Command to execute in the container",
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"args": {
Type: schema.TypeList,
Description: "Arguments to the entrypoint",
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"working_dir": {
Type: schema.TypeString,
Description: "Working directory to use when executing the step",
Optional: true,
},
"env": {
Type: schema.TypeList,
Description: "Environment variables to set for the step",
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "Name of the environment variable",
Required: true,
},
"value": {
Type: schema.TypeString,
Description: "Value of the environment variable",
Required: true,
},
},
},
},
"volume_mounts": {
Type: schema.TypeList,
Description: "Volume mounts for the step",
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "Name of the volume mount",
Required: true,
},
"mount_path": {
Type: schema.TypeString,
Description: "Path to mount the volume at",
Required: true,
},
"read_only": {
Type: schema.TypeBool,
Description: "Whether the volume should be mounted read-only",
Optional: true,
},
},
},
},
"image_pull_policy": {
Type: schema.TypeString,
Description: "Image pull policy for the step",
Optional: true,
},
"script": {
Type: schema.TypeString,
Description: "Contents of an executable file to execute",
Optional: true,
},
"timeout": {
Type: schema.TypeString,
Description: "Time after which the step times out",
Optional: true,
},
"workspaces": {
Type: schema.TypeList,
Description: "Workspaces from the TaskRun that this Step wants exclusive access to",
Optional: true,
Elem: &schema.Resource{
Schema: workspaceUsageFields(),
},
},
// "on_error": {
// Type: schema.TypeString,
// Description: "Exiting behavior of a container on error",
// Optional: true,
// },
// "stdout_config": {
// Type: schema.TypeList,
// Description: "Configuration for the stdout stream of the step",
// Optional: true,
// Elem: &schema.Resource{
// Schema: stepOutputConfigFields(),
// },
// },
// "stderr_config": {
// Type: schema.TypeList,
// Description: "Configuration for the stderr stream of the step",
// Optional: true,
// Elem: &schema.Resource{
// Schema: stepOutputConfigFields(),
// },
// },
}
}
func stepOutputConfigFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"resource": {
Type: schema.TypeString,
Description: "Name of the resource to store the stream in",
Optional: true,
},
"workspace": {
Type: schema.TypeString,
Description: "Name of the workspace to store the stream in",
Optional: true,
},
}
}
func workspaceUsageFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "Name of the workspace",
Required: true,
},
"mount_path": {
Type: schema.TypeString,
Description: "Path to mount the workspace at",
},
}
}