diff --git a/Dockerfile.toast b/Dockerfile.toast index 1f5e33f04a..e8609586f2 100644 --- a/Dockerfile.toast +++ b/Dockerfile.toast @@ -1,7 +1,27 @@ FROM golang:1.12-alpine RUN apk update -RUN apk add protobuf protobuf-dev git wget make -RUN go get -u github.com/golang/protobuf/protoc-gen-go github.com/golang/protobuf/jsonpb github.com/golang/protobuf/proto github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway google.golang.org/grpc + +RUN apk add \ + protobuf \ + protobuf-dev \ + git \ + wget \ + make \ + nodejs \ + npm + +RUN go get -u \ + github.com/golang/protobuf/protoc-gen-go \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \ + google.golang.org/grpc \ + github.com/google/wire/cmd/wire + RUN go get golang.org/x/tools/cmd/goimports -RUN cd /tmp && wget https://github.com/grpc/grpc-web/releases/download/1.0.6/protoc-gen-grpc-web-1.0.6-linux-x86_64 && mv protoc-gen-grpc-web-1.0.6-linux-x86_64 /usr/local/bin/protoc-gen-grpc-web && chmod +x /usr/local/bin/protoc-gen-grpc-web -RUN go get -u github.com/google/wire/cmd/wire + +RUN cd /tmp && \ + wget https://github.com/grpc/grpc-web/releases/download/1.0.6/protoc-gen-grpc-web-1.0.6-linux-x86_64 && \ + mv protoc-gen-grpc-web-1.0.6-linux-x86_64 /usr/local/bin/protoc-gen-grpc-web && \ + chmod +x /usr/local/bin/protoc-gen-grpc-web + +RUN npm install -g @manifoldco/swagger-to-ts diff --git a/Makefile b/Makefile index 3a1ca2b935..8059f41cd0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all proto install lint test test-go check-js test-js integration wire-check wire ensure check-go goimports +.PHONY: all proto install lint test test-go check-js test-js integration wire-check wire ensure check-go goimports proto-webview proto-webview-ts check-go: lint errcheck verify_goimports wire-check test-go all: check-go check-js test-js @@ -23,11 +23,14 @@ scripts/protocc/protocc.py: scripts/protocc git submodule init git submodule update -toast.yaml: +proto: scripts/protocc/protocc.py + python3 scripts/protocc/protocc.py --out go + +proto-webview: toast proto -proto: scripts/protocc/protocc.py toast.yaml - python3 scripts/protocc/protocc.py --out go +proto-webview-ts: + toast proto-ts # Build a binary that uses synclet:latest install: diff --git a/internal/cli/up.go b/internal/cli/up.go index 1cdb12b55a..0d94e86277 100644 --- a/internal/cli/up.go +++ b/internal/cli/up.go @@ -13,10 +13,8 @@ import ( "golang.org/x/sync/errgroup" "k8s.io/klog" - "github.com/windmilleng/tilt/internal/engine" - "github.com/windmilleng/tilt/web" - "github.com/windmilleng/tilt/internal/analytics" + "github.com/windmilleng/tilt/internal/engine" "github.com/windmilleng/tilt/internal/hud" "github.com/windmilleng/tilt/internal/k8s" "github.com/windmilleng/tilt/internal/output" @@ -26,6 +24,7 @@ import ( "github.com/windmilleng/tilt/pkg/assets" "github.com/windmilleng/tilt/pkg/logger" "github.com/windmilleng/tilt/pkg/model" + "github.com/windmilleng/tilt/web" ) const DefaultWebPort = 10350 diff --git a/pkg/webview/view.pb.go b/pkg/webview/view.pb.go index eeb071b66b..3f3783be05 100644 --- a/pkg/webview/view.pb.go +++ b/pkg/webview/view.pb.go @@ -60,7 +60,7 @@ var xxx_messageInfo_Resource proto.InternalMessageInfo type TiltBuild struct { Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Commit_SHA string `protobuf:"bytes,2,opt,name=commit_SHA,json=commitSHA,proto3" json:"commit_SHA,omitempty"` + CommitSHA string `protobuf:"bytes,2,opt,name=commitSHA,proto3" json:"commitSHA,omitempty"` Date string `protobuf:"bytes,3,opt,name=date,proto3" json:"date,omitempty"` Dev bool `protobuf:"varint,4,opt,name=dev,proto3" json:"dev,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -100,9 +100,9 @@ func (m *TiltBuild) GetVersion() string { return "" } -func (m *TiltBuild) GetCommit_SHA() string { +func (m *TiltBuild) GetCommitSHA() string { if m != nil { - return m.Commit_SHA + return m.CommitSHA } return "" } @@ -131,7 +131,7 @@ type View struct { LatestTiltBuild *TiltBuild `protobuf:"bytes,7,opt,name=latest_tilt_build,json=latestTiltBuild,proto3" json:"latest_tilt_build,omitempty"` TiltCloudUsername string `protobuf:"bytes,8,opt,name=tilt_cloud_username,json=tiltCloudUsername,proto3" json:"tilt_cloud_username,omitempty"` TiltCloudSchemeHost string `protobuf:"bytes,9,opt,name=tilt_cloud_schemeHost,json=tiltCloudSchemeHost,proto3" json:"tilt_cloud_schemeHost,omitempty"` - TiltCloudTeam_ID string `protobuf:"bytes,10,opt,name=tilt_cloud_team_ID,json=tiltCloudTeamID,proto3" json:"tilt_cloud_team_ID,omitempty"` + TiltCloudTeamID string `protobuf:"bytes,10,opt,name=tilt_cloud_teamID,json=tiltCloudTeamID,proto3" json:"tilt_cloud_teamID,omitempty"` FatalError string `protobuf:"bytes,11,opt,name=fatal_error,json=fatalError,proto3" json:"fatal_error,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -226,9 +226,9 @@ func (m *View) GetTiltCloudSchemeHost() string { return "" } -func (m *View) GetTiltCloudTeam_ID() string { +func (m *View) GetTiltCloudTeamID() string { if m != nil { - return m.TiltCloudTeam_ID + return m.TiltCloudTeamID } return "" } @@ -282,41 +282,41 @@ func init() { func init() { proto.RegisterFile("pkg/webview/view.proto", fileDescriptor_961ad0c6909086c3) } var fileDescriptor_961ad0c6909086c3 = []byte{ - // 541 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0xcd, 0x8e, 0x12, 0x4f, - 0x10, 0x0f, 0x2c, 0xbb, 0x40, 0xf1, 0xdf, 0x0f, 0x7a, 0xf7, 0xef, 0x76, 0x36, 0x9a, 0x25, 0x24, - 0x26, 0x24, 0x26, 0x60, 0xf0, 0x62, 0x3c, 0xa8, 0x28, 0xbb,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, 0x4b, 0xc3, 0xbb, 0x21, 0x05, 0x6f, 0x38, 0x2d, 0x0c, - 0x13, 0x64, 0xe9, 0xdd, 0x90, 0x5c, 0x43, 0x63, 0xc6, 0x2c, 0x13, 0x21, 0x6a, 0xad, 0x34, 0x6d, - 0x78, 0x15, 0x78, 0xe8, 0xc6, 0x21, 0x57, 0xaf, 0xa0, 0xf9, 0xd7, 0x45, 0xb8, 0x55, 0x99, 0xe3, - 0x7a, 0xbb, 0x2a, 0x73, 0x5c, 0x93, 0x0b, 0x38, 0x5c, 0x32, 0x91, 0xa1, 0xdf, 0xc2, 0x5a, 0xb0, - 0x39, 0xbc, 0x28, 0x3f, 0x2f, 0xb5, 0xcf, 0xe0, 0xe4, 0x1d, 0x5a, 0x77, 0xa3, 0x01, 0x7e, 0xcb, - 0xd0, 0xd8, 0xfe, 0x67, 0x68, 0xb8, 0xe3, 0x18, 0xf5, 0x92, 0x47, 0x48, 0xde, 0x43, 0x35, 0x17, - 0x90, 0xcb, 0x62, 0x86, 0xf7, 0x2d, 0x57, 0xc7, 0xf7, 0x56, 0xa3, 0x7d, 0xf9, 0xfd, 0xe7, 0xef, - 0x1f, 0xe5, 0x26, 0x39, 0xf5, 0x6f, 0xc9, 0xbf, 0x1f, 0xff, 0xe2, 0xa6, 0x47, 0x3e, 0x7e, 0xf6, - 0x27, 0x00, 0x00, 0xff, 0xff, 0x16, 0x4b, 0x15, 0x78, 0x8c, 0x03, 0x00, 0x00, + // 538 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xcd, 0x6e, 0x13, 0x3d, + 0x14, 0x86, 0x95, 0x34, 0x6d, 0x92, 0x93, 0xaf, 0x3f, 0x71, 0xfb, 0x81, 0x15, 0x55, 0x6a, 0x14, + 0x09, 0x14, 0xb1, 0x98, 0x41, 0x61, 0x83, 0x58, 0x00, 0x85, 0xb6, 0x94, 0x0d, 0x8b, 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c, 0xb6, 0x3c, 0x47, 0x63, 0x59, 0xbe, 0x30, 0xbe, 0x76, 0x2b, 0x3a, + 0x16, 0x2a, 0x9b, 0x54, 0x22, 0xb9, 0x81, 0xe3, 0x19, 0x32, 0x5b, 0x68, 0x8c, 0x67, 0x82, 0x65, + 0x86, 0x36, 0x7c, 0xee, 0xab, 0x2a, 0xb7, 0xeb, 0x27, 0xb8, 0xdb, 0x20, 0x77, 0x8e, 0xb8, 0x95, + 0x56, 0xaf, 0xa3, 0xff, 0x66, 0x7b, 0x12, 0x79, 0x0e, 0x17, 0x12, 0x31, 0x8d, 0x99, 0x64, 0x62, + 0x6d, 0x79, 0x62, 0x62, 0x59, 0xa4, 0x19, 0xd2, 0x43, 0x5f, 0x92, 0x38, 0xef, 0x7a, 0x6b, 0x7d, + 0x72, 0x0e, 0x79, 0x0b, 0x44, 0x17, 0x52, 0x72, 0xe9, 0x5a, 0x14, 0x36, 0x9e, 0xba, 0xf1, 0xd2, + 0xa3, 0x7e, 0x6d, 0xd8, 0x19, 0x91, 0xaa, 0x78, 0x35, 0xf8, 0xe8, 0xac, 0xa4, 0x77, 0x4f, 0xf1, + 0x1a, 0xba, 0x82, 0x59, 0x34, 0x76, 0x3f, 0x41, 0xf3, 0x9f, 0x09, 0x4e, 0x37, 0xf0, 0x2e, 0x3e, + 0x80, 0x73, 0x1f, 0x98, 0x08, 0x55, 0xa4, 0x71, 0x61, 0x50, 0x4b, 0x96, 0x23, 0x6d, 0xf9, 0x99, + 0x77, 0x9d, 0xf5, 0xde, 0x39, 0x9f, 0x4b, 0x83, 0x8c, 0xe0, 0xff, 0x3d, 0xde, 0x24, 0x5f, 0x31, + 0xc7, 0x7b, 0x65, 0x2c, 0x6d, 0xfb, 0x88, 0xf3, 0x2a, 0x62, 0x5c, 0x59, 0xe4, 0x19, 0x74, 0xf7, + 0x62, 0x2c, 0xb2, 0xfc, 0xe3, 0x0d, 0x05, 0xcf, 0x9f, 0x56, 0xfc, 0xc4, 0xcb, 0xe4, 0x0a, 0x3a, + 0x33, 0x66, 0x99, 0x88, 0x51, 0x6b, 0xa5, 0x69, 0xc7, 0x53, 0xe0, 0xa5, 0x5b, 0xa7, 0xf4, 0xde, + 0x40, 0xf7, 0xaf, 0x77, 0x70, 0x9b, 0x32, 0xc7, 0xf5, 0x76, 0x53, 0xe6, 0xb8, 0x26, 0x17, 0x70, + 0xb8, 0x64, 0xa2, 0x40, 0xbf, 0x84, 0xad, 0x68, 0x73, 0x79, 0x55, 0x7f, 0x59, 0x1b, 0x9c, 0xc1, + 0xc9, 0x07, 0xb4, 0xee, 0x41, 0x23, 0xfc, 0x56, 0xa0, 0xb1, 0xa3, 0x05, 0x74, 0xdc, 0x75, 0x8c, + 0x7a, 0xc9, 0x13, 0x24, 0x0c, 0x9a, 0x25, 0x40, 0x1e, 0x57, 0x23, 0x7c, 0x18, 0xd2, 0x3b, 0x7e, + 0xb0, 0x19, 0x83, 0xe0, 0xfb, 0xcf, 0xdf, 0x3f, 0xea, 0x43, 0xf2, 0xd4, 0x7f, 0x49, 0xfe, 0xeb, + 0x09, 0xf7, 0x81, 0x32, 0x75, 0x58, 0x66, 0x99, 0x1e, 0x79, 0xe4, 0xc5, 0x9f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xb2, 0xe4, 0x18, 0x18, 0xa1, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/pkg/webview/view.pb.gw.go b/pkg/webview/view.pb.gw.go index 416481ff83..f48767f360 100644 --- a/pkg/webview/view.pb.gw.go +++ b/pkg/webview/view.pb.gw.go @@ -139,7 +139,7 @@ func RegisterViewServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } var ( - pattern_ViewService_GetView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "proto", "view"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_ViewService_GetView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "proto", "webview.ViewService", "GetView"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/pkg/webview/view.proto b/pkg/webview/view.proto index fab0f6cf9a..a9e342bb35 100644 --- a/pkg/webview/view.proto +++ b/pkg/webview/view.proto @@ -9,7 +9,7 @@ message Resource {} message TiltBuild { string version = 1; - string commit_SHA = 2; + string commitSHA = 2; string date = 3; bool dev = 4; } @@ -28,7 +28,7 @@ message View { string tilt_cloud_username = 8; string tilt_cloud_schemeHost = 9; - string tilt_cloud_team_ID = 10; + string tilt_cloud_teamID = 10; string fatal_error = 11; } @@ -38,7 +38,7 @@ message GetViewRequest {} service ViewService { rpc GetView(GetViewRequest) returns (View) { option (google.api.http) = { - get: "/api/proto/view" + get: "/api/proto/webview.ViewService/GetView" }; } } diff --git a/pkg/webview/view.swagger.json b/pkg/webview/view.swagger.json new file mode 100644 index 0000000000..888a6cc42f --- /dev/null +++ b/pkg/webview/view.swagger.json @@ -0,0 +1,106 @@ +{ + "swagger": "2.0", + "info": { + "title": "pkg/webview/view.proto", + "version": "version not set" + }, + "schemes": [ + "http", + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/api/proto/webview.ViewService/GetView": { + "get": { + "operationId": "GetView", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/webviewView" + } + } + }, + "tags": [ + "ViewService" + ] + } + } + }, + "definitions": { + "webviewResource": { + "type": "object", + "title": "TODO(dmiller) fill this in" + }, + "webviewTiltBuild": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "commitSHA": { + "type": "string" + }, + "date": { + "type": "string" + }, + "dev": { + "type": "boolean", + "format": "boolean" + } + } + }, + "webviewView": { + "type": "object", + "properties": { + "log": { + "type": "string" + }, + "resources": { + "type": "array", + "items": { + "$ref": "#/definitions/webviewResource" + } + }, + "log_timestamps": { + "type": "boolean", + "format": "boolean" + }, + "feature_flags": { + "type": "object", + "additionalProperties": { + "type": "boolean", + "format": "boolean" + } + }, + "need_analytics_nudge": { + "type": "boolean", + "format": "boolean" + }, + "running_tilt_build": { + "$ref": "#/definitions/webviewTiltBuild" + }, + "latest_tilt_build": { + "$ref": "#/definitions/webviewTiltBuild" + }, + "tilt_cloud_username": { + "type": "string" + }, + "tilt_cloud_schemeHost": { + "type": "string" + }, + "tilt_cloud_teamID": { + "type": "string" + }, + "fatal_error": { + "type": "string" + } + } + } + } +} diff --git a/toast.yml b/toast.yml index a352860baf..5f1a0c4ff9 100644 --- a/toast.yml +++ b/toast.yml @@ -1,4 +1,4 @@ -image: gcr.io/windmill-public-containers/tilt-toast@sha256:232b4f5b187da1bedc3bd6fcc0d07a8d33c169fa9430ac0105da7efb5a65ca9f +image: gcr.io/windmill-public-containers/tilt-toast@sha256:f3dc747f3861ae274b72943ea511a46e9e760928507191fb8179480ae804933d tasks: proto: input_paths: @@ -6,7 +6,30 @@ tasks: output_paths: - pkg/webview/view.pb.go - pkg/webview/view.pb.gw.go - command: protoc -I. -I/usr/include -I"$(go env GOPATH)"/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --grpc-gateway_out=logtostderr=true:. --go_out=plugins=grpc,paths=source_relative:. pkg/webview/view.proto && goimports -local github.com/windmilleng/tft -w pkg/webview/view.pb.go + - pkg/webview/view.swagger.json + command: | + set -euo pipefail + mkdir -p web/src + protoc \ + -I. \ + -I/usr/include \ + -I"$(go env GOPATH)"/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ + --grpc-gateway_out=logtostderr=true:. \ + --swagger_out=logtostderr=true:. \ + --go_out=plugins=grpc,paths=source_relative:. \ + pkg/webview/view.proto + goimports -local github.com/windmilleng/tilt -w pkg/webview/view.pb.go + + proto-ts: + dependencies: + - proto + input_paths: + - pkg/webview/view.swagger.json + output_paths: + - web/src/view.d.ts + command: | + npx @manifoldco/swagger-to-ts pkg/webview/view.swagger.json --camelcase --output web/src/view.d.ts + wire: location: /go/src/github.com/windmilleng/tilt input_paths: diff --git a/web/src/view.d.ts b/web/src/view.d.ts new file mode 100644 index 0000000000..c328354b5d --- /dev/null +++ b/web/src/view.d.ts @@ -0,0 +1,22 @@ +declare namespace OpenAPI2 { + export interface webviewView { + log?: string; + resources?: webviewResource[]; + logTimestamps?: boolean; + featureFlags?: object; + needAnalyticsNudge?: boolean; + runningTiltBuild?: webviewTiltBuild; + latestTiltBuild?: webviewTiltBuild; + tiltCloudUsername?: string; + tiltCloudSchemeHost?: string; + tiltCloudTeamID?: string; + fatalError?: string; + } + export interface webviewTiltBuild { + version?: string; + commitSHA?: string; + date?: string; + dev?: boolean; + } + export interface webviewResource {} +}