mirror of
https://github.com/harness/drone.git
synced 2025-05-04 23:40:24 +08:00
Run make format
This commit is contained in:
parent
2d91d3acf1
commit
ef69decbde
@ -9,7 +9,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/harness/gitness/internal/api/controller/system"
|
|
||||||
|
|
||||||
cliserver "github.com/harness/gitness/cli/server"
|
cliserver "github.com/harness/gitness/cli/server"
|
||||||
"github.com/harness/gitness/encrypt"
|
"github.com/harness/gitness/encrypt"
|
||||||
@ -30,6 +29,7 @@ import (
|
|||||||
"github.com/harness/gitness/internal/api/controller/service"
|
"github.com/harness/gitness/internal/api/controller/service"
|
||||||
"github.com/harness/gitness/internal/api/controller/serviceaccount"
|
"github.com/harness/gitness/internal/api/controller/serviceaccount"
|
||||||
"github.com/harness/gitness/internal/api/controller/space"
|
"github.com/harness/gitness/internal/api/controller/space"
|
||||||
|
"github.com/harness/gitness/internal/api/controller/system"
|
||||||
"github.com/harness/gitness/internal/api/controller/template"
|
"github.com/harness/gitness/internal/api/controller/template"
|
||||||
"github.com/harness/gitness/internal/api/controller/trigger"
|
"github.com/harness/gitness/internal/api/controller/trigger"
|
||||||
"github.com/harness/gitness/internal/api/controller/user"
|
"github.com/harness/gitness/internal/api/controller/user"
|
||||||
|
@ -8,6 +8,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/harness/gitness/cli/server"
|
"github.com/harness/gitness/cli/server"
|
||||||
"github.com/harness/gitness/encrypt"
|
"github.com/harness/gitness/encrypt"
|
||||||
"github.com/harness/gitness/events"
|
"github.com/harness/gitness/events"
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/harness/gitness/types/enum"
|
"github.com/harness/gitness/types/enum"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListSecrets lists the connectors in a space.
|
// ListConnectors lists the connectors in a space.
|
||||||
func (c *Controller) ListConnectors(
|
func (c *Controller) ListConnectors(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
session *auth.Session,
|
session *auth.Session,
|
||||||
@ -30,22 +30,15 @@ func (c *Controller) ListConnectors(
|
|||||||
return nil, 0, fmt.Errorf("could not authorize: %w", err)
|
return nil, 0, fmt.Errorf("could not authorize: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var count int64
|
count, err := c.connectorStore.Count(ctx, space.ID, filter)
|
||||||
var connectors []*types.Connector
|
|
||||||
|
|
||||||
count, err = c.connectorStore.Count(ctx, space.ID, filter)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, fmt.Errorf("failed to count child executions: %w", err)
|
return nil, 0, fmt.Errorf("failed to count child executions: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
connectors, err = c.connectorStore.List(ctx, space.ID, filter)
|
connectors, err := c.connectorStore.List(ctx, space.ID, filter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, fmt.Errorf("failed to list child executions: %w", err)
|
return nil, 0, fmt.Errorf("failed to list child executions: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return connectors, count, fmt.Errorf("failed to list connectors: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return connectors, count, nil
|
return connectors, count, nil
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,12 @@ func (c *Controller) ListTemplates(
|
|||||||
return nil, 0, fmt.Errorf("could not authorize: %w", err)
|
return nil, 0, fmt.Errorf("could not authorize: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var count int64
|
count, err := c.templateStore.Count(ctx, space.ID, filter)
|
||||||
var templates []*types.Template
|
|
||||||
|
|
||||||
count, err = c.templateStore.Count(ctx, space.ID, filter)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, fmt.Errorf("failed to count templates in the space: %w", err)
|
return nil, 0, fmt.Errorf("failed to count templates in the space: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
templates, err = c.templateStore.List(ctx, space.ID, filter)
|
templates, err := c.templateStore.List(ctx, space.ID, filter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, fmt.Errorf("failed to list templates: %w", err)
|
return nil, 0, fmt.Errorf("failed to list templates: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -43,11 +43,6 @@ func (c *Controller) Create(
|
|||||||
return nil, fmt.Errorf("failed to authorize: %w", err)
|
return nil, fmt.Errorf("failed to authorize: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline, err = c.pipelineStore.IncrementSeqNum(ctx, pipeline)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to increment sequence number: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
now := time.Now().UnixMilli()
|
now := time.Now().UnixMilli()
|
||||||
trigger := &types.Trigger{
|
trigger := &types.Trigger{
|
||||||
Description: in.Description,
|
Description: in.Description,
|
||||||
|
@ -7,6 +7,7 @@ package webhook
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
apiauth "github.com/harness/gitness/internal/api/auth"
|
apiauth "github.com/harness/gitness/internal/api/auth"
|
||||||
"github.com/harness/gitness/internal/api/usererror"
|
"github.com/harness/gitness/internal/api/usererror"
|
||||||
"github.com/harness/gitness/internal/auth"
|
"github.com/harness/gitness/internal/auth"
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/harness/gitness/internal/api/render"
|
"github.com/harness/gitness/internal/api/render"
|
||||||
"github.com/harness/gitness/internal/api/request"
|
"github.com/harness/gitness/internal/api/request"
|
||||||
"github.com/harness/gitness/internal/paths"
|
"github.com/harness/gitness/internal/paths"
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,13 +7,13 @@ package database
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
|
||||||
sqlxtypes "github.com/jmoiron/sqlx/types"
|
|
||||||
|
|
||||||
"github.com/harness/gitness/internal/store"
|
"github.com/harness/gitness/internal/store"
|
||||||
"github.com/harness/gitness/store/database"
|
"github.com/harness/gitness/store/database"
|
||||||
"github.com/harness/gitness/store/database/dbtx"
|
"github.com/harness/gitness/store/database/dbtx"
|
||||||
"github.com/harness/gitness/types"
|
"github.com/harness/gitness/types"
|
||||||
|
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
|
sqlxtypes "github.com/jmoiron/sqlx/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ store.StageStore = (*stageStore)(nil)
|
var _ store.StageStore = (*stageStore)(nil)
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/harness/gitness/types"
|
||||||
|
|
||||||
sqlxtypes "github.com/jmoiron/sqlx/types"
|
sqlxtypes "github.com/jmoiron/sqlx/types"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/harness/gitness/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func mapInternalToStage(in *stage) (*types.Stage, error) {
|
func mapInternalToStage(in *stage) (*types.Stage, error) {
|
||||||
|
@ -7,13 +7,13 @@ package database
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
|
||||||
sqlxtypes "github.com/jmoiron/sqlx/types"
|
|
||||||
|
|
||||||
"github.com/harness/gitness/internal/store"
|
"github.com/harness/gitness/internal/store"
|
||||||
"github.com/harness/gitness/store/database"
|
"github.com/harness/gitness/store/database"
|
||||||
"github.com/harness/gitness/store/database/dbtx"
|
"github.com/harness/gitness/store/database/dbtx"
|
||||||
"github.com/harness/gitness/types"
|
"github.com/harness/gitness/types"
|
||||||
|
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
|
sqlxtypes "github.com/jmoiron/sqlx/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ store.StepStore = (*stepStore)(nil)
|
var _ store.StepStore = (*stepStore)(nil)
|
||||||
|
@ -8,9 +8,10 @@ import (
|
|||||||
context "context"
|
context "context"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
|
||||||
user "github.com/harness/gitness/internal/api/controller/user"
|
user "github.com/harness/gitness/internal/api/controller/user"
|
||||||
types "github.com/harness/gitness/types"
|
types "github.com/harness/gitness/types"
|
||||||
|
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockClient is a mock of Client interface.
|
// MockClient is a mock of Client interface.
|
||||||
|
@ -8,9 +8,10 @@ import (
|
|||||||
context "context"
|
context "context"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
|
||||||
types "github.com/harness/gitness/types"
|
types "github.com/harness/gitness/types"
|
||||||
enum "github.com/harness/gitness/types/enum"
|
enum "github.com/harness/gitness/types/enum"
|
||||||
|
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockPrincipalStore is a mock of PrincipalStore interface.
|
// MockPrincipalStore is a mock of PrincipalStore interface.
|
||||||
|
Loading…
Reference in New Issue
Block a user