Skip to content

Commit c0d199d

Browse files
Enable goimport and add new makefile target to only build image without test (#123)
* enable goimport and add new makefile target to only build image without test * udpate format
1 parent f432144 commit c0d199d

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

.github/workflows/test-job.yaml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,23 @@ jobs:
6262
with:
6363
go-version: '~1.15.1'
6464

65-
- name: Set up Docker
66-
uses: docker-practice/actions-setup-docker@master
67-
6865
- name: Check out code into the Go module directory
6966
uses: actions/checkout@v2
7067
with:
7168
# When checking out the repository that
7269
# triggered a workflow, this defaults to the reference or SHA for that event.
7370
# Default value should work for both pull_request and merge(push) event.
7471
ref: ${{github.event.pull_request.head.sha}}
72+
73+
- name: Install goimports
74+
run: go get golang.org/x/tools/cmd/goimports
75+
76+
- name: Run goimports
77+
run: test -z "$(set -o pipefail && $(go env GOPATH)/bin/goimports -l . | tee goimports.out)" || { cat goimports.out && exit 1; }
78+
79+
- name: Open this to see how to fix goimports if it fails
80+
run: echo Run goimports -w .
81+
if: failure()
7582

7683
- name: list directories
7784
working-directory: ${{env.working-directory}}
@@ -90,10 +97,13 @@ jobs:
9097
run: make build
9198
working-directory: ${{env.working-directory}}
9299

93-
- name: Build Docker Image
94-
run: make docker-build
95-
working-directory: ${{env.working-directory}}
96-
97100
- name: Test
98101
run: make test
99102
working-directory: ${{env.working-directory}}
103+
104+
- name: Set up Docker
105+
uses: docker-practice/actions-setup-docker@master
106+
107+
- name: Build Docker Image
108+
run: make docker-image
109+
working-directory: ${{env.working-directory}}

apiserver/cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import (
1515
"k8s.io/klog/v2"
1616

1717
"github.com/prometheus/client_golang/prometheus/promhttp"
18-
api "github.com/ray-project/kuberay/proto/go_client"
1918
"github.com/ray-project/kuberay/apiserver/pkg/interceptor"
2019
"github.com/ray-project/kuberay/apiserver/pkg/manager"
2120
"github.com/ray-project/kuberay/apiserver/pkg/server"
21+
api "github.com/ray-project/kuberay/proto/go_client"
2222
)
2323

2424
var (

apiserver/pkg/interceptor/interceptor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package interceptor
22

33
import (
44
"context"
5+
56
"google.golang.org/grpc"
67
"k8s.io/klog/v2"
78
)

apiserver/pkg/manager/client_manager.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func (c *ClientManager) Time() util.TimeInterface {
3535
return c.time
3636
}
3737

38-
3938
func (c *ClientManager) init() {
4039
// db, kubernetes initialization
4140
klog.Info("Initializing client manager")

apiserver/pkg/server/cluster_server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package server
22

33
import (
44
"context"
5+
56
"github.com/golang/protobuf/ptypes/empty"
6-
api "github.com/ray-project/kuberay/proto/go_client"
77
"github.com/ray-project/kuberay/apiserver/pkg/manager"
88
"github.com/ray-project/kuberay/apiserver/pkg/util"
9+
api "github.com/ray-project/kuberay/proto/go_client"
910
)
1011

1112
type ClusterServerOptions struct {
@@ -42,7 +43,6 @@ func (s *ClusterServer) DeleteCluster(ctx context.Context, request *api.DeleteCl
4243
panic("Implement me")
4344
}
4445

45-
4646
func ValidateCreateClusterRequest(request *api.CreateClusterRequest) error {
4747
if request.Cluster.Name == "" {
4848
return util.NewInvalidInputError("Cluster name is empty. Please specify a valid value.")

ray-operator/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ build: generate fmt vet ## Build manager binary.
6363
run: manifests generate fmt vet ## Run a controller from your host.
6464
go run ./main.go
6565

66-
docker-build: test ## Build docker image with the manager.
66+
docker-image: ## Build image only
6767
docker build -t ${IMG} .
6868

69+
docker-build: test docker-image ## Build docker image with the manager.
70+
6971
docker-push: ## Push docker image with the manager.
7072
docker push ${IMG}
7173

0 commit comments

Comments
 (0)