diff --git a/.vscode/launch.json b/.vscode/launch.json index 7cccf02203..81a6129130 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -42,6 +42,7 @@ "runtimeArgs": ["start"], "cwd": "${workspaceFolder}/web", "resolveSourceMapLocations": ["${workspaceFolder}/web/**", "!**/node_modules/**"], + "envFile": "${workspaceFolder}/.env", "skipFiles": ["/**"] } ] diff --git a/server/pipeline/approve.go b/server/pipeline/approve.go index 2755912913..6f38c2a2b5 100644 --- a/server/pipeline/approve.go +++ b/server/pipeline/approve.go @@ -20,7 +20,6 @@ import ( "github.com/rs/zerolog/log" - "go.woodpecker-ci.org/woodpecker/v2/pipeline/errors" forge_types "go.woodpecker-ci.org/woodpecker/v2/server/forge/types" "go.woodpecker-ci.org/woodpecker/v2/server/model" "go.woodpecker-ci.org/woodpecker/v2/server/store" @@ -51,12 +50,10 @@ func Approve(ctx context.Context, store store.Store, currentPipeline *model.Pipe } currentPipeline, pipelineItems, err := createPipelineItems(ctx, store, currentPipeline, user, repo, yamls, nil) - if errors.HasBlockingErrors(err) { + if err != nil { msg := fmt.Sprintf("failure to createPipelineItems for %s", repo.FullName) log.Error().Err(err).Msg(msg) - return nil, err - } else if err != nil { - currentPipeline.Errors = errors.GetPipelineErrors(err) + return nil, fmt.Errorf(msg) } currentPipeline, err = start(ctx, store, currentPipeline, user, repo, pipelineItems) diff --git a/server/pipeline/items.go b/server/pipeline/items.go index 02026c9303..a51a1ee7a6 100644 --- a/server/pipeline/items.go +++ b/server/pipeline/items.go @@ -91,7 +91,7 @@ func createPipelineItems(c context.Context, store store.Store, yamls []*forge_types.FileMeta, envs map[string]string, ) (*model.Pipeline, []*pipeline.Item, error) { pipelineItems, err := parsePipeline(store, currentPipeline, user, repo, yamls, envs) - if err != nil { + if pipeline_errors.HasBlockingErrors(err) { currentPipeline, uerr := UpdateToStatusError(store, *currentPipeline, err) if uerr != nil { log.Error().Err(uerr).Msgf("Error setting error status of pipeline for %s#%d", repo.FullName, currentPipeline.Number) @@ -99,9 +99,10 @@ func createPipelineItems(c context.Context, store store.Store, updatePipelineStatus(c, currentPipeline, repo, user) } - if pipeline_errors.HasBlockingErrors(err) { - return currentPipeline, nil, err - } + return currentPipeline, nil, err + } else if err != nil { + currentPipeline.Errors = pipeline_errors.GetPipelineErrors(err) + err = updatePipelinePending(c, store, currentPipeline, repo, user) } currentPipeline = setPipelineStepsOnPipeline(currentPipeline, pipelineItems)