Add PR pipeline list (#1641)

Instead of viewing PR pipelines in the branches lists, add a separate
list for them. The API endpoint for PRs supports pagination (thus I
added a lot of pagination-related stuff), the UI doesn't yet though.


![wp](https://user-images.githubusercontent.com/80460567/226099133-bb4935d6-c357-4d73-8465-9157e25c0d82.png)

Closes #1619 

Extends this part of #1640

---------

Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
qwerty287 2023-03-19 10:43:57 +01:00 committed by GitHub
parent 37dc8a46e0
commit 42a115e19e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 643 additions and 115 deletions

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.12.4
// protoc-gen-go v1.30.0
// protoc v3.21.12
// source: woodpecker.proto
package proto

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.12.4
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.21.12
// source: woodpecker.proto
package proto
@ -18,6 +18,19 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Woodpecker_Next_FullMethodName = "/proto.Woodpecker/Next"
Woodpecker_Init_FullMethodName = "/proto.Woodpecker/Init"
Woodpecker_Wait_FullMethodName = "/proto.Woodpecker/Wait"
Woodpecker_Done_FullMethodName = "/proto.Woodpecker/Done"
Woodpecker_Extend_FullMethodName = "/proto.Woodpecker/Extend"
Woodpecker_Update_FullMethodName = "/proto.Woodpecker/Update"
Woodpecker_Upload_FullMethodName = "/proto.Woodpecker/Upload"
Woodpecker_Log_FullMethodName = "/proto.Woodpecker/Log"
Woodpecker_RegisterAgent_FullMethodName = "/proto.Woodpecker/RegisterAgent"
Woodpecker_ReportHealth_FullMethodName = "/proto.Woodpecker/ReportHealth"
)
// WoodpeckerClient is the client API for Woodpecker service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
@ -44,7 +57,7 @@ func NewWoodpeckerClient(cc grpc.ClientConnInterface) WoodpeckerClient {
func (c *woodpeckerClient) Next(ctx context.Context, in *NextRequest, opts ...grpc.CallOption) (*NextReply, error) {
out := new(NextReply)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Next", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_Next_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -53,7 +66,7 @@ func (c *woodpeckerClient) Next(ctx context.Context, in *NextRequest, opts ...gr
func (c *woodpeckerClient) Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Init", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_Init_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -62,7 +75,7 @@ func (c *woodpeckerClient) Init(ctx context.Context, in *InitRequest, opts ...gr
func (c *woodpeckerClient) Wait(ctx context.Context, in *WaitRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Wait", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_Wait_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -71,7 +84,7 @@ func (c *woodpeckerClient) Wait(ctx context.Context, in *WaitRequest, opts ...gr
func (c *woodpeckerClient) Done(ctx context.Context, in *DoneRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Done", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_Done_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -80,7 +93,7 @@ func (c *woodpeckerClient) Done(ctx context.Context, in *DoneRequest, opts ...gr
func (c *woodpeckerClient) Extend(ctx context.Context, in *ExtendRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Extend", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_Extend_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -89,7 +102,7 @@ func (c *woodpeckerClient) Extend(ctx context.Context, in *ExtendRequest, opts .
func (c *woodpeckerClient) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Update", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_Update_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -98,7 +111,7 @@ func (c *woodpeckerClient) Update(ctx context.Context, in *UpdateRequest, opts .
func (c *woodpeckerClient) Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Upload", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_Upload_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -107,7 +120,7 @@ func (c *woodpeckerClient) Upload(ctx context.Context, in *UploadRequest, opts .
func (c *woodpeckerClient) Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Log", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_Log_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -116,7 +129,7 @@ func (c *woodpeckerClient) Log(ctx context.Context, in *LogRequest, opts ...grpc
func (c *woodpeckerClient) RegisterAgent(ctx context.Context, in *RegisterAgentRequest, opts ...grpc.CallOption) (*RegisterAgentResponse, error) {
out := new(RegisterAgentResponse)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/RegisterAgent", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_RegisterAgent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -125,7 +138,7 @@ func (c *woodpeckerClient) RegisterAgent(ctx context.Context, in *RegisterAgentR
func (c *woodpeckerClient) ReportHealth(ctx context.Context, in *ReportHealthRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/ReportHealth", in, out, opts...)
err := c.cc.Invoke(ctx, Woodpecker_ReportHealth_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -206,7 +219,7 @@ func _Woodpecker_Next_Handler(srv interface{}, ctx context.Context, dec func(int
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Next",
FullMethod: Woodpecker_Next_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Next(ctx, req.(*NextRequest))
@ -224,7 +237,7 @@ func _Woodpecker_Init_Handler(srv interface{}, ctx context.Context, dec func(int
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Init",
FullMethod: Woodpecker_Init_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Init(ctx, req.(*InitRequest))
@ -242,7 +255,7 @@ func _Woodpecker_Wait_Handler(srv interface{}, ctx context.Context, dec func(int
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Wait",
FullMethod: Woodpecker_Wait_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Wait(ctx, req.(*WaitRequest))
@ -260,7 +273,7 @@ func _Woodpecker_Done_Handler(srv interface{}, ctx context.Context, dec func(int
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Done",
FullMethod: Woodpecker_Done_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Done(ctx, req.(*DoneRequest))
@ -278,7 +291,7 @@ func _Woodpecker_Extend_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Extend",
FullMethod: Woodpecker_Extend_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Extend(ctx, req.(*ExtendRequest))
@ -296,7 +309,7 @@ func _Woodpecker_Update_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Update",
FullMethod: Woodpecker_Update_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Update(ctx, req.(*UpdateRequest))
@ -314,7 +327,7 @@ func _Woodpecker_Upload_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Upload",
FullMethod: Woodpecker_Upload_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Upload(ctx, req.(*UploadRequest))
@ -332,7 +345,7 @@ func _Woodpecker_Log_Handler(srv interface{}, ctx context.Context, dec func(inte
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Log",
FullMethod: Woodpecker_Log_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Log(ctx, req.(*LogRequest))
@ -350,7 +363,7 @@ func _Woodpecker_RegisterAgent_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/RegisterAgent",
FullMethod: Woodpecker_RegisterAgent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).RegisterAgent(ctx, req.(*RegisterAgentRequest))
@ -368,7 +381,7 @@ func _Woodpecker_ReportHealth_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/ReportHealth",
FullMethod: Woodpecker_ReportHealth_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).ReportHealth(ctx, req.(*ReportHealthRequest))
@ -428,6 +441,10 @@ var Woodpecker_ServiceDesc = grpc.ServiceDesc{
Metadata: "woodpecker.proto",
}
const (
WoodpeckerAuth_Auth_FullMethodName = "/proto.WoodpeckerAuth/Auth"
)
// WoodpeckerAuthClient is the client API for WoodpeckerAuth service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
@ -445,7 +462,7 @@ func NewWoodpeckerAuthClient(cc grpc.ClientConnInterface) WoodpeckerAuthClient {
func (c *woodpeckerAuthClient) Auth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) {
out := new(AuthReply)
err := c.cc.Invoke(ctx, "/proto.WoodpeckerAuth/Auth", in, out, opts...)
err := c.cc.Invoke(ctx, WoodpeckerAuth_Auth_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -490,7 +507,7 @@ func _WoodpeckerAuth_Auth_Handler(srv interface{}, ctx context.Context, dec func
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.WoodpeckerAuth/Auth",
FullMethod: WoodpeckerAuth_Auth_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerAuthServer).Auth(ctx, req.(*AuthRequest))

View file

@ -209,6 +209,21 @@ func GetRepoBranches(c *gin.Context) {
c.JSON(http.StatusOK, branches)
}
func GetRepoPullRequests(c *gin.Context) {
repo := session.Repo(c)
user := session.User(c)
page := session.Pagination(c)
f := server.Config.Services.Forge
prs, err := f.PullRequests(c, user, repo, page)
if err != nil {
_ = c.AbortWithError(http.StatusInternalServerError, err)
return
}
c.JSON(http.StatusOK, prs)
}
func DeleteRepo(c *gin.Context) {
remove, _ := strconv.ParseBool(c.Query("remove"))
_store := store.FromContext(c)

View file

@ -17,6 +17,7 @@ package bitbucket
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
@ -302,6 +303,10 @@ func (c *config) BranchHead(_ context.Context, _ *model.User, _ *model.Repo, _ s
return "", forge_types.ErrNotImplemented
}
func (c *config) PullRequests(_ context.Context, _ *model.User, _ *model.Repo, _ *model.PaginationData) ([]*model.PullRequest, error) {
return nil, errors.New("Bitbucket does not support pull requests yet")
}
// Hook parses the incoming Bitbucket hook and returns the Repository and
// Pipeline details. If the hook is unsupported nil values are returned.
func (c *config) Hook(_ context.Context, req *http.Request) (*model.Repo, *model.Pipeline, error) {

View file

@ -24,6 +24,7 @@ import (
"crypto/tls"
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
"net/http"
"os"
@ -244,6 +245,10 @@ func (c *Config) BranchHead(_ context.Context, _ *model.User, _ *model.Repo, _ s
return "", forge_types.ErrNotImplemented
}
func (c *Config) PullRequests(_ context.Context, _ *model.User, _ *model.Repo, _ *model.PaginationData) ([]*model.PullRequest, error) {
return nil, errors.New("Bitbucket server does not support pull requests yet")
}
func (c *Config) Deactivate(ctx context.Context, u *model.User, r *model.Repo, link string) error {
client := internal.NewClientWithToken(ctx, c.URL, c.Consumer, u.Token)
return client.DeleteHook(r.Owner, r.Name, link)

View file

@ -83,6 +83,9 @@ type Forge interface {
// BranchHead returns the sha of the head (latest commit) of the specified branch
BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (string, error)
// PullRequests returns all pull requests for the named repository.
PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.PaginationData) ([]*model.PullRequest, error)
// Hook parses the post-commit hook from the Request body and returns the
// required data in a standard format.
Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error)

View file

@ -474,6 +474,34 @@ func (c *Gitea) BranchHead(ctx context.Context, u *model.User, r *model.Repo, br
return b.Commit.ID, nil
}
func (c *Gitea) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.PaginationData) ([]*model.PullRequest, error) {
token := ""
if u != nil {
token = u.Token
}
client, err := c.newClientToken(ctx, token)
if err != nil {
return nil, err
}
pullRequests, _, err := client.ListRepoPullRequests(r.Owner, r.Name, gitea.ListPullRequestsOptions{
ListOptions: gitea.ListOptions{Page: int(p.Page), PageSize: int(p.PerPage)},
State: gitea.StateOpen,
})
if err != nil {
return nil, err
}
result := make([]*model.PullRequest, len(pullRequests))
for i := range pullRequests {
result[i] = &model.PullRequest{
Index: pullRequests[i].Index,
Title: pullRequests[i].Title,
}
}
return result, err
}
// Hook parses the incoming Gitea hook and returns the Repository and Pipeline
// details. If the hook is unsupported nil values are returned.
func (c *Gitea) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {

View file

@ -280,6 +280,31 @@ func (c *client) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model
return files, nil
}
func (c *client) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.PaginationData) ([]*model.PullRequest, error) {
token := ""
if u != nil {
token = u.Token
}
client := c.newClientToken(ctx, token)
pullRequests, _, err := client.PullRequests.List(ctx, r.Owner, r.Name, &github.PullRequestListOptions{
ListOptions: github.ListOptions{Page: int(p.Page), PerPage: int(p.PerPage)},
State: "open",
})
if err != nil {
return nil, err
}
result := make([]*model.PullRequest, len(pullRequests))
for i := range pullRequests {
result[i] = &model.PullRequest{
Index: int64(pullRequests[i].GetNumber()),
Title: pullRequests[i].GetTitle(),
}
}
return result, err
}
// Netrc returns a netrc file capable of authenticating GitHub requests and
// cloning GitHub repositories. The netrc will use the global machine account
// when configured.

View file

@ -301,6 +301,40 @@ func (g *GitLab) Repos(ctx context.Context, user *model.User) ([]*model.Repo, er
return repos, err
}
func (g *GitLab) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.PaginationData) ([]*model.PullRequest, error) {
token := ""
if u != nil {
token = u.Token
}
client, err := newClient(g.URL, token, g.SkipVerify)
if err != nil {
return nil, err
}
_repo, err := g.getProject(ctx, client, r.Owner, r.Name)
if err != nil {
return nil, err
}
state := "open"
pullRequests, _, err := client.MergeRequests.ListProjectMergeRequests(_repo.ID, &gitlab.ListProjectMergeRequestsOptions{
ListOptions: gitlab.ListOptions{Page: int(p.Page), PerPage: int(p.PerPage)},
State: &state,
})
if err != nil {
return nil, err
}
result := make([]*model.PullRequest, len(pullRequests))
for i := range pullRequests {
result[i] = &model.PullRequest{
Index: int64(pullRequests[i].ID),
Title: pullRequests[i].Title,
}
}
return result, err
}
// Perm fetches the named repository from the forge.
func (g *GitLab) Perm(ctx context.Context, user *model.User, r *model.Repo) (*model.Perm, error) {
client, err := newClient(g.URL, user.Token, g.SkipVerify)

View file

@ -18,6 +18,7 @@ package gogs
import (
"context"
"crypto/tls"
"errors"
"fmt"
"net"
"net/http"
@ -299,6 +300,10 @@ func (c *client) BranchHead(_ context.Context, u *model.User, r *model.Repo, bra
return b.Commit.ID, nil
}
func (c *client) PullRequests(_ context.Context, _ *model.User, _ *model.Repo, _ *model.PaginationData) ([]*model.PullRequest, error) {
return nil, errors.New("Gogs does not support pull requests yet")
}
// Hook parses the incoming Gogs hook and returns the Repository and Pipeline
// details. If the hook is unsupported nil values are returned.
func (c *client) Hook(_ context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {

View file

@ -1,4 +1,4 @@
// Code generated by mockery v2.14.1. DO NOT EDIT.
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
@ -38,13 +38,16 @@ func (_m *Forge) Auth(ctx context.Context, token string, secret string) (string,
ret := _m.Called(ctx, token, secret)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (string, error)); ok {
return rf(ctx, token, secret)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) string); ok {
r0 = rf(ctx, token, secret)
} else {
r0 = ret.Get(0).(string)
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, token, secret)
} else {
@ -59,13 +62,16 @@ func (_m *Forge) BranchHead(ctx context.Context, u *model.User, r *model.Repo, b
ret := _m.Called(ctx, u, r, branch)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) (string, error)); ok {
return rf(ctx, u, r, branch)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) string); ok {
r0 = rf(ctx, u, r, branch)
} else {
r0 = ret.Get(0).(string)
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, string) error); ok {
r1 = rf(ctx, u, r, branch)
} else {
@ -80,6 +86,10 @@ func (_m *Forge) Branches(ctx context.Context, u *model.User, r *model.Repo) ([]
ret := _m.Called(ctx, u, r)
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo) ([]string, error)); ok {
return rf(ctx, u, r)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo) []string); ok {
r0 = rf(ctx, u, r)
} else {
@ -88,7 +98,6 @@ func (_m *Forge) Branches(ctx context.Context, u *model.User, r *model.Repo) ([]
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo) error); ok {
r1 = rf(ctx, u, r)
} else {
@ -117,6 +126,10 @@ func (_m *Forge) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model
ret := _m.Called(ctx, u, r, b, f)
var r0 []*types.FileMeta
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) ([]*types.FileMeta, error)); ok {
return rf(ctx, u, r, b, f)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) []*types.FileMeta); ok {
r0 = rf(ctx, u, r, b, f)
} else {
@ -125,7 +138,6 @@ func (_m *Forge) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) error); ok {
r1 = rf(ctx, u, r, b, f)
} else {
@ -140,6 +152,10 @@ func (_m *Forge) File(ctx context.Context, u *model.User, r *model.Repo, b *mode
ret := _m.Called(ctx, u, r, b, f)
var r0 []byte
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) ([]byte, error)); ok {
return rf(ctx, u, r, b, f)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) []byte); ok {
r0 = rf(ctx, u, r, b, f)
} else {
@ -148,7 +164,6 @@ func (_m *Forge) File(ctx context.Context, u *model.User, r *model.Repo, b *mode
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) error); ok {
r1 = rf(ctx, u, r, b, f)
} else {
@ -163,6 +178,11 @@ func (_m *Forge) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model
ret := _m.Called(ctx, r)
var r0 *model.Repo
var r1 *model.Pipeline
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, *http.Request) (*model.Repo, *model.Pipeline, error)); ok {
return rf(ctx, r)
}
if rf, ok := ret.Get(0).(func(context.Context, *http.Request) *model.Repo); ok {
r0 = rf(ctx, r)
} else {
@ -171,7 +191,6 @@ func (_m *Forge) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model
}
}
var r1 *model.Pipeline
if rf, ok := ret.Get(1).(func(context.Context, *http.Request) *model.Pipeline); ok {
r1 = rf(ctx, r)
} else {
@ -180,7 +199,6 @@ func (_m *Forge) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, *http.Request) error); ok {
r2 = rf(ctx, r)
} else {
@ -195,6 +213,10 @@ func (_m *Forge) Login(ctx context.Context, w http.ResponseWriter, r *http.Reque
ret := _m.Called(ctx, w, r)
var r0 *model.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, http.ResponseWriter, *http.Request) (*model.User, error)); ok {
return rf(ctx, w, r)
}
if rf, ok := ret.Get(0).(func(context.Context, http.ResponseWriter, *http.Request) *model.User); ok {
r0 = rf(ctx, w, r)
} else {
@ -203,7 +225,6 @@ func (_m *Forge) Login(ctx context.Context, w http.ResponseWriter, r *http.Reque
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, http.ResponseWriter, *http.Request) error); ok {
r1 = rf(ctx, w, r)
} else {
@ -232,6 +253,10 @@ func (_m *Forge) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error) {
ret := _m.Called(u, r)
var r0 *model.Netrc
var r1 error
if rf, ok := ret.Get(0).(func(*model.User, *model.Repo) (*model.Netrc, error)); ok {
return rf(u, r)
}
if rf, ok := ret.Get(0).(func(*model.User, *model.Repo) *model.Netrc); ok {
r0 = rf(u, r)
} else {
@ -240,7 +265,6 @@ func (_m *Forge) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.User, *model.Repo) error); ok {
r1 = rf(u, r)
} else {
@ -255,6 +279,10 @@ func (_m *Forge) OrgMembership(ctx context.Context, u *model.User, owner string)
ret := _m.Called(ctx, u, owner)
var r0 *model.OrgPerm
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) (*model.OrgPerm, error)); ok {
return rf(ctx, u, owner)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) *model.OrgPerm); ok {
r0 = rf(ctx, u, owner)
} else {
@ -263,7 +291,6 @@ func (_m *Forge) OrgMembership(ctx context.Context, u *model.User, owner string)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *model.User, string) error); ok {
r1 = rf(ctx, u, owner)
} else {
@ -278,6 +305,10 @@ func (_m *Forge) Perm(ctx context.Context, u *model.User, r *model.Repo) (*model
ret := _m.Called(ctx, u, r)
var r0 *model.Perm
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo) (*model.Perm, error)); ok {
return rf(ctx, u, r)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo) *model.Perm); ok {
r0 = rf(ctx, u, r)
} else {
@ -286,7 +317,6 @@ func (_m *Forge) Perm(ctx context.Context, u *model.User, r *model.Repo) (*model
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo) error); ok {
r1 = rf(ctx, u, r)
} else {
@ -296,11 +326,41 @@ func (_m *Forge) Perm(ctx context.Context, u *model.User, r *model.Repo) (*model
return r0, r1
}
// PullRequests provides a mock function with given fields: ctx, u, r, p
func (_m *Forge) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.PaginationData) ([]*model.PullRequest, error) {
ret := _m.Called(ctx, u, r, p)
var r0 []*model.PullRequest
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.PaginationData) ([]*model.PullRequest, error)); ok {
return rf(ctx, u, r, p)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.PaginationData) []*model.PullRequest); ok {
r0 = rf(ctx, u, r, p)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.PullRequest)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.PaginationData) error); ok {
r1 = rf(ctx, u, r, p)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Repo provides a mock function with given fields: ctx, u, remoteID, owner, name
func (_m *Forge) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRemoteID, owner string, name string) (*model.Repo, error) {
ret := _m.Called(ctx, u, remoteID, owner, name)
var r0 *model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, model.ForgeRemoteID, string, string) (*model.Repo, error)); ok {
return rf(ctx, u, remoteID, owner, name)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, model.ForgeRemoteID, string, string) *model.Repo); ok {
r0 = rf(ctx, u, remoteID, owner, name)
} else {
@ -309,7 +369,6 @@ func (_m *Forge) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRe
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *model.User, model.ForgeRemoteID, string, string) error); ok {
r1 = rf(ctx, u, remoteID, owner, name)
} else {
@ -324,6 +383,10 @@ func (_m *Forge) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error
ret := _m.Called(ctx, u)
var r0 []*model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User) ([]*model.Repo, error)); ok {
return rf(ctx, u)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User) []*model.Repo); ok {
r0 = rf(ctx, u)
} else {
@ -332,7 +395,6 @@ func (_m *Forge) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *model.User) error); ok {
r1 = rf(ctx, u)
} else {
@ -361,6 +423,10 @@ func (_m *Forge) Teams(ctx context.Context, u *model.User) ([]*model.Team, error
ret := _m.Called(ctx, u)
var r0 []*model.Team
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User) ([]*model.Team, error)); ok {
return rf(ctx, u)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User) []*model.Team); ok {
r0 = rf(ctx, u)
} else {
@ -369,7 +435,6 @@ func (_m *Forge) Teams(ctx context.Context, u *model.User) ([]*model.Team, error
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *model.User) error); ok {
r1 = rf(ctx, u)
} else {

View file

@ -0,0 +1,6 @@
package model
type PaginationData struct {
Page int64
PerPage int64
}

View file

@ -0,0 +1,6 @@
package model
type PullRequest struct {
Index int64 `json:"index"`
Title string `json:"title"`
}

View file

@ -76,6 +76,7 @@ func apiRoutes(e *gin.Engine) {
repo.GET("", api.GetRepo)
repo.GET("/branches", api.GetRepoBranches)
repo.GET("/pull_requests", api.GetRepoPullRequests)
repo.GET("/pipelines", api.GetPipelines)
repo.POST("/pipelines", session.MustPush, api.CreatePipeline)

View file

@ -0,0 +1,28 @@
package session
import (
"strconv"
"github.com/gin-gonic/gin"
"github.com/woodpecker-ci/woodpecker/server/model"
)
const (
defaultPage = 1
defaultPerPage = 25
)
func Pagination(c *gin.Context) *model.PaginationData {
page, err := strconv.ParseInt(c.Param("page"), 10, 64)
if err != nil {
page = defaultPage
}
perPage, err := strconv.ParseInt(c.Param("perPage"), 10, 64)
if err != nil {
perPage = defaultPerPage
}
return &model.PaginationData{
Page: page,
PerPage: perPage,
}
}

View file

@ -1,4 +1,4 @@
// Code generated by mockery v2.14.1. DO NOT EDIT.
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
@ -6,7 +6,6 @@ import (
io "io"
mock "github.com/stretchr/testify/mock"
model "github.com/woodpecker-ci/woodpecker/server/model"
)
@ -48,6 +47,10 @@ func (_m *Store) AgentFind(_a0 int64) (*model.Agent, error) {
ret := _m.Called(_a0)
var r0 *model.Agent
var r1 error
if rf, ok := ret.Get(0).(func(int64) (*model.Agent, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(int64) *model.Agent); ok {
r0 = rf(_a0)
} else {
@ -56,7 +59,6 @@ func (_m *Store) AgentFind(_a0 int64) (*model.Agent, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(int64) error); ok {
r1 = rf(_a0)
} else {
@ -71,6 +73,10 @@ func (_m *Store) AgentFindByToken(_a0 string) (*model.Agent, error) {
ret := _m.Called(_a0)
var r0 *model.Agent
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Agent, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Agent); ok {
r0 = rf(_a0)
} else {
@ -79,7 +85,6 @@ func (_m *Store) AgentFindByToken(_a0 string) (*model.Agent, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
@ -94,6 +99,10 @@ func (_m *Store) AgentList() ([]*model.Agent, error) {
ret := _m.Called()
var r0 []*model.Agent
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.Agent, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.Agent); ok {
r0 = rf()
} else {
@ -102,7 +111,6 @@ func (_m *Store) AgentList() ([]*model.Agent, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@ -159,13 +167,16 @@ func (_m *Store) ConfigFindApproved(_a0 *model.Config) (bool, error) {
ret := _m.Called(_a0)
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(*model.Config) (bool, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Config) bool); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(bool)
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Config) error); ok {
r1 = rf(_a0)
} else {
@ -180,6 +191,10 @@ func (_m *Store) ConfigFindIdentical(repoID int64, hash string) (*model.Config,
ret := _m.Called(repoID, hash)
var r0 *model.Config
var r1 error
if rf, ok := ret.Get(0).(func(int64, string) (*model.Config, error)); ok {
return rf(repoID, hash)
}
if rf, ok := ret.Get(0).(func(int64, string) *model.Config); ok {
r0 = rf(repoID, hash)
} else {
@ -188,7 +203,6 @@ func (_m *Store) ConfigFindIdentical(repoID int64, hash string) (*model.Config,
}
}
var r1 error
if rf, ok := ret.Get(1).(func(int64, string) error); ok {
r1 = rf(repoID, hash)
} else {
@ -203,6 +217,10 @@ func (_m *Store) ConfigsForPipeline(pipelineID int64) ([]*model.Config, error) {
ret := _m.Called(pipelineID)
var r0 []*model.Config
var r1 error
if rf, ok := ret.Get(0).(func(int64) ([]*model.Config, error)); ok {
return rf(pipelineID)
}
if rf, ok := ret.Get(0).(func(int64) []*model.Config); ok {
r0 = rf(pipelineID)
} else {
@ -211,7 +229,6 @@ func (_m *Store) ConfigsForPipeline(pipelineID int64) ([]*model.Config, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(int64) error); ok {
r1 = rf(pipelineID)
} else {
@ -317,6 +334,10 @@ func (_m *Store) CronFind(_a0 *model.Repo, _a1 int64) (*model.Cron, error) {
ret := _m.Called(_a0, _a1)
var r0 *model.Cron
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, int64) (*model.Cron, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, int64) *model.Cron); ok {
r0 = rf(_a0, _a1)
} else {
@ -325,7 +346,6 @@ func (_m *Store) CronFind(_a0 *model.Repo, _a1 int64) (*model.Cron, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, int64) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -340,13 +360,16 @@ func (_m *Store) CronGetLock(_a0 *model.Cron, _a1 int64) (bool, error) {
ret := _m.Called(_a0, _a1)
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(*model.Cron, int64) (bool, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Cron, int64) bool); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Get(0).(bool)
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Cron, int64) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -361,6 +384,10 @@ func (_m *Store) CronList(_a0 *model.Repo) ([]*model.Cron, error) {
ret := _m.Called(_a0)
var r0 []*model.Cron
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo) ([]*model.Cron, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Repo) []*model.Cron); ok {
r0 = rf(_a0)
} else {
@ -369,7 +396,6 @@ func (_m *Store) CronList(_a0 *model.Repo) ([]*model.Cron, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo) error); ok {
r1 = rf(_a0)
} else {
@ -384,6 +410,10 @@ func (_m *Store) CronListNextExecute(_a0 int64, _a1 int64) ([]*model.Cron, error
ret := _m.Called(_a0, _a1)
var r0 []*model.Cron
var r1 error
if rf, ok := ret.Get(0).(func(int64, int64) ([]*model.Cron, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, int64) []*model.Cron); ok {
r0 = rf(_a0, _a1)
} else {
@ -392,7 +422,6 @@ func (_m *Store) CronListNextExecute(_a0 int64, _a1 int64) ([]*model.Cron, error
}
}
var r1 error
if rf, ok := ret.Get(1).(func(int64, int64) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -463,6 +492,10 @@ func (_m *Store) FileFind(_a0 *model.Step, _a1 string) (*model.File, error) {
ret := _m.Called(_a0, _a1)
var r0 *model.File
var r1 error
if rf, ok := ret.Get(0).(func(*model.Step, string) (*model.File, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Step, string) *model.File); ok {
r0 = rf(_a0, _a1)
} else {
@ -471,7 +504,6 @@ func (_m *Store) FileFind(_a0 *model.Step, _a1 string) (*model.File, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Step, string) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -486,6 +518,10 @@ func (_m *Store) FileList(_a0 *model.Pipeline) ([]*model.File, error) {
ret := _m.Called(_a0)
var r0 []*model.File
var r1 error
if rf, ok := ret.Get(0).(func(*model.Pipeline) ([]*model.File, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Pipeline) []*model.File); ok {
r0 = rf(_a0)
} else {
@ -494,7 +530,6 @@ func (_m *Store) FileList(_a0 *model.Pipeline) ([]*model.File, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Pipeline) error); ok {
r1 = rf(_a0)
} else {
@ -509,6 +544,10 @@ func (_m *Store) FileRead(_a0 *model.Step, _a1 string) (io.ReadCloser, error) {
ret := _m.Called(_a0, _a1)
var r0 io.ReadCloser
var r1 error
if rf, ok := ret.Get(0).(func(*model.Step, string) (io.ReadCloser, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Step, string) io.ReadCloser); ok {
r0 = rf(_a0, _a1)
} else {
@ -517,7 +556,6 @@ func (_m *Store) FileRead(_a0 *model.Step, _a1 string) (io.ReadCloser, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Step, string) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -532,6 +570,10 @@ func (_m *Store) GetActivePipelineList(repo *model.Repo, page int) ([]*model.Pip
ret := _m.Called(repo, page)
var r0 []*model.Pipeline
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, int) ([]*model.Pipeline, error)); ok {
return rf(repo, page)
}
if rf, ok := ret.Get(0).(func(*model.Repo, int) []*model.Pipeline); ok {
r0 = rf(repo, page)
} else {
@ -540,7 +582,6 @@ func (_m *Store) GetActivePipelineList(repo *model.Repo, page int) ([]*model.Pip
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, int) error); ok {
r1 = rf(repo, page)
} else {
@ -555,6 +596,10 @@ func (_m *Store) GetPipeline(_a0 int64) (*model.Pipeline, error) {
ret := _m.Called(_a0)
var r0 *model.Pipeline
var r1 error
if rf, ok := ret.Get(0).(func(int64) (*model.Pipeline, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(int64) *model.Pipeline); ok {
r0 = rf(_a0)
} else {
@ -563,7 +608,6 @@ func (_m *Store) GetPipeline(_a0 int64) (*model.Pipeline, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(int64) error); ok {
r1 = rf(_a0)
} else {
@ -578,6 +622,10 @@ func (_m *Store) GetPipelineCommit(_a0 *model.Repo, _a1 string, _a2 string) (*mo
ret := _m.Called(_a0, _a1, _a2)
var r0 *model.Pipeline
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string, string) (*model.Pipeline, error)); ok {
return rf(_a0, _a1, _a2)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string, string) *model.Pipeline); ok {
r0 = rf(_a0, _a1, _a2)
} else {
@ -586,7 +634,6 @@ func (_m *Store) GetPipelineCommit(_a0 *model.Repo, _a1 string, _a2 string) (*mo
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, string, string) error); ok {
r1 = rf(_a0, _a1, _a2)
} else {
@ -601,13 +648,16 @@ func (_m *Store) GetPipelineCount() (int64, error) {
ret := _m.Called()
var r0 int64
var r1 error
if rf, ok := ret.Get(0).(func() (int64, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() int64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int64)
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@ -622,6 +672,10 @@ func (_m *Store) GetPipelineLast(_a0 *model.Repo, _a1 string) (*model.Pipeline,
ret := _m.Called(_a0, _a1)
var r0 *model.Pipeline
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Pipeline, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Pipeline); ok {
r0 = rf(_a0, _a1)
} else {
@ -630,7 +684,6 @@ func (_m *Store) GetPipelineLast(_a0 *model.Repo, _a1 string) (*model.Pipeline,
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -645,6 +698,10 @@ func (_m *Store) GetPipelineLastBefore(_a0 *model.Repo, _a1 string, _a2 int64) (
ret := _m.Called(_a0, _a1, _a2)
var r0 *model.Pipeline
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string, int64) (*model.Pipeline, error)); ok {
return rf(_a0, _a1, _a2)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string, int64) *model.Pipeline); ok {
r0 = rf(_a0, _a1, _a2)
} else {
@ -653,7 +710,6 @@ func (_m *Store) GetPipelineLastBefore(_a0 *model.Repo, _a1 string, _a2 int64) (
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, string, int64) error); ok {
r1 = rf(_a0, _a1, _a2)
} else {
@ -668,6 +724,10 @@ func (_m *Store) GetPipelineList(_a0 *model.Repo, _a1 int) ([]*model.Pipeline, e
ret := _m.Called(_a0, _a1)
var r0 []*model.Pipeline
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, int) ([]*model.Pipeline, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, int) []*model.Pipeline); ok {
r0 = rf(_a0, _a1)
} else {
@ -676,7 +736,6 @@ func (_m *Store) GetPipelineList(_a0 *model.Repo, _a1 int) ([]*model.Pipeline, e
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, int) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -691,6 +750,10 @@ func (_m *Store) GetPipelineNumber(_a0 *model.Repo, _a1 int64) (*model.Pipeline,
ret := _m.Called(_a0, _a1)
var r0 *model.Pipeline
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, int64) (*model.Pipeline, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, int64) *model.Pipeline); ok {
r0 = rf(_a0, _a1)
} else {
@ -699,7 +762,6 @@ func (_m *Store) GetPipelineNumber(_a0 *model.Repo, _a1 int64) (*model.Pipeline,
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, int64) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -714,6 +776,10 @@ func (_m *Store) GetPipelineQueue() ([]*model.Feed, error) {
ret := _m.Called()
var r0 []*model.Feed
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.Feed, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.Feed); ok {
r0 = rf()
} else {
@ -722,7 +788,6 @@ func (_m *Store) GetPipelineQueue() ([]*model.Feed, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@ -737,6 +802,10 @@ func (_m *Store) GetPipelineRef(_a0 *model.Repo, _a1 string) (*model.Pipeline, e
ret := _m.Called(_a0, _a1)
var r0 *model.Pipeline
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Pipeline, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Pipeline); ok {
r0 = rf(_a0, _a1)
} else {
@ -745,7 +814,6 @@ func (_m *Store) GetPipelineRef(_a0 *model.Repo, _a1 string) (*model.Pipeline, e
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -760,6 +828,10 @@ func (_m *Store) GetRedirection(_a0 string) (*model.Redirection, error) {
ret := _m.Called(_a0)
var r0 *model.Redirection
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Redirection, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Redirection); ok {
r0 = rf(_a0)
} else {
@ -768,7 +840,6 @@ func (_m *Store) GetRedirection(_a0 string) (*model.Redirection, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
@ -783,6 +854,10 @@ func (_m *Store) GetRepo(_a0 int64) (*model.Repo, error) {
ret := _m.Called(_a0)
var r0 *model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(int64) (*model.Repo, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(int64) *model.Repo); ok {
r0 = rf(_a0)
} else {
@ -791,7 +866,6 @@ func (_m *Store) GetRepo(_a0 int64) (*model.Repo, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(int64) error); ok {
r1 = rf(_a0)
} else {
@ -806,13 +880,16 @@ func (_m *Store) GetRepoCount() (int64, error) {
ret := _m.Called()
var r0 int64
var r1 error
if rf, ok := ret.Get(0).(func() (int64, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() int64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int64)
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@ -827,6 +904,10 @@ func (_m *Store) GetRepoForgeID(_a0 model.ForgeRemoteID) (*model.Repo, error) {
ret := _m.Called(_a0)
var r0 *model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(model.ForgeRemoteID) (*model.Repo, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(model.ForgeRemoteID) *model.Repo); ok {
r0 = rf(_a0)
} else {
@ -835,7 +916,6 @@ func (_m *Store) GetRepoForgeID(_a0 model.ForgeRemoteID) (*model.Repo, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(model.ForgeRemoteID) error); ok {
r1 = rf(_a0)
} else {
@ -850,6 +930,10 @@ func (_m *Store) GetRepoName(_a0 string) (*model.Repo, error) {
ret := _m.Called(_a0)
var r0 *model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Repo, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Repo); ok {
r0 = rf(_a0)
} else {
@ -858,7 +942,6 @@ func (_m *Store) GetRepoName(_a0 string) (*model.Repo, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
@ -873,6 +956,10 @@ func (_m *Store) GetRepoNameFallback(remoteID model.ForgeRemoteID, fullName stri
ret := _m.Called(remoteID, fullName)
var r0 *model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(model.ForgeRemoteID, string) (*model.Repo, error)); ok {
return rf(remoteID, fullName)
}
if rf, ok := ret.Get(0).(func(model.ForgeRemoteID, string) *model.Repo); ok {
r0 = rf(remoteID, fullName)
} else {
@ -881,7 +968,6 @@ func (_m *Store) GetRepoNameFallback(remoteID model.ForgeRemoteID, fullName stri
}
}
var r1 error
if rf, ok := ret.Get(1).(func(model.ForgeRemoteID, string) error); ok {
r1 = rf(remoteID, fullName)
} else {
@ -896,6 +982,10 @@ func (_m *Store) GetUser(_a0 int64) (*model.User, error) {
ret := _m.Called(_a0)
var r0 *model.User
var r1 error
if rf, ok := ret.Get(0).(func(int64) (*model.User, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(int64) *model.User); ok {
r0 = rf(_a0)
} else {
@ -904,7 +994,6 @@ func (_m *Store) GetUser(_a0 int64) (*model.User, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(int64) error); ok {
r1 = rf(_a0)
} else {
@ -919,13 +1008,16 @@ func (_m *Store) GetUserCount() (int64, error) {
ret := _m.Called()
var r0 int64
var r1 error
if rf, ok := ret.Get(0).(func() (int64, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() int64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int64)
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@ -940,6 +1032,10 @@ func (_m *Store) GetUserList() ([]*model.User, error) {
ret := _m.Called()
var r0 []*model.User
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.User, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.User); ok {
r0 = rf()
} else {
@ -948,7 +1044,6 @@ func (_m *Store) GetUserList() ([]*model.User, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@ -963,6 +1058,10 @@ func (_m *Store) GetUserLogin(_a0 string) (*model.User, error) {
ret := _m.Called(_a0)
var r0 *model.User
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.User, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.User); ok {
r0 = rf(_a0)
} else {
@ -971,7 +1070,6 @@ func (_m *Store) GetUserLogin(_a0 string) (*model.User, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
@ -986,6 +1084,10 @@ func (_m *Store) GlobalSecretFind(_a0 string) (*model.Secret, error) {
ret := _m.Called(_a0)
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Secret); ok {
r0 = rf(_a0)
} else {
@ -994,7 +1096,6 @@ func (_m *Store) GlobalSecretFind(_a0 string) (*model.Secret, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
@ -1009,6 +1110,10 @@ func (_m *Store) GlobalSecretList() ([]*model.Secret, error) {
ret := _m.Called()
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.Secret, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.Secret); ok {
r0 = rf()
} else {
@ -1017,7 +1122,6 @@ func (_m *Store) GlobalSecretList() ([]*model.Secret, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@ -1032,13 +1136,16 @@ func (_m *Store) HasRedirectionForRepo(_a0 int64, _a1 string) (bool, error) {
ret := _m.Called(_a0, _a1)
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(int64, string) (bool, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, string) bool); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Get(0).(bool)
}
var r1 error
if rf, ok := ret.Get(1).(func(int64, string) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -1053,6 +1160,10 @@ func (_m *Store) LogFind(_a0 *model.Step) (io.ReadCloser, error) {
ret := _m.Called(_a0)
var r0 io.ReadCloser
var r1 error
if rf, ok := ret.Get(0).(func(*model.Step) (io.ReadCloser, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Step) io.ReadCloser); ok {
r0 = rf(_a0)
} else {
@ -1061,7 +1172,6 @@ func (_m *Store) LogFind(_a0 *model.Step) (io.ReadCloser, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Step) error); ok {
r1 = rf(_a0)
} else {
@ -1104,6 +1214,10 @@ func (_m *Store) OrgSecretFind(_a0 string, _a1 string) (*model.Secret, error) {
ret := _m.Called(_a0, _a1)
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(string, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
@ -1112,7 +1226,6 @@ func (_m *Store) OrgSecretFind(_a0 string, _a1 string) (*model.Secret, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -1127,6 +1240,10 @@ func (_m *Store) OrgSecretList(_a0 string) ([]*model.Secret, error) {
ret := _m.Called(_a0)
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(string) ([]*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) []*model.Secret); ok {
r0 = rf(_a0)
} else {
@ -1135,7 +1252,6 @@ func (_m *Store) OrgSecretList(_a0 string) ([]*model.Secret, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
@ -1164,6 +1280,10 @@ func (_m *Store) PermFind(user *model.User, repo *model.Repo) (*model.Perm, erro
ret := _m.Called(user, repo)
var r0 *model.Perm
var r1 error
if rf, ok := ret.Get(0).(func(*model.User, *model.Repo) (*model.Perm, error)); ok {
return rf(user, repo)
}
if rf, ok := ret.Get(0).(func(*model.User, *model.Repo) *model.Perm); ok {
r0 = rf(user, repo)
} else {
@ -1172,7 +1292,6 @@ func (_m *Store) PermFind(user *model.User, repo *model.Repo) (*model.Perm, erro
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.User, *model.Repo) error); ok {
r1 = rf(user, repo)
} else {
@ -1271,6 +1390,10 @@ func (_m *Store) RegistryFind(_a0 *model.Repo, _a1 string) (*model.Registry, err
ret := _m.Called(_a0, _a1)
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
@ -1279,7 +1402,6 @@ func (_m *Store) RegistryFind(_a0 *model.Repo, _a1 string) (*model.Registry, err
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -1294,6 +1416,10 @@ func (_m *Store) RegistryList(_a0 *model.Repo) ([]*model.Registry, error) {
ret := _m.Called(_a0)
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo) ([]*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Repo) []*model.Registry); ok {
r0 = rf(_a0)
} else {
@ -1302,7 +1428,6 @@ func (_m *Store) RegistryList(_a0 *model.Repo) ([]*model.Registry, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo) error); ok {
r1 = rf(_a0)
} else {
@ -1345,6 +1470,10 @@ func (_m *Store) RepoList(user *model.User, owned bool) ([]*model.Repo, error) {
ret := _m.Called(user, owned)
var r0 []*model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(*model.User, bool) ([]*model.Repo, error)); ok {
return rf(user, owned)
}
if rf, ok := ret.Get(0).(func(*model.User, bool) []*model.Repo); ok {
r0 = rf(user, owned)
} else {
@ -1353,7 +1482,6 @@ func (_m *Store) RepoList(user *model.User, owned bool) ([]*model.Repo, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.User, bool) error); ok {
r1 = rf(user, owned)
} else {
@ -1368,6 +1496,10 @@ func (_m *Store) RepoListLatest(_a0 *model.User) ([]*model.Feed, error) {
ret := _m.Called(_a0)
var r0 []*model.Feed
var r1 error
if rf, ok := ret.Get(0).(func(*model.User) ([]*model.Feed, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.User) []*model.Feed); ok {
r0 = rf(_a0)
} else {
@ -1376,7 +1508,6 @@ func (_m *Store) RepoListLatest(_a0 *model.User) ([]*model.Feed, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.User) error); ok {
r1 = rf(_a0)
} else {
@ -1419,6 +1550,10 @@ func (_m *Store) SecretFind(_a0 *model.Repo, _a1 string) (*model.Secret, error)
ret := _m.Called(_a0, _a1)
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
@ -1427,7 +1562,6 @@ func (_m *Store) SecretFind(_a0 *model.Repo, _a1 string) (*model.Secret, error)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -1442,6 +1576,10 @@ func (_m *Store) SecretList(_a0 *model.Repo, _a1 bool) ([]*model.Secret, error)
ret := _m.Called(_a0, _a1)
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, bool) ([]*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, bool) []*model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
@ -1450,7 +1588,6 @@ func (_m *Store) SecretList(_a0 *model.Repo, _a1 bool) ([]*model.Secret, error)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Repo, bool) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -1460,11 +1597,15 @@ func (_m *Store) SecretList(_a0 *model.Repo, _a1 bool) ([]*model.Secret, error)
return r0, r1
}
// SecretList provides a mock function
// SecretListAll provides a mock function with given fields:
func (_m *Store) SecretListAll() ([]*model.Secret, error) {
ret := _m.Called()
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.Secret, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.Secret); ok {
r0 = rf()
} else {
@ -1473,7 +1614,6 @@ func (_m *Store) SecretListAll() ([]*model.Secret, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@ -1497,18 +1637,35 @@ func (_m *Store) SecretUpdate(_a0 *model.Secret) error {
return r0
}
// ServerConfigDelete provides a mock function with given fields: _a0
func (_m *Store) ServerConfigDelete(_a0 string) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// ServerConfigGet provides a mock function with given fields: _a0
func (_m *Store) ServerConfigGet(_a0 string) (string, error) {
ret := _m.Called(_a0)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string) (string, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) string); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(string)
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
@ -1532,25 +1689,15 @@ func (_m *Store) ServerConfigSet(_a0 string, _a1 string) error {
return r0
}
// ServerConfigDelete provides a mock function with given fields: _a0
func (_m *Store) ServerConfigDelete(_a0 string) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// StepChild provides a mock function with given fields: _a0, _a1, _a2
func (_m *Store) StepChild(_a0 *model.Pipeline, _a1 int, _a2 string) (*model.Step, error) {
ret := _m.Called(_a0, _a1, _a2)
var r0 *model.Step
var r1 error
if rf, ok := ret.Get(0).(func(*model.Pipeline, int, string) (*model.Step, error)); ok {
return rf(_a0, _a1, _a2)
}
if rf, ok := ret.Get(0).(func(*model.Pipeline, int, string) *model.Step); ok {
r0 = rf(_a0, _a1, _a2)
} else {
@ -1559,7 +1706,6 @@ func (_m *Store) StepChild(_a0 *model.Pipeline, _a1 int, _a2 string) (*model.Ste
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Pipeline, int, string) error); ok {
r1 = rf(_a0, _a1, _a2)
} else {
@ -1602,6 +1748,10 @@ func (_m *Store) StepFind(_a0 *model.Pipeline, _a1 int) (*model.Step, error) {
ret := _m.Called(_a0, _a1)
var r0 *model.Step
var r1 error
if rf, ok := ret.Get(0).(func(*model.Pipeline, int) (*model.Step, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Pipeline, int) *model.Step); ok {
r0 = rf(_a0, _a1)
} else {
@ -1610,7 +1760,6 @@ func (_m *Store) StepFind(_a0 *model.Pipeline, _a1 int) (*model.Step, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Pipeline, int) error); ok {
r1 = rf(_a0, _a1)
} else {
@ -1625,6 +1774,10 @@ func (_m *Store) StepList(_a0 *model.Pipeline) ([]*model.Step, error) {
ret := _m.Called(_a0)
var r0 []*model.Step
var r1 error
if rf, ok := ret.Get(0).(func(*model.Pipeline) ([]*model.Step, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Pipeline) []*model.Step); ok {
r0 = rf(_a0)
} else {
@ -1633,7 +1786,6 @@ func (_m *Store) StepList(_a0 *model.Pipeline) ([]*model.Step, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Pipeline) error); ok {
r1 = rf(_a0)
} else {
@ -1648,6 +1800,10 @@ func (_m *Store) StepLoad(_a0 int64) (*model.Step, error) {
ret := _m.Called(_a0)
var r0 *model.Step
var r1 error
if rf, ok := ret.Get(0).(func(int64) (*model.Step, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(int64) *model.Step); ok {
r0 = rf(_a0)
} else {
@ -1656,7 +1812,6 @@ func (_m *Store) StepLoad(_a0 int64) (*model.Step, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(int64) error); ok {
r1 = rf(_a0)
} else {
@ -1713,6 +1868,10 @@ func (_m *Store) TaskList() ([]*model.Task, error) {
ret := _m.Called()
var r0 []*model.Task
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.Task, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.Task); ok {
r0 = rf()
} else {
@ -1721,7 +1880,6 @@ func (_m *Store) TaskList() ([]*model.Task, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
@ -1778,6 +1936,10 @@ func (_m *Store) UserFeed(_a0 *model.User) ([]*model.Feed, error) {
ret := _m.Called(_a0)
var r0 []*model.Feed
var r1 error
if rf, ok := ret.Get(0).(func(*model.User) ([]*model.Feed, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.User) []*model.Feed); ok {
r0 = rf(_a0)
} else {
@ -1786,7 +1948,6 @@ func (_m *Store) UserFeed(_a0 *model.User) ([]*model.Feed, error) {
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.User) error); ok {
r1 = rf(_a0)
} else {

3
web/components.d.ts vendored
View file

@ -10,7 +10,6 @@ declare module '@vue/runtime-core' {
ActionsTab: typeof import('./src/components/repo/settings/ActionsTab.vue')['default']
ActivePipelines: typeof import('./src/components/layout/header/ActivePipelines.vue')['default']
AdminAgentsTab: typeof import('./src/components/admin/settings/AdminAgentsTab.vue')['default']
AdminQueueTab: typeof import('./src/components/admin/settings/AdminQueueTab.vue')['default']
AdminSecretsTab: typeof import('./src/components/admin/settings/AdminSecretsTab.vue')['default']
AdminUsersTab: typeof import('./src/components/admin/settings/AdminUsersTab.vue')['default']
Badge: typeof import('./src/components/atomic/Badge.vue')['default']
@ -18,7 +17,6 @@ declare module '@vue/runtime-core' {
Button: typeof import('./src/components/atomic/Button.vue')['default']
Checkbox: typeof import('./src/components/form/Checkbox.vue')['default']
CheckboxesField: typeof import('./src/components/form/CheckboxesField.vue')['default']
copy: typeof import('./src/components/admin/settings/AdminAgentsTab copy.vue')['default']
CronTab: typeof import('./src/components/repo/settings/CronTab.vue')['default']
DeployPipelinePopup: typeof import('./src/components/layout/popups/DeployPipelinePopup.vue')['default']
DocsLink: typeof import('./src/components/atomic/DocsLink.vue')['default']
@ -45,7 +43,6 @@ declare module '@vue/runtime-core' {
IIcBaselineFileDownload: typeof import('~icons/ic/baseline-file-download')['default']
IIcBaselineFileDownloadOff: typeof import('~icons/ic/baseline-file-download-off')['default']
IIcBaselineHealing: typeof import('~icons/ic/baseline-healing')['default']
IIcBaselinePause: typeof import('~icons/ic/baseline-pause')['default']
IIcBaselinePlayArrow: typeof import('~icons/ic/baseline-play-arrow')['default']
IIconoirArrowLeft: typeof import('~icons/iconoir/arrow-left')['default']
IIconParkOutlineAlarmClock: typeof import('~icons/icon-park-outline/alarm-clock')['default']

View file

@ -59,6 +59,7 @@
},
"activity": "Activity",
"branches": "Branches",
"pull_requests": "Pull requests",
"add": "Add repository",
"user_none": "This organization / user does not have any projects yet.",
"not_allowed": "You are not allowed to access this repository",
@ -226,6 +227,7 @@
"no_pipeline_steps": "No pipeline steps available!",
"step_not_started": "This step hasn't started yet.",
"pipelines_for": "Pipelines for branch \"{branch}\"",
"pipelines_for_pr": "Pipelines for pull request #{index}",
"exit_code": "exit code {exitCode}",
"loading": "Loading…",
"pipeline": "Pipeline #{pipelineId}",

View file

@ -8,6 +8,7 @@ import {
PipelineFeed,
PipelineLog,
PipelineStep,
PullRequest,
Registry,
Repo,
RepoPermissions,
@ -50,6 +51,10 @@ export default class WoodpeckerClient extends ApiClient {
return this._get(`/api/repos/${owner}/${repo}/branches`) as Promise<string[]>;
}
getRepoPullRequests(owner: string, repo: string): Promise<PullRequest[]> {
return this._get(`/api/repos/${owner}/${repo}/pull_requests`) as Promise<PullRequest[]>;
}
activateRepo(owner: string, repo: string): Promise<unknown> {
return this._post(`/api/repos/${owner}/${repo}`);
}

View file

@ -3,6 +3,7 @@ export * from './cron';
export * from './org';
export * from './pipeline';
export * from './pipelineConfig';
export * from './pull_request';
export * from './registry';
export * from './repo';
export * from './secret';

View file

@ -0,0 +1,7 @@
// A version control pull request.
export type PullRequest = {
// The index of the pull request.
index: number;
// The title of the pull request.
title: string;
};

View file

@ -73,6 +73,20 @@ const routes: RouteRecordRaw[] = [
meta: { repoHeader: true },
props: (route) => ({ branch: route.params.branch }),
},
{
path: 'pull-requests',
name: 'repo-pull-requests',
component: (): Component => import('~/views/repo/RepoPullRequests.vue'),
meta: { repoHeader: true },
props: (route) => ({ pullRequest: route.params.pullRequest }),
},
{
path: 'pull-requests/:pullRequest',
name: 'repo-pull-request',
component: (): Component => import('~/views/repo/RepoPullRequest.vue'),
meta: { repoHeader: true },
props: (route) => ({ pullRequest: route.params.pullRequest }),
},
{
path: 'pipeline/:pipelineId',
component: (): Component => import('~/views/repo/pipeline/PipelineWrapper.vue'),

View file

@ -0,0 +1,39 @@
<template>
<div class="flex w-full mb-4 justify-center">
<span class="text-color text-xl">{{ $t('repo.pipeline.pipelines_for_pr', { index: pullRequest }) }}</span>
</div>
<PipelineList :pipelines="pipelines" :repo="repo" />
</template>
<script lang="ts" setup>
import { computed, inject, Ref, toRef } from 'vue';
import PipelineList from '~/components/repo/pipeline/PipelineList.vue';
import { Pipeline, Repo, RepoPermissions } from '~/lib/api/types';
const props = defineProps({
pullRequest: {
type: String,
required: true,
},
});
const pullRequest = toRef(props, 'pullRequest');
const repo = inject<Ref<Repo>>('repo');
const repoPermissions = inject<Ref<RepoPermissions>>('repo-permissions');
if (!repo || !repoPermissions) {
throw new Error('Unexpected: "repo" and "repoPermissions" should be provided at this place');
}
const allPipelines = inject<Ref<Pipeline[]>>('pipelines');
const pipelines = computed(() =>
allPipelines?.value.filter(
(b) =>
b.event === 'pull_request' &&
b.ref
.replaceAll('refs/pull/', '')
.replaceAll('refs/merge-requests/', '')
.replaceAll('/merge', '')
.replaceAll('/head', '') === pullRequest.value,
),
);
</script>

View file

@ -0,0 +1,48 @@
<template>
<div v-if="pullRequests" class="space-y-4">
<ListItem
v-for="pullRequest in pullRequests"
:key="pullRequest.index"
class="text-color"
:to="{ name: 'repo-pull-request', params: { pullRequest: pullRequest.index } }"
>
<span class="text-color-alt <md:hidden">#{{ pullRequest.index }}</span>
<span class="text-color-alt <md:hidden mx-2">-</span>
<span class="text-color <md:underline whitespace-nowrap overflow-hidden overflow-ellipsis">{{
pullRequest.title
}}</span>
</ListItem>
</div>
</template>
<script lang="ts" setup>
import { inject, onMounted, Ref, ref, watch } from 'vue';
import ListItem from '~/components/atomic/ListItem.vue';
import useApiClient from '~/compositions/useApiClient';
import { PullRequest, Repo } from '~/lib/api/types';
const apiClient = useApiClient();
const pullRequests = ref<PullRequest[]>();
const repo = inject<Ref<Repo>>('repo');
if (!repo) {
throw new Error('Unexpected: "repo" should be provided at this place');
}
async function loadPullRequests() {
if (!repo) {
throw new Error('Unexpected: "repo" should be provided at this place');
}
pullRequests.value = await apiClient.getRepoPullRequests(repo.value.owner, repo.value.name);
}
onMounted(() => {
loadPullRequests();
});
watch(repo, () => {
loadPullRequests();
});
</script>

View file

@ -43,6 +43,11 @@
<Tab id="activity" :title="$t('repo.activity')" />
<Tab id="branches" :title="$t('repo.branches')" />
<Tab
v-if="config.forge === 'gitea' || config.forge === 'github' || config.forge === 'gitlab'"
id="pull_requests"
:title="$t('repo.pull_requests')"
/>
<router-view />
</Scaffold>
@ -89,6 +94,7 @@ const { isAuthenticated } = useAuthentication();
const route = useRoute();
const router = useRouter();
const i18n = useI18n();
const config = useConfig();
const { forge } = useConfig();
const repo = repoStore.getRepo(repoOwner, repoName);
@ -139,11 +145,16 @@ const activeTab = computed({
if (route.name === 'repo-branches' || route.name === 'repo-branch') {
return 'branches';
}
if (route.name === 'repo-pull-requests' || route.name === 'repo-pull-request') {
return 'pull_requests';
}
return 'activity';
},
set(tab: string) {
if (tab === 'branches') {
router.push({ name: 'repo-branches' });
} else if (tab === 'pull_requests') {
router.push({ name: 'repo-pull-requests' });
} else {
router.push({ name: 'repo' });
}