This repository was archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathExecutorMapping.tsx
More file actions
109 lines (104 loc) · 2.92 KB
/
ExecutorMapping.tsx
File metadata and controls
109 lines (104 loc) · 2.92 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
import {
executors,
Job,
parsers,
reusable,
workflow,
} from '@circleci/circleci-config-sdk';
import ExecutorSummary from '../components/atoms/summaries/ExecutorSummary';
import ExecutorInspector from '../components/containers/inspector/ExecutorInspector';
import { executorSubtypes } from '../components/containers/inspector/subtypes/ExecutorSubtypes';
import { componentParametersSubtypes } from '../components/containers/inspector/subtypes/ParameterSubtypes';
import ExecutorTypePageNav from '../components/menus/definitions/subtypes/ExecutorTypePage';
import ExecutorIcon from '../icons/components/ExecutorIcon';
import ComponentMapping from './ComponentMapping';
import JobMapping from './JobMapping';
export type AnyExecutor =
| executors.DockerExecutor
| executors.MacOSExecutor
| executors.MachineExecutor
| executors.WindowsExecutor
| executors.Executor;
const ExecutorMapping: ComponentMapping<
reusable.ReusableExecutor,
workflow.WorkflowJob
> = {
type: 'executors',
name: {
singular: 'Executor',
plural: 'Executors',
},
defaults: {
docker: {
name: 'new-docker-executor',
docker: [
{
image: 'cimg/base:stable',
},
],
resource_class: 'medium',
},
machine: {
name: 'new-machine-executor',
machine: {
image: 'ubuntu-2004:202111-01',
parameters: {},
},
resource_class: 'medium',
},
macos: {
name: 'new-macos-executor',
macos: {
xcode: '13.2.0',
parameters: {},
},
resource_class: 'medium',
},
windows: {
name: 'new-windows-executor',
machine: {
image: 'windows-server-2019-vs2019:stable',
parameters: {},
},
resource_class: 'windows.medium',
},
},
parameters: componentParametersSubtypes.executor,
transform: ({ name, ...values }) => {
return parsers.parseReusableExecutor(name, values);
},
store: {
get: (state) => state.definitions.executors,
add: (actions) => actions.defineExecutor,
update: (actions) => actions.updateExecutor,
remove: (actions) => actions.undefineExecutor,
},
dragTarget: JobMapping.type,
applyToNode: (data, nodeData) => {
const oldJob = nodeData.job;
return new workflow.WorkflowJob(
new Job(oldJob.name, data.reuse(), oldJob.steps),
nodeData.parameters,
);
},
subtypes: {
component: ExecutorTypePageNav,
getSubtype: (reusableExec) => {
const reusableExecsKeys = Object.keys(reusableExec);
return Object.keys(executorSubtypes).find((subtype) =>
reusableExecsKeys.includes(subtype),
);
},
definitions: executorSubtypes,
},
components: {
icon: ExecutorIcon,
summary: ExecutorSummary,
inspector: ExecutorInspector,
},
docsInfo: {
description: 'Technology/Environment to run with',
link: 'https://circleci.com/docs/2.0/executor-types/',
},
};
export default ExecutorMapping;