@@ -48,7 +48,7 @@ import {
48
48
import { ApiResourceType } from '../Pages'
49
49
import { API_TOKEN_PREFIX } from '@Shared/constants'
50
50
import { DefaultUserKey } from '@Shared/types'
51
- import { RefVariableType } from './CIPipeline.Types'
51
+ import { RefVariableType , VariableTypeFormat } from './CIPipeline.Types'
52
52
53
53
export const getTeamListMin = ( ) : Promise < TeamList > => {
54
54
// ignore active field
@@ -225,7 +225,7 @@ const cdMaterialListModal = ({
225
225
deploymentWindowArtifactMetadata : material . deploymentWindowArtifactMetadata ?? null ,
226
226
configuredInReleases : material . configuredInReleases ?? [ ] ,
227
227
appWorkflowId : material . appWorkflowId ?? null ,
228
- deploymentBlockedState : sanitizeDeploymentBlockedState ( material . deploymentBlockedState )
228
+ deploymentBlockedState : sanitizeDeploymentBlockedState ( material . deploymentBlockedState ) ,
229
229
}
230
230
} )
231
231
return materials
@@ -338,8 +338,37 @@ const processCDMaterialsApprovalInfo = (enableApproval: boolean, cdMaterialsResu
338
338
}
339
339
}
340
340
341
- export const parseRuntimeParams = ( response : RuntimeParamsAPIResponseType ) : RuntimePluginVariables [ ] =>
342
- ( response ?. runtimePluginVariables ?? [ ] ) . map ( ( variable ) => ( { ...variable , defaultValue : variable . value } ) )
341
+ export const parseRuntimeParams = ( response : RuntimeParamsAPIResponseType ) : RuntimePluginVariables [ ] => {
342
+ const envVariables = Object . entries ( response ?. envVariables || { } ) . map < RuntimePluginVariables > (
343
+ ( [ key , value ] ) => ( {
344
+ name : key ,
345
+ value,
346
+ defaultValue : '' ,
347
+ format : VariableTypeFormat . STRING ,
348
+ isRequired : false ,
349
+ valueType : RefVariableType . NEW ,
350
+ variableStepScope : RefVariableType . GLOBAL ,
351
+ stepName : null ,
352
+ stepType : null ,
353
+ // TODO: (Rohit/Eshank) Replace this with getUniqueId (nanoId method)
354
+ stepVariableId : Math . floor ( new Date ( ) . valueOf ( ) * Math . random ( ) ) ,
355
+ valueConstraint : null ,
356
+ description : null ,
357
+ fileReferenceId : null ,
358
+ fileMountDir : null ,
359
+ } ) ,
360
+ )
361
+
362
+ const runtimeParams = ( response ?. runtimePluginVariables ?? [ ] ) . map < RuntimePluginVariables > ( ( variable ) => ( {
363
+ ...variable ,
364
+ defaultValue : variable . value ,
365
+ } ) )
366
+
367
+ runtimeParams . push ( ...envVariables )
368
+ runtimeParams . sort ( ( a , b ) => stringComparatorBySortOrder ( a . name , b . name ) )
369
+
370
+ return runtimeParams
371
+ }
343
372
344
373
const processCDMaterialsMetaInfo = ( cdMaterialsResult ) : CDMaterialsMetaInfo => {
345
374
if ( ! cdMaterialsResult ) {
0 commit comments