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

Some UI fixes #2698

Merged
merged 7 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 7 additions & 1 deletion server/logging/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@
l.Lock()
s, ok := l.streams[stepID]
l.Unlock()

// auto open the stream if it does not exist
if !ok {
return l.Open(ctx, stepID)
err := l.Open(ctx, stepID)
if err != nil {
return err
}

Check warning on line 88 in server/logging/log.go

View check run for this annotation

Codecov / codecov/patch

server/logging/log.go#L85-L88

Added lines #L85 - L88 were not covered by tests
}

s.Lock()
s.list = append(s.list, logEntry)
for sub := range s.subs {
Expand Down
7 changes: 6 additions & 1 deletion server/pipeline/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,17 @@
err = _store.CreatePipeline(pipeline)
if err != nil {
msg := fmt.Errorf("failed to save pipeline for %s", repo.FullName)
log.Error().Err(err).Msg(msg.Error())
log.Error().Str("repo", repo.FullName).Err(err).Msg(msg.Error())

Check warning on line 82 in server/pipeline/create.go

View check run for this annotation

Codecov / codecov/patch

server/pipeline/create.go#L82

Added line #L82 was not covered by tests
return nil, msg
}

pipeline = setPipelineStepsOnPipeline(pipeline, pipelineItems)

if err := _store.WorkflowsCreate(pipeline.Workflows); err != nil {
log.Error().Err(err).Str("repo", repo.FullName).Msgf("error persisting steps for %s#%d", repo.FullName, pipeline.Number)
return nil, err
}

Check warning on line 91 in server/pipeline/create.go

View check run for this annotation

Codecov / codecov/patch

server/pipeline/create.go#L88-L91

Added lines #L88 - L91 were not covered by tests

// persist the pipeline config for historical correctness, restarts, etc
var configs []*model.Config
for _, forgeYamlConfig := range forgeYamlConfigs {
Expand Down
2 changes: 1 addition & 1 deletion server/pipeline/decline.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
return nil, fmt.Errorf("cannot decline a pipeline with status %s", pipeline.Status)
}

_, err := UpdateToStatusDeclined(store, *pipeline, user.Login)
pipeline, err := UpdateToStatusDeclined(store, *pipeline, user.Login)

Check warning on line 33 in server/pipeline/decline.go

View check run for this annotation

Codecov / codecov/patch

server/pipeline/decline.go#L33

Added line #L33 was not covered by tests
if err != nil {
return nil, fmt.Errorf("error updating pipeline. %w", err)
}
Expand Down
18 changes: 0 additions & 18 deletions server/pipeline/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/rs/zerolog/log"

"github.com/woodpecker-ci/woodpecker/pipeline"
"github.com/woodpecker-ci/woodpecker/server"
"github.com/woodpecker-ci/woodpecker/server/model"
"github.com/woodpecker-ci/woodpecker/server/store"
)
Expand All @@ -33,30 +32,13 @@ func start(ctx context.Context, store store.Store, activePipeline *model.Pipelin
log.Error().Err(err).Msg("Failed to cancel previous pipelines")
}

if err := store.WorkflowsCreate(activePipeline.Workflows); err != nil {
anbraten marked this conversation as resolved.
Show resolved Hide resolved
log.Error().Err(err).Str("repo", repo.FullName).Msgf("error persisting steps for %s#%d", repo.FullName, activePipeline.Number)
return nil, err
}

publishPipeline(ctx, activePipeline, repo, user)

if err := queuePipeline(repo, pipelineItems); err != nil {
log.Error().Err(err).Msg("queuePipeline")
return nil, err
}

// open logs streamer for each step
for _, wf := range activePipeline.Workflows {
for _, step := range wf.Children {
stepID := step.ID
go func() {
if err := server.Config.Services.Logs.Open(context.Background(), stepID); err != nil {
log.Error().Err(err).Msgf("could not open log stream for step %d", stepID)
}
}()
}
}

return activePipeline, nil
}

Expand Down
12 changes: 11 additions & 1 deletion web/src/views/repo/pipeline/PipelineWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@
:fluid-content="activeTab === 'tasks'"
full-width-header
>
<template #title>{{ repo.full_name }}</template>
<template #title>
<span>
<router-link :to="{ name: 'org', params: { orgId: repo.org_id } }" class="hover:underline">
{{ repo.owner }}
</router-link>
/
<router-link :to="{ name: 'repo' }" class="hover:underline">
{{ repo.name }}
</router-link>
</span>
</template>

<template #titleActions>
<div class="flex md:items-center flex-col gap-2 md:flex-row md:justify-between min-w-0">
Expand Down