diff --git a/pkg/pipeline/StageServiceUtil.go b/pkg/pipeline/StageServiceUtil.go index b8be02ad82..0a45a6f10f 100644 --- a/pkg/pipeline/StageServiceUtil.go +++ b/pkg/pipeline/StageServiceUtil.go @@ -28,7 +28,7 @@ type Task struct { RunStatus bool `json:"-,omitempty"` // task run was attempted or not } -var globalInputVariableList = []string{DOCKER_IMAGE, DEPLOYMENT_RELEASE_ID, DEPLOYMENT_UNIQUE_ID, CD_TRIGGER_TIME, CD_TRIGGERED_BY, CD_PIPELINE_ENV_NAME_KEY, CD_PIPELINE_CLUSTER_NAME_KEY, APP_NAME} +var globalInputVariableList = []string{DOCKER_IMAGE, DEPLOYMENT_RELEASE_ID, DEPLOYMENT_UNIQUE_ID, DEVTRON_CD_TRIGGER_TIME, DEVTRON_CD_TRIGGERED_BY, CD_PIPELINE_ENV_NAME_KEY, CD_PIPELINE_CLUSTER_NAME_KEY, APP_NAME} func ConvertStageYamlScriptsToPipelineStageSteps(cdPipeline *bean2.CDPipelineConfigObject) (*bean2.CDPipelineConfigObject, error) { if cdPipeline.PreDeployStage == nil && len(cdPipeline.PreStage.Config) > 0 { @@ -190,7 +190,7 @@ func constructGlobalInputVariablesUsedInScript(script string) []*bean.StepVariab stepVariable := &bean.StepVariableDto{ Id: 0, Name: inputVariable, - Format: "", + Format: repository2.PIPELINE_STAGE_STEP_VARIABLE_FORMAT_TYPE_STRING, Description: "", IsExposed: false, AllowEmptyValue: false, @@ -202,6 +202,12 @@ func constructGlobalInputVariablesUsedInScript(script string) []*bean.StepVariab VariableStepIndexInPlugin: 0, ReferenceVariableStage: "", } + if inputVariable == DEVTRON_CD_TRIGGER_TIME { + stepVariable.ReferenceVariableName = CD_TRIGGER_TIME + } + if inputVariable == DEVTRON_CD_TRIGGERED_BY { + stepVariable.ReferenceVariableName = CD_TRIGGERED_BY + } inputVariables = append(inputVariables, stepVariable) } } diff --git a/pkg/pipeline/WorkflowDagExecutor.go b/pkg/pipeline/WorkflowDagExecutor.go index c33d753a06..2369cfba1b 100644 --- a/pkg/pipeline/WorkflowDagExecutor.go +++ b/pkg/pipeline/WorkflowDagExecutor.go @@ -137,6 +137,8 @@ const ( CD_TRIGGERED_BY = "CD_TRIGGERED_BY" CD_TRIGGER_TIME = "CD_TRIGGER_TIME" APP_NAME = "APP_NAME" + DEVTRON_CD_TRIGGERED_BY = "DEVTRON_CD_TRIGGERED_BY" + DEVTRON_CD_TRIGGER_TIME = "DEVTRON_CD_TRIGGER_TIME" ) type CiArtifactDTO struct {