1414 * limitations under the License.
1515 */
1616
17- import { PluginDataStoreType } from '../Shared'
17+ import { PipelineFormType } from '@Pages/Applications'
18+ import { PluginDataStoreType , PluginDetailPayloadType , ResourceKindType } from '../Shared'
1819import { VariableType } from './CIPipeline.Types'
1920import { ServerErrors } from './ServerError'
20- import { ResponseType } from './Types'
2121
2222export enum ApplyPolicyToStage {
2323 PRE_CI = 'PRE_CI' ,
2424 POST_CI = 'POST_CI' ,
25- PRE_CD = 'PRE_CD' ,
26- POST_CD = 'POST_CD' ,
2725 /**
2826 * @deprecated in mandatory plugin policy v2
2927 */
3028 PRE_OR_POST_CI = 'PRE_OR_POST_CI' ,
29+ PRE_CD = 'PRE_CD' ,
30+ POST_CD = 'POST_CD' ,
3131}
3232
33+ // FIXME: The name build is getting is used in CDPipeline.
34+ // This enum is mapping values from BuildStageVariable
3335export enum PluginRequiredStage {
34- PRE_CI = 'preBuildStage' ,
35- POST_CI = 'postBuildStage' ,
36- PRE_OR_POST_CI = 'PRE_OR_POST_CI' ,
36+ PRE_STAGE = 'preBuildStage' ,
37+ POST_STAGE = 'postBuildStage' ,
38+ PRE_OR_POST_STAGE = 'PRE_OR_POST_CI' ,
3739}
3840
3941export interface DefinitionSourceType {
40- projectName : string
41- isDueToProductionEnvironment : boolean
42- isDueToLinkedPipeline : boolean
43- policyName : string
44- appName ?: string
45- clusterName ?: string
46- environmentName ?: string
47- branchNames ?: string [ ]
48- ciPipelineName ?: string
42+ policyNames : string [ ]
43+ linkedCIPipelineNames ?: string [ ]
4944}
45+
5046export interface MandatoryPluginDetailType {
5147 id : number
5248 parentPluginId : number
@@ -57,7 +53,7 @@ export interface MandatoryPluginDetailType {
5753 applied ?: boolean
5854 inputVariables ?: VariableType [ ]
5955 outputVariables ?: VariableType [ ]
60- definitionSources ?: DefinitionSourceType [ ]
56+ definitionSources ?: DefinitionSourceType
6157}
6258export interface MandatoryPluginDataType {
6359 pluginData : MandatoryPluginDetailType [ ]
@@ -71,6 +67,37 @@ export interface ProcessPluginDataReturnType {
7167 mandatoryPluginsError ?: ServerErrors
7268}
7369
70+ export type ProcessPluginDataCIParamsType = {
71+ resourceKind : ResourceKindType . ciPipeline
72+ ciPipelineId : number
73+ /**
74+ * Comma separated branch names used for v1 api
75+ * For v2 format is [branchName1],[branchName2]
76+ */
77+ branchName ?: string
78+
79+ envName ?: never
80+ }
81+
82+ export type ProcessPluginDataCDParamsType = {
83+ resourceKind : ResourceKindType . cdPipeline
84+ envName ?: string
85+
86+ ciPipelineId ?: never
87+ branchName ?: never
88+ }
89+
90+ export type ProcessPluginDataParamsType = {
91+ formData : PipelineFormType
92+ pluginDataStoreState : PluginDataStoreType
93+ appId : number
94+ appName : string
95+ /**
96+ * Would be sent in case we have to get data for steps
97+ */
98+ requiredPluginIds ?: PluginDetailPayloadType [ 'pluginId' ]
99+ } & ( ProcessPluginDataCIParamsType | ProcessPluginDataCDParamsType )
100+
74101export enum ConsequenceAction {
75102 /**
76103 * This is used if the policy is enforced immediately.
@@ -104,7 +131,3 @@ export interface BlockedStateData {
104131 isCITriggerBlocked : boolean
105132 ciBlockState : ConsequenceType
106133}
107-
108- export interface GetBlockedStateResponse extends ResponseType {
109- result ?: BlockedStateData
110- }
0 commit comments