mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-04-26 13:34:45 +00:00
Allow to restart pipelines that has warnings (#2939)
This commit is contained in:
parent
6de5922408
commit
c6ce23e933
3 changed files with 8 additions and 9 deletions
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
|
@ -42,6 +42,7 @@
|
||||||
"runtimeArgs": ["start"],
|
"runtimeArgs": ["start"],
|
||||||
"cwd": "${workspaceFolder}/web",
|
"cwd": "${workspaceFolder}/web",
|
||||||
"resolveSourceMapLocations": ["${workspaceFolder}/web/**", "!**/node_modules/**"],
|
"resolveSourceMapLocations": ["${workspaceFolder}/web/**", "!**/node_modules/**"],
|
||||||
|
"envFile": "${workspaceFolder}/.env",
|
||||||
"skipFiles": ["<node_internals>/**"]
|
"skipFiles": ["<node_internals>/**"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -20,7 +20,6 @@ import (
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"go.woodpecker-ci.org/woodpecker/v2/pipeline/errors"
|
|
||||||
forge_types "go.woodpecker-ci.org/woodpecker/v2/server/forge/types"
|
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/model"
|
||||||
"go.woodpecker-ci.org/woodpecker/v2/server/store"
|
"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)
|
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)
|
msg := fmt.Sprintf("failure to createPipelineItems for %s", repo.FullName)
|
||||||
log.Error().Err(err).Msg(msg)
|
log.Error().Err(err).Msg(msg)
|
||||||
return nil, err
|
return nil, fmt.Errorf(msg)
|
||||||
} else if err != nil {
|
|
||||||
currentPipeline.Errors = errors.GetPipelineErrors(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPipeline, err = start(ctx, store, currentPipeline, user, repo, pipelineItems)
|
currentPipeline, err = start(ctx, store, currentPipeline, user, repo, pipelineItems)
|
||||||
|
|
|
@ -91,7 +91,7 @@ func createPipelineItems(c context.Context, store store.Store,
|
||||||
yamls []*forge_types.FileMeta, envs map[string]string,
|
yamls []*forge_types.FileMeta, envs map[string]string,
|
||||||
) (*model.Pipeline, []*pipeline.Item, error) {
|
) (*model.Pipeline, []*pipeline.Item, error) {
|
||||||
pipelineItems, err := parsePipeline(store, currentPipeline, user, repo, yamls, envs)
|
pipelineItems, err := parsePipeline(store, currentPipeline, user, repo, yamls, envs)
|
||||||
if err != nil {
|
if pipeline_errors.HasBlockingErrors(err) {
|
||||||
currentPipeline, uerr := UpdateToStatusError(store, *currentPipeline, err)
|
currentPipeline, uerr := UpdateToStatusError(store, *currentPipeline, err)
|
||||||
if uerr != nil {
|
if uerr != nil {
|
||||||
log.Error().Err(uerr).Msgf("Error setting error status of pipeline for %s#%d", repo.FullName, currentPipeline.Number)
|
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)
|
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)
|
currentPipeline = setPipelineStepsOnPipeline(currentPipeline, pipelineItems)
|
||||||
|
|
Loading…
Reference in a new issue