mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-05-15 10:36:08 +00:00
saveWorkflowsFromPipelineBuilder: check for pre-loaded workflows (#6474)
This commit is contained in:
@@ -210,9 +210,12 @@ func saveWorkflowsFromPipelineBuilder(store store.Store, pipeline *model.Pipelin
|
||||
}
|
||||
}
|
||||
|
||||
// the workflows in the pipeline should be empty as only we do populate them,
|
||||
// but if a pipeline was already loaded form database it might contain things, so we just clean it
|
||||
pipeline.Workflows = nil
|
||||
// The workflows in the pipeline should be empty, only we populate them.
|
||||
// But if a pipeline was already loaded from the database and contains workflows,
|
||||
// we error out to prevent harm.
|
||||
if pipeline.Workflows != nil {
|
||||
return nil, errors.New("cannot save new workflows from pipeline builder: pipeline already has workflows loaded")
|
||||
}
|
||||
|
||||
for _, item := range pipelineItems {
|
||||
workflow := &model.Workflow{
|
||||
|
||||
Reference in New Issue
Block a user