@spinnaker/amazon 0.13.9 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/aws.validators.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pipeline/stages/deleteLambda/DeleteLambdaFunctionStageForm.d.ts +3 -0
- package/dist/pipeline/stages/deleteLambda/LambdaDeleteStage.d.ts +8 -0
- package/dist/pipeline/stages/deleteLambda/constants/deleteVersion.constants.d.ts +6 -0
- package/dist/pipeline/stages/deleteLambda/constants/deleteVersion.picker.d.ts +16 -0
- package/dist/pipeline/stages/deleteLambda/constants/index.d.ts +2 -0
- package/dist/pipeline/stages/deleteLambda/index.d.ts +1 -0
- package/dist/pipeline/stages/deployLambda/components/AwsLambdaFunctionStageForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/BasicSettingsForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/EnvironmentForm.d.ts +2 -0
- package/dist/pipeline/stages/deployLambda/components/ExecutionRoleForm.d.ts +2 -0
- package/dist/pipeline/stages/deployLambda/components/LambdaAtEdgeForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/NetworkForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/TriggerEventsForm.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/components/function.constants.d.ts +5 -0
- package/dist/pipeline/stages/deployLambda/components/index.d.ts +5 -0
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStage.d.ts +3 -0
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageConfig.d.ts +4 -0
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageExecutionDetails.d.ts +6 -0
- package/dist/pipeline/stages/deployLambda/config/UpsertDefaults.d.ts +1 -0
- package/dist/pipeline/stages/deployLambda/config/function.defaults.d.ts +2 -0
- package/dist/pipeline/stages/deployLambda/index.d.ts +1 -0
- package/dist/pipeline/stages/invokeLambda/InvokeLambdaFunctionStageForm.d.ts +3 -0
- package/dist/pipeline/stages/invokeLambda/LambdaInvokeStage.d.ts +8 -0
- package/dist/pipeline/stages/invokeLambda/components/InvokeLambdaOperation.d.ts +3 -0
- package/dist/pipeline/stages/invokeLambda/components/index.d.ts +1 -0
- package/dist/pipeline/stages/invokeLambda/index.d.ts +1 -0
- package/dist/pipeline/stages/routeLambda/LambdaRouteStage.d.ts +8 -0
- package/dist/pipeline/stages/routeLambda/RouteLambdaFunctionStageForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/TriggerEventsForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/health.constants.d.ts +5 -0
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/index.d.ts +1 -0
- package/dist/pipeline/stages/routeLambda/components/DeploymentStrategyForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/RenderStrategy.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/SimpleDeploymentForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/VersionPicker.d.ts +14 -0
- package/dist/pipeline/stages/routeLambda/components/WeightedDeploymentForm.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/components/index.d.ts +1 -0
- package/dist/pipeline/stages/routeLambda/constants/index.d.ts +3 -0
- package/dist/pipeline/stages/routeLambda/constants/strategy.constants.d.ts +6 -0
- package/dist/pipeline/stages/routeLambda/constants/strategy.picker.d.ts +16 -0
- package/dist/pipeline/stages/routeLambda/constants/versions.constants.d.ts +6 -0
- package/dist/pipeline/stages/routeLambda/index.d.ts +1 -0
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStage.d.ts +3 -0
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageConfig.d.ts +5 -0
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageExecutionDetails.d.ts +6 -0
- package/dist/pipeline/stages/updateCodeLambda/components/UpdateCodeStageForm.d.ts +3 -0
- package/dist/pipeline/stages/updateCodeLambda/components/index.d.ts +1 -0
- package/dist/pipeline/stages/updateCodeLambda/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/aws.module.ts +6 -6
- package/src/aws.validators.ts +7 -3
- package/src/pipeline/stages/deleteLambda/DeleteLambdaFunctionStageForm.tsx +143 -0
- package/src/pipeline/stages/deleteLambda/LambdaDeleteStage.tsx +86 -0
- package/src/pipeline/stages/deleteLambda/constants/deleteVersion.constants.ts +37 -0
- package/src/pipeline/stages/deleteLambda/constants/deleteVersion.picker.tsx +47 -0
- package/src/pipeline/stages/deleteLambda/constants/index.ts +5 -0
- package/src/pipeline/stages/deleteLambda/index.ts +11 -0
- package/src/pipeline/stages/deployLambda/components/AwsLambdaFunctionStageForm.tsx +139 -0
- package/src/pipeline/stages/deployLambda/components/BasicSettingsForm.tsx +176 -0
- package/src/pipeline/stages/deployLambda/components/EnvironmentForm.tsx +24 -0
- package/src/pipeline/stages/deployLambda/components/ExecutionRoleForm.tsx +15 -0
- package/src/pipeline/stages/deployLambda/components/LambdaAtEdgeForm.tsx +28 -0
- package/src/pipeline/stages/deployLambda/components/NetworkForm.tsx +123 -0
- package/src/pipeline/stages/deployLambda/components/TriggerEventsForm.tsx +49 -0
- package/src/pipeline/stages/deployLambda/components/function.constants.ts +32 -0
- package/src/pipeline/stages/deployLambda/components/index.ts +8 -0
- package/src/pipeline/stages/deployLambda/config/LambdaDeploymentStage.tsx +20 -0
- package/src/pipeline/stages/deployLambda/config/LambdaDeploymentStageConfig.tsx +64 -0
- package/src/pipeline/stages/deployLambda/config/LambdaDeploymentStageExecutionDetails.tsx +31 -0
- package/src/pipeline/stages/deployLambda/config/UpsertDefaults.tsx +21 -0
- package/src/pipeline/stages/deployLambda/config/function.defaults.ts +39 -0
- package/src/pipeline/stages/deployLambda/index.ts +11 -0
- package/src/pipeline/stages/invokeLambda/InvokeLambdaFunctionStageForm.tsx +106 -0
- package/src/pipeline/stages/invokeLambda/LambdaInvokeStage.tsx +125 -0
- package/src/pipeline/stages/invokeLambda/components/InvokeLambdaOperation.tsx +77 -0
- package/src/pipeline/stages/invokeLambda/components/index.ts +4 -0
- package/src/pipeline/stages/invokeLambda/index.ts +11 -0
- package/src/pipeline/stages/routeLambda/LambdaRouteStage.tsx +98 -0
- package/src/pipeline/stages/routeLambda/RouteLambdaFunctionStageForm.tsx +151 -0
- package/src/pipeline/stages/routeLambda/TriggerEventsForm.tsx +51 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.tsx +27 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.tsx +21 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.tsx +93 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/health.constants.ts +14 -0
- package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/index.ts +4 -0
- package/src/pipeline/stages/routeLambda/components/DeploymentStrategyForm.tsx +18 -0
- package/src/pipeline/stages/routeLambda/components/RenderStrategy.tsx +23 -0
- package/src/pipeline/stages/routeLambda/components/SimpleDeploymentForm.tsx +67 -0
- package/src/pipeline/stages/routeLambda/components/VersionPicker.tsx +43 -0
- package/src/pipeline/stages/routeLambda/components/WeightedDeploymentForm.tsx +107 -0
- package/src/pipeline/stages/routeLambda/components/index.ts +4 -0
- package/src/pipeline/stages/routeLambda/constants/index.ts +6 -0
- package/src/pipeline/stages/routeLambda/constants/strategy.constants.tsx +26 -0
- package/src/pipeline/stages/routeLambda/constants/strategy.picker.tsx +47 -0
- package/src/pipeline/stages/routeLambda/constants/versions.constants.ts +31 -0
- package/src/pipeline/stages/routeLambda/index.ts +11 -0
- package/src/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStage.tsx +20 -0
- package/src/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageConfig.tsx +41 -0
- package/src/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageExecutionDetails.tsx +31 -0
- package/src/pipeline/stages/updateCodeLambda/components/UpdateCodeStageForm.tsx +122 -0
- package/src/pipeline/stages/updateCodeLambda/components/index.ts +4 -0
- package/src/pipeline/stages/updateCodeLambda/index.ts +11 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
IAccount,
|
|
7
|
+
IAccountDetails,
|
|
8
|
+
IFormikStageConfigInjectedProps,
|
|
9
|
+
IFormInputProps,
|
|
10
|
+
IFunction,
|
|
11
|
+
IRegion,
|
|
12
|
+
} from '@spinnaker/core';
|
|
13
|
+
import {
|
|
14
|
+
AccountService,
|
|
15
|
+
FormikFormField,
|
|
16
|
+
HelpField,
|
|
17
|
+
NumberInput,
|
|
18
|
+
ReactSelectInput,
|
|
19
|
+
TextInput,
|
|
20
|
+
useData,
|
|
21
|
+
} from '@spinnaker/core';
|
|
22
|
+
import { NumberConcurrencyInput } from '@spinnaker/core/dist/presentation/forms/inputs/NumberConcurrencyInput';
|
|
23
|
+
|
|
24
|
+
import { TriggerEventsForm } from './TriggerEventsForm';
|
|
25
|
+
import { DeploymentStrategyForm } from './components';
|
|
26
|
+
import { DeploymentStrategyList, DeploymentStrategyPicker } from './constants';
|
|
27
|
+
|
|
28
|
+
export function RouteLambdaFunctionStageForm(props: IFormikStageConfigInjectedProps) {
|
|
29
|
+
const { values } = props.formik;
|
|
30
|
+
const { functions } = props.application;
|
|
31
|
+
|
|
32
|
+
const { result: fetchAccountsResult, status: fetchAccountsStatus } = useData(
|
|
33
|
+
() => AccountService.listAccounts('aws'),
|
|
34
|
+
[],
|
|
35
|
+
[],
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const onAccountChange = (fieldValue: any): void => {
|
|
39
|
+
props.formik.setFieldValue('region', null);
|
|
40
|
+
props.formik.setFieldValue('functionName', null);
|
|
41
|
+
|
|
42
|
+
props.formik.setFieldValue('account', fieldValue);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const onRegionChange = (fieldValue: any): void => {
|
|
46
|
+
props.formik.setFieldValue('functionName', null);
|
|
47
|
+
props.formik.setFieldValue('region', fieldValue);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const availableFunctions =
|
|
51
|
+
values.account && values.region
|
|
52
|
+
? functions.data
|
|
53
|
+
.filter((f: IFunction) => f.account === values.account)
|
|
54
|
+
.filter((f: IFunction) => f.region === values.region)
|
|
55
|
+
.map((f: IFunction) => f.functionName)
|
|
56
|
+
: [];
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className="form-horizontal">
|
|
60
|
+
<h4> Basic Settings </h4>
|
|
61
|
+
<FormikFormField
|
|
62
|
+
label="Account"
|
|
63
|
+
name="account"
|
|
64
|
+
onChange={onAccountChange}
|
|
65
|
+
required={true}
|
|
66
|
+
input={(inputProps: IFormInputProps) => (
|
|
67
|
+
<ReactSelectInput
|
|
68
|
+
{...inputProps}
|
|
69
|
+
clearable={false}
|
|
70
|
+
isLoading={fetchAccountsStatus === 'PENDING'}
|
|
71
|
+
stringOptions={fetchAccountsResult.map((acc: IAccount) => acc.name)}
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
/>
|
|
75
|
+
<FormikFormField
|
|
76
|
+
label="Region"
|
|
77
|
+
name="region"
|
|
78
|
+
onChange={onRegionChange}
|
|
79
|
+
input={(inputProps: IFormInputProps) => (
|
|
80
|
+
<ReactSelectInput
|
|
81
|
+
clearable={false}
|
|
82
|
+
disabled={!values.account}
|
|
83
|
+
placeholder={values.account ? 'Select...' : 'Select an Account...'}
|
|
84
|
+
{...inputProps}
|
|
85
|
+
isLoading={fetchAccountsStatus === 'PENDING'}
|
|
86
|
+
stringOptions={fetchAccountsResult
|
|
87
|
+
.filter((acc: IAccountDetails) => acc.name === values.account)
|
|
88
|
+
.flatMap((acc: IAccountDetails) => acc.regions)
|
|
89
|
+
.map((reg: IRegion) => reg.name)}
|
|
90
|
+
/>
|
|
91
|
+
)}
|
|
92
|
+
/>
|
|
93
|
+
<FormikFormField
|
|
94
|
+
label="Function Name"
|
|
95
|
+
name="functionName"
|
|
96
|
+
input={(inputProps: IFormInputProps) => (
|
|
97
|
+
<ReactSelectInput
|
|
98
|
+
clearable={false}
|
|
99
|
+
disabled={!(values.account && values.region)}
|
|
100
|
+
placeholder={values.account && values.region ? 'Select...' : 'Select an Account and Region...'}
|
|
101
|
+
{...inputProps}
|
|
102
|
+
stringOptions={availableFunctions}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
/>
|
|
106
|
+
|
|
107
|
+
<FormikFormField
|
|
108
|
+
label="Alias"
|
|
109
|
+
name="aliasName"
|
|
110
|
+
input={(inputProps: IFormInputProps) => <TextInput {...inputProps} />}
|
|
111
|
+
/>
|
|
112
|
+
|
|
113
|
+
<h4> Alias Settings </h4>
|
|
114
|
+
<TriggerEventsForm {...props} />
|
|
115
|
+
|
|
116
|
+
<FormikFormField
|
|
117
|
+
name="provisionedConcurrentExecutions"
|
|
118
|
+
label="Provisioned Concurrency"
|
|
119
|
+
help={
|
|
120
|
+
<HelpField content="To enable your function to scale without fluctuations in latency, use provisioned concurrency. Provisioned concurrency runs continually and has separate pricing for concurrency and execution duration. Concurrency cannot be provisioned with a weighted deployment strategy." />
|
|
121
|
+
}
|
|
122
|
+
input={(props) =>
|
|
123
|
+
values.deploymentStrategy === '$WEIGHTED' ? (
|
|
124
|
+
<NumberInput {...props} min={0} max={0} />
|
|
125
|
+
) : (
|
|
126
|
+
<NumberConcurrencyInput {...props} min={0} max={3000} />
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
required={false}
|
|
130
|
+
/>
|
|
131
|
+
|
|
132
|
+
<h4> Deployment Strategy </h4>
|
|
133
|
+
<FormikFormField
|
|
134
|
+
label="Strategy"
|
|
135
|
+
name="deploymentStrategy"
|
|
136
|
+
help={<HelpField content="" />}
|
|
137
|
+
input={(inputProps: IFormInputProps) => (
|
|
138
|
+
<ReactSelectInput
|
|
139
|
+
{...inputProps}
|
|
140
|
+
clearable={false}
|
|
141
|
+
options={DeploymentStrategyList}
|
|
142
|
+
optionRenderer={(option) => (
|
|
143
|
+
<DeploymentStrategyPicker config={props} value={option.value as any} showingDetails={true} />
|
|
144
|
+
)}
|
|
145
|
+
/>
|
|
146
|
+
)}
|
|
147
|
+
/>
|
|
148
|
+
{values.deploymentStrategy ? <DeploymentStrategyForm {...props} /> : null}
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import type { Option } from 'react-select';
|
|
7
|
+
|
|
8
|
+
import type { IFormikStageConfigInjectedProps, IFormInputProps } from '@spinnaker/core';
|
|
9
|
+
import { FormikFormField, HelpField, NumberInput, TetheredCreatable } from '@spinnaker/core';
|
|
10
|
+
|
|
11
|
+
export function TriggerEventsForm(props: IFormikStageConfigInjectedProps) {
|
|
12
|
+
const { values } = props.formik;
|
|
13
|
+
|
|
14
|
+
const onChange = (o: Option, field: any) => {
|
|
15
|
+
props.formik.setFieldValue(
|
|
16
|
+
field,
|
|
17
|
+
o.map((arn: any) => arn.value),
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div>
|
|
23
|
+
<FormikFormField
|
|
24
|
+
name="triggerArns"
|
|
25
|
+
label="Event ARNs"
|
|
26
|
+
help={
|
|
27
|
+
<HelpField content="The resource ARNs for Lambda event trigger sources. Input the entire ARN and select `Create option TRIGGER-ARN-INPUT` to add the ARN." />
|
|
28
|
+
}
|
|
29
|
+
input={(inputProps: IFormInputProps) => (
|
|
30
|
+
<TetheredCreatable
|
|
31
|
+
{...inputProps}
|
|
32
|
+
multi={true}
|
|
33
|
+
placeholder={'Input ARN...'}
|
|
34
|
+
onChange={(e: Option) => {
|
|
35
|
+
onChange(e, 'triggerArns');
|
|
36
|
+
}}
|
|
37
|
+
value={values.triggerArns ? values.triggerArns.map((arn: string) => ({ value: arn, label: arn })) : []}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
required={false}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
<FormikFormField
|
|
44
|
+
name="batchsize"
|
|
45
|
+
label="Event Batch Size"
|
|
46
|
+
input={(inputProps: IFormInputProps) => <NumberInput {...inputProps} min={1} max={10} />}
|
|
47
|
+
required={false}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.tsx
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import type { IFormikStageConfigInjectedProps, IFormInputProps } from '@spinnaker/core';
|
|
7
|
+
import { FormikFormField, ReactSelectInput } from '@spinnaker/core';
|
|
8
|
+
|
|
9
|
+
import { retrieveHealthCheck } from './HealthCheckStrategy';
|
|
10
|
+
import { HealthCheckList } from './health.constants';
|
|
11
|
+
|
|
12
|
+
export function BlueGreenDeploymentForm(props: IFormikStageConfigInjectedProps) {
|
|
13
|
+
const { values } = props.formik;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div>
|
|
17
|
+
<FormikFormField
|
|
18
|
+
label="Health Check Type"
|
|
19
|
+
name="healthCheckType"
|
|
20
|
+
input={(inputProps: IFormInputProps) => (
|
|
21
|
+
<ReactSelectInput {...inputProps} clearable={false} options={HealthCheckList} />
|
|
22
|
+
)}
|
|
23
|
+
/>
|
|
24
|
+
{values.healthCheckType ? retrieveHealthCheck(values.healthCheckType, props) : null}
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import type { IFormikStageConfigInjectedProps } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
import { InvokeLambdaHealthCheck } from './InvocationHealthCheck';
|
|
9
|
+
|
|
10
|
+
export function retrieveHealthCheck(value: string, props: IFormikStageConfigInjectedProps) {
|
|
11
|
+
switch (value) {
|
|
12
|
+
case '$LAMBDA':
|
|
13
|
+
return <InvokeLambdaHealthCheck {...props} />;
|
|
14
|
+
case '$WEIGHTED':
|
|
15
|
+
return null;
|
|
16
|
+
case '$BLUEGREEN':
|
|
17
|
+
return null;
|
|
18
|
+
default:
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.tsx
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import type { IArtifact, IExpectedArtifact, IFormikStageConfigInjectedProps } from '@spinnaker/core';
|
|
7
|
+
import {
|
|
8
|
+
ArtifactTypePatterns,
|
|
9
|
+
CheckboxInput,
|
|
10
|
+
excludeAllTypesExcept,
|
|
11
|
+
FormikFormField,
|
|
12
|
+
NumberInput,
|
|
13
|
+
StageArtifactSelectorDelegate,
|
|
14
|
+
} from '@spinnaker/core';
|
|
15
|
+
|
|
16
|
+
export function InvokeLambdaHealthCheck(props: IFormikStageConfigInjectedProps) {
|
|
17
|
+
const { values } = props.formik;
|
|
18
|
+
|
|
19
|
+
const excludedArtifactTypes = excludeAllTypesExcept(
|
|
20
|
+
ArtifactTypePatterns.BITBUCKET_FILE,
|
|
21
|
+
ArtifactTypePatterns.CUSTOM_OBJECT,
|
|
22
|
+
ArtifactTypePatterns.EMBEDDED_BASE64,
|
|
23
|
+
ArtifactTypePatterns.GCS_OBJECT,
|
|
24
|
+
ArtifactTypePatterns.GITHUB_FILE,
|
|
25
|
+
ArtifactTypePatterns.GITLAB_FILE,
|
|
26
|
+
ArtifactTypePatterns.S3_OBJECT,
|
|
27
|
+
ArtifactTypePatterns.HTTP_FILE,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const onTemplateArtifactEdited = (artifact: IArtifact, name: string) => {
|
|
31
|
+
props.formik.setFieldValue(`${name}.id`, null);
|
|
32
|
+
props.formik.setFieldValue(`${name}.artifact`, artifact);
|
|
33
|
+
props.formik.setFieldValue(`${name}.account`, artifact.artifactAccount);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const onTemplateArtifactSelected = (id: string, name: string) => {
|
|
37
|
+
props.formik.setFieldValue(`${name}.id`, id);
|
|
38
|
+
props.formik.setFieldValue(`${name}.artifact`, null);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const getInputArtifact = (stage: any, name: string) => {
|
|
42
|
+
if (!stage[name]) {
|
|
43
|
+
return {
|
|
44
|
+
account: '',
|
|
45
|
+
id: '',
|
|
46
|
+
};
|
|
47
|
+
} else {
|
|
48
|
+
return stage[name];
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div>
|
|
54
|
+
<FormikFormField
|
|
55
|
+
name="destroyOnFail"
|
|
56
|
+
label="On Fail"
|
|
57
|
+
input={(props) => <CheckboxInput text={'Destroy latest lambda version on fail.'} {...props} />}
|
|
58
|
+
/>
|
|
59
|
+
<FormikFormField name="timeout" label="Timeout" input={(props) => <NumberInput {...props} min={0} max={900} />} />
|
|
60
|
+
|
|
61
|
+
<StageArtifactSelectorDelegate
|
|
62
|
+
artifact={getInputArtifact(values, 'payloadArtifact').artifact}
|
|
63
|
+
excludedArtifactTypePatterns={excludedArtifactTypes}
|
|
64
|
+
expectedArtifactId={getInputArtifact(values, 'payloadArtifact').id}
|
|
65
|
+
label="Payload Artifact"
|
|
66
|
+
onArtifactEdited={(artifact) => {
|
|
67
|
+
onTemplateArtifactEdited(artifact, 'payloadArtifact');
|
|
68
|
+
}}
|
|
69
|
+
helpKey={''}
|
|
70
|
+
onExpectedArtifactSelected={(artifact: IExpectedArtifact) =>
|
|
71
|
+
onTemplateArtifactSelected(artifact.id, 'payloadrtifact')
|
|
72
|
+
}
|
|
73
|
+
pipeline={props.pipeline}
|
|
74
|
+
stage={values}
|
|
75
|
+
/>
|
|
76
|
+
<StageArtifactSelectorDelegate
|
|
77
|
+
artifact={getInputArtifact(values, 'outputArtifact').artifact}
|
|
78
|
+
excludedArtifactTypePatterns={excludedArtifactTypes}
|
|
79
|
+
expectedArtifactId={getInputArtifact(values, 'outputArtifact').id}
|
|
80
|
+
label="Output Artifact"
|
|
81
|
+
onArtifactEdited={(artifact) => {
|
|
82
|
+
onTemplateArtifactEdited(artifact, 'outputArtifact');
|
|
83
|
+
}}
|
|
84
|
+
helpKey={''}
|
|
85
|
+
onExpectedArtifactSelected={(artifact: IExpectedArtifact) =>
|
|
86
|
+
onTemplateArtifactSelected(artifact.id, 'outputArtifact')
|
|
87
|
+
}
|
|
88
|
+
pipeline={props.pipeline}
|
|
89
|
+
stage={values}
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export interface IHealthConstant {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const HealthCheckList: IHealthConstant[] = [
|
|
10
|
+
{
|
|
11
|
+
label: 'Lambda Invocation',
|
|
12
|
+
value: '$LAMBDA',
|
|
13
|
+
},
|
|
14
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import type { IFormikStageConfigInjectedProps } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
import { retrieveComponent } from './RenderStrategy';
|
|
9
|
+
|
|
10
|
+
export function DeploymentStrategyForm(props: IFormikStageConfigInjectedProps) {
|
|
11
|
+
const { values } = props.formik;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className="form-horizontal">
|
|
15
|
+
{values.deploymentStrategy ? retrieveComponent(values.deploymentStrategy, props) : null}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import type { IFormikStageConfigInjectedProps } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
import { BlueGreenDeploymentForm } from './BlueGreenDeployment';
|
|
9
|
+
import { SimpleDeploymentForm } from './SimpleDeploymentForm';
|
|
10
|
+
import { WeightedDeploymentForm } from './WeightedDeploymentForm';
|
|
11
|
+
|
|
12
|
+
export function retrieveComponent(value: string, props: IFormikStageConfigInjectedProps) {
|
|
13
|
+
switch (value) {
|
|
14
|
+
case '$SIMPLE':
|
|
15
|
+
return <SimpleDeploymentForm {...props} />;
|
|
16
|
+
case '$WEIGHTED':
|
|
17
|
+
return <WeightedDeploymentForm {...props} />;
|
|
18
|
+
case '$BLUEGREEN':
|
|
19
|
+
return <BlueGreenDeploymentForm {...props} />;
|
|
20
|
+
default:
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import type { IFormikStageConfigInjectedProps, IFormInputProps } from '@spinnaker/core';
|
|
7
|
+
import { FormikFormField, NumberInput, ReactSelectInput } from '@spinnaker/core';
|
|
8
|
+
|
|
9
|
+
import { VersionPicker } from './VersionPicker';
|
|
10
|
+
import { VersionList } from '../constants';
|
|
11
|
+
import type { IAmazonFunctionSourceData } from '../../../../domain';
|
|
12
|
+
|
|
13
|
+
export function SimpleDeploymentForm(props: IFormikStageConfigInjectedProps) {
|
|
14
|
+
const { values } = props.formik;
|
|
15
|
+
const { functions } = props.application;
|
|
16
|
+
|
|
17
|
+
const onVersionChange = (fieldValue: any): void => {
|
|
18
|
+
props.formik.setFieldValue('trafficPercentA', 100);
|
|
19
|
+
props.formik.setFieldValue('versionNameA', fieldValue);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="form-horizontal">
|
|
24
|
+
<FormikFormField
|
|
25
|
+
label="Target Version"
|
|
26
|
+
name="versionNameA"
|
|
27
|
+
onChange={onVersionChange}
|
|
28
|
+
input={(inputProps: IFormInputProps) => (
|
|
29
|
+
<ReactSelectInput
|
|
30
|
+
{...inputProps}
|
|
31
|
+
clearable={false}
|
|
32
|
+
options={VersionList}
|
|
33
|
+
optionRenderer={(option) => <VersionPicker value={option.value as any} showingDetails={true} />}
|
|
34
|
+
/>
|
|
35
|
+
)}
|
|
36
|
+
/>
|
|
37
|
+
{values.versionNameA === '$PROVIDED' ? (
|
|
38
|
+
<FormikFormField
|
|
39
|
+
label="Version Number"
|
|
40
|
+
name="versionNumberA"
|
|
41
|
+
input={(inputProps: IFormInputProps) => (
|
|
42
|
+
<ReactSelectInput
|
|
43
|
+
{...inputProps}
|
|
44
|
+
clearable={false}
|
|
45
|
+
stringOptions={functions.data
|
|
46
|
+
.filter((f: IAmazonFunctionSourceData) => f.account === values.account)
|
|
47
|
+
.filter((f: IAmazonFunctionSourceData) => f.region === values.region)
|
|
48
|
+
.filter((f: IAmazonFunctionSourceData) => f.functionName === values.functionName)
|
|
49
|
+
.flatMap((f: IAmazonFunctionSourceData) =>
|
|
50
|
+
Object.values(f.revisions).sort(function (a: number, b: number) {
|
|
51
|
+
return b - a;
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
54
|
+
.filter((r: any) => r !== '$LATEST')}
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
57
|
+
/>
|
|
58
|
+
) : null}
|
|
59
|
+
|
|
60
|
+
<FormikFormField
|
|
61
|
+
name="trafficPercentA"
|
|
62
|
+
label="Traffic %"
|
|
63
|
+
input={(props) => <NumberInput {...props} min={0} max={100} value={100} disabled={true} />}
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import type { IVersionConstant } from '../constants';
|
|
7
|
+
import { VersionList } from '../constants';
|
|
8
|
+
|
|
9
|
+
export interface IVersionPickerProps {
|
|
10
|
+
value: string;
|
|
11
|
+
showingDetails: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IVersionPickerState {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
description: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class VersionPicker extends React.Component<IVersionPickerProps, IVersionPickerState> {
|
|
21
|
+
constructor(props: IVersionPickerProps) {
|
|
22
|
+
super(props);
|
|
23
|
+
|
|
24
|
+
// In here we will link the 'value' to an actual version id - when this is passed to Orca it will have the ID
|
|
25
|
+
|
|
26
|
+
const { value } = this.props;
|
|
27
|
+
const versionDetails = VersionList.filter((v: IVersionConstant) => v.value === value)[0];
|
|
28
|
+
this.state = {
|
|
29
|
+
label: versionDetails.label,
|
|
30
|
+
value: versionDetails.value,
|
|
31
|
+
description: versionDetails.description,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public render() {
|
|
36
|
+
return (
|
|
37
|
+
<div>
|
|
38
|
+
<b> {this.state.label} </b> <br />
|
|
39
|
+
<small> {this.state.description} </small>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import type { IFormikStageConfigInjectedProps, IFormInputProps } from '@spinnaker/core';
|
|
6
|
+
import { FormikFormField, NumberInput, ReactSelectInput } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
import { VersionPicker } from './VersionPicker';
|
|
9
|
+
import { VersionList } from '../constants';
|
|
10
|
+
import type { IAmazonFunctionSourceData } from '../../../../domain';
|
|
11
|
+
|
|
12
|
+
export function WeightedDeploymentForm(props: IFormikStageConfigInjectedProps) {
|
|
13
|
+
const { values } = props.formik;
|
|
14
|
+
const { functions } = props.application;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className="form-horizontal">
|
|
18
|
+
<FormikFormField
|
|
19
|
+
label="Target Version"
|
|
20
|
+
name="versionNameA"
|
|
21
|
+
input={(inputProps: IFormInputProps) => (
|
|
22
|
+
<ReactSelectInput
|
|
23
|
+
{...inputProps}
|
|
24
|
+
clearable={false}
|
|
25
|
+
options={VersionList}
|
|
26
|
+
optionRenderer={(option) => <VersionPicker value={option.value as any} showingDetails={true} />}
|
|
27
|
+
/>
|
|
28
|
+
)}
|
|
29
|
+
/>
|
|
30
|
+
{values.versionNameA === '$PROVIDED' ? (
|
|
31
|
+
<FormikFormField
|
|
32
|
+
label="Version Number"
|
|
33
|
+
name="versionNumberA"
|
|
34
|
+
input={(inputProps: IFormInputProps) => (
|
|
35
|
+
<ReactSelectInput
|
|
36
|
+
{...inputProps}
|
|
37
|
+
clearable={false}
|
|
38
|
+
stringOptions={functions.data
|
|
39
|
+
.filter((f: IAmazonFunctionSourceData) => f.account === values.account)
|
|
40
|
+
.filter((f: IAmazonFunctionSourceData) => f.region === values.region)
|
|
41
|
+
.filter((f: IAmazonFunctionSourceData) => f.functionName === values.functionName)
|
|
42
|
+
.flatMap((f: IAmazonFunctionSourceData) =>
|
|
43
|
+
Object.values(f.revisions).sort(function (a: number, b: number) {
|
|
44
|
+
return b - a;
|
|
45
|
+
}),
|
|
46
|
+
)
|
|
47
|
+
.filter((r: any) => r !== '$LATEST')}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
50
|
+
/>
|
|
51
|
+
) : null}
|
|
52
|
+
<FormikFormField
|
|
53
|
+
name="trafficPercentA"
|
|
54
|
+
label="Traffic %"
|
|
55
|
+
input={(props) => <NumberInput {...props} min={0} max={100} />}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
<FormikFormField
|
|
59
|
+
label="Version Name"
|
|
60
|
+
name="versionNameB"
|
|
61
|
+
input={(inputProps: IFormInputProps) => (
|
|
62
|
+
<ReactSelectInput
|
|
63
|
+
{...inputProps}
|
|
64
|
+
clearable={false}
|
|
65
|
+
options={VersionList}
|
|
66
|
+
optionRenderer={(option) => <VersionPicker value={option.value as any} showingDetails={true} />}
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
69
|
+
/>
|
|
70
|
+
{values.versionNameB === '$PROVIDED' ? (
|
|
71
|
+
<FormikFormField
|
|
72
|
+
label="Version Number"
|
|
73
|
+
name="versionNumberB"
|
|
74
|
+
input={(inputProps: IFormInputProps) => (
|
|
75
|
+
<ReactSelectInput
|
|
76
|
+
{...inputProps}
|
|
77
|
+
clearable={false}
|
|
78
|
+
stringOptions={functions.data
|
|
79
|
+
.filter((f: IAmazonFunctionSourceData) => f.account === values.account)
|
|
80
|
+
.filter((f: IAmazonFunctionSourceData) => f.region === values.region)
|
|
81
|
+
.filter((f: IAmazonFunctionSourceData) => f.functionName === values.functionName)
|
|
82
|
+
.flatMap((f: IAmazonFunctionSourceData) =>
|
|
83
|
+
Object.values(f.revisions).sort(function (a: number, b: number) {
|
|
84
|
+
return b - a;
|
|
85
|
+
}),
|
|
86
|
+
)
|
|
87
|
+
.filter((r: any) => r !== '$LATEST')}
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
/>
|
|
91
|
+
) : null}
|
|
92
|
+
<FormikFormField
|
|
93
|
+
name="trafficPercentB"
|
|
94
|
+
label="Traffic %"
|
|
95
|
+
input={(props) => (
|
|
96
|
+
<NumberInput
|
|
97
|
+
{...props}
|
|
98
|
+
min={0}
|
|
99
|
+
max={100}
|
|
100
|
+
disabled={true}
|
|
101
|
+
value={values.trafficPercentA || values.trafficPercentA === 0 ? 100 - values.trafficPercentA : null}
|
|
102
|
+
/>
|
|
103
|
+
)}
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export interface IStrategyConstant {
|
|
5
|
+
description: string;
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const DeploymentStrategyList: IStrategyConstant[] = [
|
|
11
|
+
{
|
|
12
|
+
label: 'Simple',
|
|
13
|
+
value: '$SIMPLE',
|
|
14
|
+
description: 'Route 100% of traffic to specified version',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: 'Weighted Deployment',
|
|
18
|
+
value: '$WEIGHTED',
|
|
19
|
+
description: 'Split the traffic weight between two function versions.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: 'Blue/Green',
|
|
23
|
+
value: '$BLUEGREEN',
|
|
24
|
+
description: 'Disable all previous versions once the latest version passes health checks.',
|
|
25
|
+
},
|
|
26
|
+
];
|