address comments

This commit is contained in:
Vistaar Juneja 2023-08-17 12:12:53 +01:00
parent 1f06534259
commit d5f121eff7
9 changed files with 21 additions and 18 deletions

View File

@ -25,7 +25,7 @@ func (c *Controller) Find(
) (io.ReadCloser, error) {
space, err := c.spaceStore.FindByRef(ctx, spaceRef)
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)

View File

@ -25,7 +25,7 @@ func (c *Controller) Tail(
) (<-chan *livelog.Line, <-chan error, error) {
space, err := c.spaceStore.FindByRef(ctx, spaceRef)
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)

View File

@ -97,7 +97,8 @@ func HandleTail(logCtrl *logs.Controller) http.HandlerFunc {
select {
case <-ctx.Done():
break L
case <-errc:
case err := <-errc:
log.Err(err).Msg("received error in the tail channel")
break L
case <-msgDelayTimer.C:
io.WriteString(w, ": ping\n\n")

View File

@ -52,7 +52,7 @@ const (
type stage struct {
ID int64 `db:"stage_id"`
ExecutionID int64 `db:"stage_execution_id"`
Number int `db:"stage_number"`
Number int64 `db:"stage_number"`
Name string `db:"stage_name"`
Kind string `db:"stage_kind"`
Type string `db:"stage_type"`

View File

@ -41,7 +41,7 @@ const (
type step struct {
ID int64 `db:"step_id"`
StageID int64 `db:"step_stage_id"`
Number int `db:"step_number"`
Number int64 `db:"step_number"`
Name string `db:"step_name"`
Status string `db:"step_status"`
Error string `db:"step_error"`

View File

@ -19,12 +19,12 @@ var WireSet = wire.NewSet(
func ProvideLogStore(db *sqlx.DB, config *types.Config) store.LogStore {
s := NewDatabaseLogStore(db)
if config.S3.Bucket != "" {
if config.Logs.S3.Bucket != "" {
p := NewS3LogStore(
config.S3.Bucket,
config.S3.Prefix,
config.S3.Endpoint,
config.S3.PathStyle,
config.Logs.S3.Bucket,
config.Logs.S3.Prefix,
config.Logs.S3.Endpoint,
config.Logs.S3.PathStyle,
)
return NewCombined(p, s)
}

View File

@ -90,12 +90,14 @@ type Config struct {
Expire time.Duration `envconfig:"GITNESS_TOKEN_EXPIRE" default:"720h"`
}
Logs struct {
// S3 provides optional storage option for logs.
S3 struct {
Bucket string `envconfig:"GITNESS_S3_BUCKET"`
Prefix string `envconfig:"GITNESS_S3_PREFIX"`
Endpoint string `envconfig:"GITNESS_S3_ENDPOINT"`
PathStyle bool `envconfig:"GITNESS_S3_PATH_STYLE"`
Bucket string `envconfig:"GITNESS_LOGS_S3_BUCKET"`
Prefix string `envconfig:"GITNESS_LOGS_S3_PREFIX"`
Endpoint string `envconfig:"GITNESS_LOGS_S3_ENDPOINT"`
PathStyle bool `envconfig:"GITNESS_LOGS_S3_PATH_STYLE"`
}
}
// Cors defines http cors parameters

View File

@ -7,7 +7,7 @@ package types
type Stage struct {
ID int64 `json:"-"`
ExecutionID int64 `json:"execution_id"`
Number int `json:"number"`
Number int64 `json:"number"`
Name string `json:"name"`
Kind string `json:"kind,omitempty"`
Type string `json:"type,omitempty"`

View File

@ -7,7 +7,7 @@ package types
type Step struct {
ID int64 `json:"-"`
StageID int64 `json:"-"`
Number int `json:"number"`
Number int64 `json:"number"`
Name string `json:"name"`
Status string `json:"status"`
Error string `json:"error,omitempty"`