Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to restart pipelines that has warnings #2939

Merged
merged 5 commits into from
Dec 13, 2023
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
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"runtimeArgs": ["start"],
"cwd": "${workspaceFolder}/web",
"resolveSourceMapLocations": ["${workspaceFolder}/web/**", "!**/node_modules/**"],
"envFile": "${workspaceFolder}/.env",
"skipFiles": ["<node_internals>/**"]
}
]
Expand Down
7 changes: 2 additions & 5 deletions server/pipeline/approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

"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"
Expand Down Expand Up @@ -51,12 +50,10 @@
}

currentPipeline, pipelineItems, err := createPipelineItems(ctx, store, currentPipeline, user, repo, yamls, nil)
if errors.HasBlockingErrors(err) {
if err != nil {

Check warning on line 53 in server/pipeline/approve.go

View check run for this annotation

Codecov / codecov/patch

server/pipeline/approve.go#L53

Added line #L53 was not covered by tests
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)

Check warning on line 56 in server/pipeline/approve.go

View check run for this annotation

Codecov / codecov/patch

server/pipeline/approve.go#L56

Added line #L56 was not covered by tests
}

currentPipeline, err = start(ctx, store, currentPipeline, user, repo, pipelineItems)
Expand Down
9 changes: 5 additions & 4 deletions server/pipeline/items.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,18 @@
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) {

Check warning on line 94 in server/pipeline/items.go

View check run for this annotation

Codecov / codecov/patch

server/pipeline/items.go#L94

Added line #L94 was not covered by tests
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)
} else {
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)

Check warning on line 105 in server/pipeline/items.go

View check run for this annotation

Codecov / codecov/patch

server/pipeline/items.go#L102-L105

Added lines #L102 - L105 were not covered by tests
}

currentPipeline = setPipelineStepsOnPipeline(currentPipeline, pipelineItems)
Expand Down