mirror of
https://github.com/harness/drone.git
synced 2025-05-17 01:20:13 +08:00
address comments
This commit is contained in:
parent
1f06534259
commit
d5f121eff7
@ -25,7 +25,7 @@ func (c *Controller) Find(
|
|||||||
) (io.ReadCloser, error) {
|
) (io.ReadCloser, error) {
|
||||||
space, err := c.spaceStore.FindByRef(ctx, spaceRef)
|
space, err := c.spaceStore.FindByRef(ctx, spaceRef)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not find parent space: %w", err)
|
return nil, fmt.Errorf("failed to find parent space: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline, err := c.pipelineStore.FindByUID(ctx, space.ID, pipelineUID)
|
pipeline, err := c.pipelineStore.FindByUID(ctx, space.ID, pipelineUID)
|
||||||
|
@ -25,7 +25,7 @@ func (c *Controller) Tail(
|
|||||||
) (<-chan *livelog.Line, <-chan error, error) {
|
) (<-chan *livelog.Line, <-chan error, error) {
|
||||||
space, err := c.spaceStore.FindByRef(ctx, spaceRef)
|
space, err := c.spaceStore.FindByRef(ctx, spaceRef)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("could not find parent space: %w", err)
|
return nil, nil, fmt.Errorf("failed to find parent space: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline, err := c.pipelineStore.FindByUID(ctx, space.ID, pipelineUID)
|
pipeline, err := c.pipelineStore.FindByUID(ctx, space.ID, pipelineUID)
|
||||||
|
@ -97,7 +97,8 @@ func HandleTail(logCtrl *logs.Controller) http.HandlerFunc {
|
|||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
break L
|
break L
|
||||||
case <-errc:
|
case err := <-errc:
|
||||||
|
log.Err(err).Msg("received error in the tail channel")
|
||||||
break L
|
break L
|
||||||
case <-msgDelayTimer.C:
|
case <-msgDelayTimer.C:
|
||||||
io.WriteString(w, ": ping\n\n")
|
io.WriteString(w, ": ping\n\n")
|
||||||
|
@ -52,7 +52,7 @@ const (
|
|||||||
type stage struct {
|
type stage struct {
|
||||||
ID int64 `db:"stage_id"`
|
ID int64 `db:"stage_id"`
|
||||||
ExecutionID int64 `db:"stage_execution_id"`
|
ExecutionID int64 `db:"stage_execution_id"`
|
||||||
Number int `db:"stage_number"`
|
Number int64 `db:"stage_number"`
|
||||||
Name string `db:"stage_name"`
|
Name string `db:"stage_name"`
|
||||||
Kind string `db:"stage_kind"`
|
Kind string `db:"stage_kind"`
|
||||||
Type string `db:"stage_type"`
|
Type string `db:"stage_type"`
|
||||||
|
@ -41,7 +41,7 @@ const (
|
|||||||
type step struct {
|
type step struct {
|
||||||
ID int64 `db:"step_id"`
|
ID int64 `db:"step_id"`
|
||||||
StageID int64 `db:"step_stage_id"`
|
StageID int64 `db:"step_stage_id"`
|
||||||
Number int `db:"step_number"`
|
Number int64 `db:"step_number"`
|
||||||
Name string `db:"step_name"`
|
Name string `db:"step_name"`
|
||||||
Status string `db:"step_status"`
|
Status string `db:"step_status"`
|
||||||
Error string `db:"step_error"`
|
Error string `db:"step_error"`
|
||||||
|
@ -19,12 +19,12 @@ var WireSet = wire.NewSet(
|
|||||||
|
|
||||||
func ProvideLogStore(db *sqlx.DB, config *types.Config) store.LogStore {
|
func ProvideLogStore(db *sqlx.DB, config *types.Config) store.LogStore {
|
||||||
s := NewDatabaseLogStore(db)
|
s := NewDatabaseLogStore(db)
|
||||||
if config.S3.Bucket != "" {
|
if config.Logs.S3.Bucket != "" {
|
||||||
p := NewS3LogStore(
|
p := NewS3LogStore(
|
||||||
config.S3.Bucket,
|
config.Logs.S3.Bucket,
|
||||||
config.S3.Prefix,
|
config.Logs.S3.Prefix,
|
||||||
config.S3.Endpoint,
|
config.Logs.S3.Endpoint,
|
||||||
config.S3.PathStyle,
|
config.Logs.S3.PathStyle,
|
||||||
)
|
)
|
||||||
return NewCombined(p, s)
|
return NewCombined(p, s)
|
||||||
}
|
}
|
||||||
|
@ -90,12 +90,14 @@ type Config struct {
|
|||||||
Expire time.Duration `envconfig:"GITNESS_TOKEN_EXPIRE" default:"720h"`
|
Expire time.Duration `envconfig:"GITNESS_TOKEN_EXPIRE" default:"720h"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// S3 provides optional storage option for logs.
|
Logs struct {
|
||||||
S3 struct {
|
// S3 provides optional storage option for logs.
|
||||||
Bucket string `envconfig:"GITNESS_S3_BUCKET"`
|
S3 struct {
|
||||||
Prefix string `envconfig:"GITNESS_S3_PREFIX"`
|
Bucket string `envconfig:"GITNESS_LOGS_S3_BUCKET"`
|
||||||
Endpoint string `envconfig:"GITNESS_S3_ENDPOINT"`
|
Prefix string `envconfig:"GITNESS_LOGS_S3_PREFIX"`
|
||||||
PathStyle bool `envconfig:"GITNESS_S3_PATH_STYLE"`
|
Endpoint string `envconfig:"GITNESS_LOGS_S3_ENDPOINT"`
|
||||||
|
PathStyle bool `envconfig:"GITNESS_LOGS_S3_PATH_STYLE"`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cors defines http cors parameters
|
// Cors defines http cors parameters
|
||||||
|
@ -7,7 +7,7 @@ package types
|
|||||||
type Stage struct {
|
type Stage struct {
|
||||||
ID int64 `json:"-"`
|
ID int64 `json:"-"`
|
||||||
ExecutionID int64 `json:"execution_id"`
|
ExecutionID int64 `json:"execution_id"`
|
||||||
Number int `json:"number"`
|
Number int64 `json:"number"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Kind string `json:"kind,omitempty"`
|
Kind string `json:"kind,omitempty"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
|
@ -7,7 +7,7 @@ package types
|
|||||||
type Step struct {
|
type Step struct {
|
||||||
ID int64 `json:"-"`
|
ID int64 `json:"-"`
|
||||||
StageID int64 `json:"-"`
|
StageID int64 `json:"-"`
|
||||||
Number int `json:"number"`
|
Number int64 `json:"number"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Error string `json:"error,omitempty"`
|
Error string `json:"error,omitempty"`
|
||||||
|
Loading…
Reference in New Issue
Block a user