Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions pkg/pipeline/PipelineStageService.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ func (impl *PipelineStageServiceImpl) BuildCiStageDataDeepCopy(ciStage *reposito
var stepsDto []*bean.PipelineStageStepDto
for _, step := range steps {
stepDto := &bean.PipelineStageStepDto{
Name: step.Name,
Index: step.Index,
Description: step.Description,
OutputDirectoryPath: step.OutputDirectoryPath,
StepType: step.StepType,
Name: step.Name,
Index: step.Index,
Description: step.Description,
OutputDirectoryPath: step.OutputDirectoryPath,
StepType: step.StepType,
TriggerIfParentStageFail: step.TriggerIfParentStageFail,
}
if step.StepType == repository.PIPELINE_STEP_TYPE_INLINE {
inlineStepDetail, err := impl.BuildInlineStepDataDeepCopy(step)
Expand Down Expand Up @@ -239,12 +240,6 @@ func (impl *PipelineStageServiceImpl) BuildVariableAndConditionDataByStepIdDeepC
return inputVariablesDto, outputVariablesDto, conditionsDto, nil
}







//GetCiPipelineStageData and related methods starts
func (impl *PipelineStageServiceImpl) GetCiPipelineStageData(ciPipelineId int) (*bean.PipelineStageDto, *bean.PipelineStageDto, error) {

Expand Down Expand Up @@ -292,12 +287,13 @@ func (impl *PipelineStageServiceImpl) BuildCiStageData(ciStage *repository.Pipel
var stepsDto []*bean.PipelineStageStepDto
for _, step := range steps {
stepDto := &bean.PipelineStageStepDto{
Id: step.Id,
Name: step.Name,
Index: step.Index,
Description: step.Description,
OutputDirectoryPath: step.OutputDirectoryPath,
StepType: step.StepType,
Id: step.Id,
Name: step.Name,
Index: step.Index,
Description: step.Description,
OutputDirectoryPath: step.OutputDirectoryPath,
StepType: step.StepType,
TriggerIfParentStageFail: step.TriggerIfParentStageFail,
}
if step.StepType == repository.PIPELINE_STEP_TYPE_INLINE {
inlineStepDetail, err := impl.BuildInlineStepData(step)
Expand Down Expand Up @@ -528,6 +524,7 @@ func (impl *PipelineStageServiceImpl) CreateStageSteps(steps []*bean.PipelineSta
UpdatedOn: time.Now(),
UpdatedBy: userId,
},
TriggerIfParentStageFail: step.TriggerIfParentStageFail,
}
inlineStep, err = impl.pipelineStageRepository.CreatePipelineStageStep(inlineStep)
if err != nil {
Expand Down Expand Up @@ -556,6 +553,7 @@ func (impl *PipelineStageServiceImpl) CreateStageSteps(steps []*bean.PipelineSta
UpdatedOn: time.Now(),
UpdatedBy: userId,
},
TriggerIfParentStageFail: step.TriggerIfParentStageFail,
}
refPluginStep, err := impl.pipelineStageRepository.CreatePipelineStageStep(refPluginStep)
if err != nil {
Expand Down Expand Up @@ -947,6 +945,7 @@ func (impl *PipelineStageServiceImpl) UpdateStageSteps(steps []*bean.PipelineSta
UpdatedOn: time.Now(),
UpdatedBy: userId,
},
TriggerIfParentStageFail: step.TriggerIfParentStageFail,
}
var inputVariables []*bean.StepVariableDto
var outputVariables []*bean.StepVariableDto
Expand Down Expand Up @@ -1552,10 +1551,11 @@ func (impl *PipelineStageServiceImpl) GetRefPluginStepsByIds(refPluginIds []int,

func (impl *PipelineStageServiceImpl) BuildCiStepDataForWfRequest(step *repository.PipelineStageStep) (*bean.StepObject, error) {
stepData := &bean.StepObject{
Name: step.Name,
Index: step.Index,
StepType: string(step.StepType),
ArtifactPaths: step.OutputDirectoryPath,
Name: step.Name,
Index: step.Index,
StepType: string(step.StepType),
ArtifactPaths: step.OutputDirectoryPath,
TriggerIfParentStageFail: step.TriggerIfParentStageFail,
}
if step.StepType == repository.PIPELINE_STEP_TYPE_INLINE {
//get script and mapping data
Expand Down
17 changes: 9 additions & 8 deletions pkg/pipeline/bean/pipelineStage.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ type PipelineStageDto struct {
}

type PipelineStageStepDto struct {
Id int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Index int `json:"index"`
StepType repository.PipelineStepType `json:"stepType" validate:"omitempty,oneof=INLINE REF_PLUGIN"`
OutputDirectoryPath []string `json:"outputDirectoryPath"`
InlineStepDetail *InlineStepDetailDto `json:"inlineStepDetail"`
RefPluginStepDetail *RefPluginStepDetailDto `json:"pluginRefStepDetail"`
Id int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Index int `json:"index"`
StepType repository.PipelineStepType `json:"stepType" validate:"omitempty,oneof=INLINE REF_PLUGIN"`
OutputDirectoryPath []string `json:"outputDirectoryPath"`
InlineStepDetail *InlineStepDetailDto `json:"inlineStepDetail"`
RefPluginStepDetail *RefPluginStepDetailDto `json:"pluginRefStepDetail"`
TriggerIfParentStageFail bool `json:"triggerIfParentStageFail"`
}

type InlineStepDetailDto struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/pipeline/bean/workFlowRequestBean.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type StepObject struct {
SourceCodeMount *MountPath `json:"sourceCodeMount"` // destination path - mountCodeToContainerPath
ExtraVolumeMounts []*MountPath `json:"extraVolumeMounts"` // filePathMapping
ArtifactPaths []string `json:"artifactPaths"`
TriggerIfParentStageFail bool `json:"triggerIfParentStageFail"`
}

type VariableObject struct {
Expand Down
25 changes: 13 additions & 12 deletions pkg/pipeline/repository/PipelineStageRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,19 @@ type PipelineStage struct {
}

type PipelineStageStep struct {
tableName struct{} `sql:"pipeline_stage_step" pg:",discard_unknown_columns"`
Id int `sql:"id,pk"`
PipelineStageId int `sql:"pipeline_stage_id"`
Name string `sql:"name"`
Description string `sql:"description"`
Index int `sql:"index"`
StepType PipelineStepType `sql:"step_type"`
ScriptId int `sql:"script_id"`
RefPluginId int `sql:"ref_plugin_id"` //id of plugin used as reference
OutputDirectoryPath []string `sql:"output_directory_path" pg:",array"`
DependentOnStep string `sql:"dependent_on_step"`
Deleted bool `sql:"deleted,notnull"`
tableName struct{} `sql:"pipeline_stage_step" pg:",discard_unknown_columns"`
Id int `sql:"id,pk"`
PipelineStageId int `sql:"pipeline_stage_id"`
Name string `sql:"name"`
Description string `sql:"description"`
Index int `sql:"index"`
StepType PipelineStepType `sql:"step_type"`
ScriptId int `sql:"script_id"`
RefPluginId int `sql:"ref_plugin_id"` //id of plugin used as reference
OutputDirectoryPath []string `sql:"output_directory_path" pg:",array"`
DependentOnStep string `sql:"dependent_on_step"`
Deleted bool `sql:"deleted,notnull"`
TriggerIfParentStageFail bool `sql:"trigger_if_parent_stage_fail"`
sql.AuditLog
}

Expand Down
2 changes: 2 additions & 0 deletions scripts/sql/120_trigger_post_ci_if_ci_fail.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---- drop trigger_if_parent_stage_fail column
ALTER TABLE pipeline_stage_step DROP COLUMN IF EXISTS trigger_if_parent_stage_fail;
2 changes: 2 additions & 0 deletions scripts/sql/120_trigger_post_ci_if_ci_fail.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---- add trigger_if_parent_stage_fail column
ALTER TABLE pipeline_stage_step ADD COLUMN IF NOT EXISTS trigger_if_parent_stage_fail bool;