Skip to content

Commit

Permalink
fix(api-server): report bento upload error (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone authored Aug 1, 2023
1 parent 992d3b6 commit 3e13eda
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 286 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.18' # The Go version to download (if necessary) and use.
go-version: '1.20' # The Go version to download (if necessary) and use.

- uses: actions/checkout@v3

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: 'v1.49'
version: 'v1.52.2'

helmchartslint:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-builder
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax = docker/dockerfile:1-experimental

FROM golang:1.19-alpine as base
FROM golang:1.20-alpine as base

WORKDIR /src
ENV CGO_ENABLED=0
Expand Down
10 changes: 6 additions & 4 deletions api-server/controllers/controllersv1/bento.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package controllersv1

import (
"context"
stderrors "errors"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -211,14 +212,15 @@ func (c *bentoController) Upload(ctx *gin.Context) {
uploadStatus = modelschemas.BentoUploadStatusFailed
now = time.Now()
nowPtr = &now
bento, err = services.BentoService.Update(ctx, bento, services.UpdateBentoOption{
_, err_ := services.BentoService.Update(ctx, bento, services.UpdateBentoOption{
UploadStatus: &uploadStatus,
UploadStartedAt: &nowPtr,
})
if err != nil {
abortWithError(ctx, err)
return
if err_ != nil {
err = stderrors.Join(err, err_)
}
abortWithError(ctx, err)
return
}

uploadStatus = modelschemas.BentoUploadStatusSuccess
Expand Down
10 changes: 5 additions & 5 deletions api-server/controllers/controllersv1/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ type Tail struct {
}

type tailRequest struct {
Id string `json:"id"`
TailLines *int64 `json:"tail_lines"`
ContainerName *string `json:"container_name"`
SinceTime *time.Time
Follow bool
Id string `json:"id"`
TailLines *int64 `json:"tail_lines"`
ContainerName *string `json:"container_name"`
SinceTime *time.Time `json:"since_time"`
Follow bool `json:"follow"`
}

type wsTailRequest struct {
Expand Down
10 changes: 6 additions & 4 deletions api-server/controllers/controllersv1/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package controllersv1

import (
"context"
stderrors "errors"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -179,14 +180,15 @@ func (c *modelController) Upload(ctx *gin.Context) {
uploadStatus = modelschemas.ModelUploadStatusFailed
now = time.Now()
nowPtr = &now
model, err = services.ModelService.Update(ctx, model, services.UpdateModelOption{
_, err_ := services.ModelService.Update(ctx, model, services.UpdateModelOption{
UploadStatus: &uploadStatus,
UploadStartedAt: &nowPtr,
})
if err != nil {
abortWithError(ctx, err)
return
if err_ != nil {
err = stderrors.Join(err, err_)
}
abortWithError(ctx, err)
return
}

uploadStatus = modelschemas.ModelUploadStatusSuccess
Expand Down
11 changes: 0 additions & 11 deletions api-server/main.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
package main

import (
"k8s.io/apimachinery/pkg/runtime"

grafanav1alpha1 "github.com/bentoml/grafana-operator/api/integreatly/v1alpha1"
"github.com/bentoml/yatai/api-server/cmd"
)

var (
scheme = runtime.NewScheme()
)

func init() {
_ = grafanav1alpha1.AddToScheme(scheme)
}

func main() {
cmd.Execute()
}
4 changes: 0 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.19

require (
github.com/aquasecurity/go-pep440-version v0.0.0-20210121094942-22b2f8951d46
github.com/bentoml/grafana-operator v1.4.1-0.20210927064226-14795530b647
github.com/bentoml/yatai-common v0.0.0-20230210154457-efbefe1633ab
github.com/bentoml/yatai-deployment v1.1.7-0.20230210154159-c292a9619c4f
github.com/bentoml/yatai-image-builder v1.1.1-0.20230108162700-337f26f7f704
Expand Down Expand Up @@ -55,7 +54,6 @@ require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.3.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/containerd v1.6.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down Expand Up @@ -126,7 +124,6 @@ require (
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/openshift/api v3.9.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
Expand Down Expand Up @@ -178,7 +175,6 @@ require (
)

replace (
github.com/bentoml/grafana-operator => github.com/bentoml/grafana-operator v1.4.1-0.20210927064226-14795530b647
github.com/mattn/go-ieproxy => github.com/mattn/go-ieproxy v0.0.1
github.com/moby/buildkit => github.com/moby/buildkit v0.8.3
github.com/opencontainers/runc => github.com/opencontainers/runc v1.0.0-rc92
Expand Down
Loading

0 comments on commit 3e13eda

Please sign in to comment.