-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCIPipeline.Types.ts
More file actions
357 lines (320 loc) · 8.37 KB
/
CIPipeline.Types.ts
File metadata and controls
357 lines (320 loc) · 8.37 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
/*
* Copyright (c) 2024. Devtron Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DynamicDataTableCellValidationState, KeyValueTableData } from '@Shared/Components'
export interface MaterialType {
name: string
type: string
value: string
gitMaterialId: number
id: number
isSelected: boolean
gitHostId: number
gitProviderId: number
regex?: string
isRegex: boolean
url: string
}
export interface Githost {
id: number
name: string
active: boolean
webhookSecret: string
webhookUrl: string
}
export interface WebhookEvent {
id: number
gitHostId: number
name: string
isActive: boolean
selectors: WebhookEventSelectors[]
}
interface WebhookEventSelectors {
id: number
eventId: number
name: string
selector: string
toShowInCiFilter: boolean
fixValue: string
toShow: boolean
possibleValues: string
isActive: boolean
}
export interface CiPipelineSourceTypeOption {
label: string
value: string
isDisabled: boolean
isSelected: boolean
isWebhook: boolean
}
export enum RefVariableType {
GLOBAL = 'GLOBAL',
FROM_PREVIOUS_STEP = 'FROM_PREVIOUS_STEP',
NEW = 'NEW',
}
export enum PluginType {
INLINE = 'INLINE',
PLUGIN_REF = 'REF_PLUGIN',
}
export enum ScriptType {
SHELL = 'SHELL',
DOCKERFILE = 'DOCKERFILE',
CONTAINERIMAGE = 'CONTAINER_IMAGE',
}
export enum MountPath {
TRUE = 'Yes',
FALSE = 'No',
}
export enum ConditionType {
SKIP = 'SKIP',
TRIGGER = 'TRIGGER',
PASS = 'PASS',
FAIL = 'FAIL',
}
export enum RefVariableStageType {
PRE_CI = 'PRE_CI',
POST_CI = 'POST_CI',
}
export enum FilePropertyTypeSizeUnit {
KB = 'KB',
MB = 'MB',
}
export interface FilePropertyType {
allowedExtensions: string[]
maxUploadSize: number
sizeUnit: FilePropertyTypeSizeUnit
}
export interface ConstraintType {
fileProperty: FilePropertyType
}
export interface ValueConstraintType {
choices?: string[]
blockCustomValue?: boolean
constraint?: ConstraintType
}
export enum VariableTypeFormat {
STRING = 'STRING',
NUMBER = 'NUMBER',
BOOL = 'BOOL',
DATE = 'DATE',
FILE = 'FILE',
}
export interface VariableType {
id: number
name: string
value: string
format: VariableTypeFormat
description: string
defaultValue: string
allowEmptyValue: boolean
variableType: RefVariableType
refVariableStepIndex: number
refVariableName: string
refVariableStage?: RefVariableStageType
variableStepIndexInPlugin?: number
fileMountDir: string
fileReferenceId?: number
valueConstraintId?: number
valueConstraint?: ValueConstraintType
isRuntimeArg: boolean
refVariableUsed: boolean
}
interface CommandArgsMap {
command: string
args: string[]
}
export interface PortMapType {
portOnLocal: number
portOnContainer: number
}
export interface ConditionDetails {
id: number
conditionOnVariable: string
conditionOperator: string
conditionType: ConditionType
conditionalValue: string
}
export interface InlineStepDetailType {
scriptType: ScriptType
isMountCustomScript?: boolean
script?: string
dockerFileExists?: boolean
mountPath?: string
mountCodeToContainer?: boolean
mountDirectoryFromHost?: boolean
containerImagePath?: string
imagePullSecret?: string
commandArgsMap?: CommandArgsMap[]
portMap?: PortMapType[]
mountPathMap?: {
filePathOnDisk: string
filePathOnContainer: string
}[]
inputVariables?: VariableType[]
outputVariables?: VariableType[]
conditionDetails: ConditionDetails[]
storeScriptAt?: string
mountCodeToContainerPath?: string
}
interface PluginRefStepDetailType {
id: number
pluginId: number
inputVariables?: VariableType[]
outputVariables?: VariableType[]
conditionDetails?: ConditionDetails[]
}
export interface StepType {
id: number
index: number
name: string
description: string
stepType: PluginType
outputDirectoryPath: string[]
inlineStepDetail?: InlineStepDetailType
pluginRefStepDetail?: PluginRefStepDetailType
triggerIfParentStageFail: boolean
}
export interface BuildStageType {
id: number
steps: StepType[]
}
export enum CIBuildType {
SELF_DOCKERFILE_BUILD_TYPE = 'self-dockerfile-build',
MANAGED_DOCKERFILE_BUILD_TYPE = 'managed-dockerfile-build',
BUILDPACK_BUILD_TYPE = 'buildpack-build',
}
export interface BuildPackConfigType {
builderId: string
language: string
languageVersion: string
projectPath: string
builderLangEnvParam?: string
currentBuilderLangEnvParam?: string
buildPacks?: any
args?: Record<string, string>
}
export interface DockerBuildConfigType {
dockerfileContent: string
dockerfileRelativePath: string
buildContext: string
dockerfilePath?: string
dockerfileRepository?: string
args?: Record<string, string>
targetPlatform?: any
language?: string
languageFramework?: string
}
export interface CIBuildConfigType {
buildPackConfig: BuildPackConfigType
ciBuildType: CIBuildType
dockerBuildConfig: DockerBuildConfigType
gitMaterialId: number
buildContextGitMaterialId: number
id?: number
useRootBuildContext: boolean
}
export interface DockerConfigOverrideType {
dockerRegistry: string
dockerRepository: string
ciBuildConfig: CIBuildConfigType
}
export enum WORKFLOW_CACHE_CONFIG_ENUM {
INHERIT = 'INHERIT',
OVERRIDE = 'OVERRIDE',
}
export interface FormType {
name: string
args: KeyValueTableData[]
materials: MaterialType[]
gitHost: Githost
webhookEvents: WebhookEvent[]
ciPipelineSourceTypeOptions: CiPipelineSourceTypeOption[]
webhookConditionList: { selectorId: number; value: string }[]
triggerType: string
scanEnabled?: boolean
beforeDockerBuildScripts?: {
id: number
name: string
outputLocation: string
script: string
isCollapsed: boolean
index: number
}[]
afterDockerBuildScripts?: {
id: number
name: string
outputLocation: string
script: string
isCollapsed: boolean
index: number
}[]
ciPipelineEditable: true
preBuildStage?: BuildStageType
postBuildStage?: BuildStageType
isDockerConfigOverridden?: boolean
dockerConfigOverride?: DockerConfigOverrideType
isOffendingMandatoryPlugin?: boolean
workflowCacheConfig?: {
type: WORKFLOW_CACHE_CONFIG_ENUM
value: boolean
globalValue: boolean
}
}
export interface ErrorObj {
isValid: boolean
message: string | null
}
export enum InputOutputVariablesHeaderKeys {
VARIABLE = 'variable',
FORMAT = 'format',
VALUE = 'val',
}
export enum ConditionDataTableHeaderKeys {
VARIABLE = 'variable',
OPERATOR = 'operator',
VALUE = 'val',
}
type InputOutputVariablesErrorObj = Record<InputOutputVariablesHeaderKeys, DynamicDataTableCellValidationState>
type ConditionDetailsErrorObj = Record<ConditionDataTableHeaderKeys, DynamicDataTableCellValidationState>
interface StepDetailTaskErrorObj {
inputVariables?: Record<number, InputOutputVariablesErrorObj>
outputVariables?: Record<number, InputOutputVariablesErrorObj>
isInputVariablesValid?: boolean
isOutputVariablesValid?: boolean
conditionDetails?: Record<number, ConditionDetailsErrorObj>
isConditionDetailsValid?: boolean
}
export interface TaskErrorObj {
isValid: boolean
name: ErrorObj
inlineStepDetail?: StepDetailTaskErrorObj
pluginRefStepDetail?: StepDetailTaskErrorObj
}
export interface FormErrorObjectType {
name: ErrorObj
materials?: MaterialType[]
preBuildStage?: {
isValid: boolean
steps: TaskErrorObj[]
}
buildStage?: {
isValid: boolean
name: ErrorObj
}
postBuildStage?: {
isValid: boolean
steps: TaskErrorObj[]
}
}