Fix broken gated repos (#2959)

Fixes a bug introduced in
https://github.com/woodpecker-ci/woodpecker/pull/2923. I'll also try to
add a test case.
This commit is contained in:
Robert Kaussow 2023-12-17 17:44:48 +01:00 committed by GitHub
parent b66f6cb118
commit 23f58fc07a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,10 +87,6 @@ func Create(ctx context.Context, _store store.Store, repo *model.Repo, pipeline
return nil, ErrFiltered
}
if err := updatePipelinePending(ctx, _store, pipeline, repo, repoUser); err != nil {
return nil, err
}
pipeline = setPipelineStepsOnPipeline(pipeline, pipelineItems)
// persist the pipeline config for historical correctness, restarts, etc
@ -116,6 +112,10 @@ func Create(ctx context.Context, _store store.Store, repo *model.Repo, pipeline
return pipeline, nil
}
if err := updatePipelinePending(ctx, _store, pipeline, repo, repoUser); err != nil {
return nil, err
}
pipeline, err = start(ctx, _store, pipeline, repoUser, repo, pipelineItems)
if err != nil {
msg := fmt.Sprintf("failed to start pipeline for %s", repo.FullName)