From 1dcb0295ff6ca391766a7484f4bc573e2d545b87 Mon Sep 17 00:00:00 2001 From: Gero Posmyk-Leinemann Date: Wed, 8 Sep 2021 15:25:30 +0000 Subject: [PATCH 1/3] [test] Ensure image builds preserve environment variables --- test/pkg/integration/workspace.go | 92 +++++++++++--------- test/tests/workspace/workspace_image_test.go | 72 +++++++++++++++ 2 files changed, 123 insertions(+), 41 deletions(-) create mode 100644 test/tests/workspace/workspace_image_test.go diff --git a/test/pkg/integration/workspace.go b/test/pkg/integration/workspace.go index 7d89e8a018549c..34aaceee84800a 100644 --- a/test/pkg/integration/workspace.go +++ b/test/pkg/integration/workspace.go @@ -31,10 +31,12 @@ const ( ) type launchWorkspaceDirectlyOptions struct { - BaseImage string - IdeImage string - Mods []func(*wsmanapi.StartWorkspaceRequest) error - WaitForOpts []WaitForWorkspaceOpt + BaseImage string + WorkspaceImageRequest *imgbldr.ResolveWorkspaceImageRequest + ImgBldrOpts []APIImageBuilderOpt + IdeImage string + Mods []func(*wsmanapi.StartWorkspaceRequest) error + WaitForOpts []WaitForWorkspaceOpt } // LaunchWorkspaceDirectlyOpt configures the behaviour of LaunchWorkspaceDirectly @@ -52,7 +54,7 @@ func WithoutWorkspaceImage() LaunchWorkspaceDirectlyOpt { // WithBaseImage configures the base image used to start the workspace. The base image // will be resolved to a workspace image using the image builder. If the corresponding -// workspace image isn't built yet, it will NOT be built. +// workspace image isn't built yet, it will be built. func WithBaseImage(baseImage string) LaunchWorkspaceDirectlyOpt { return func(lwdo *launchWorkspaceDirectlyOptions) error { lwdo.BaseImage = baseImage @@ -86,6 +88,22 @@ func WithWaitWorkspaceForOpts(opt ...WaitForWorkspaceOpt) LaunchWorkspaceDirectl } } +// WithWorkspaceImageRequest is a more complete alternative to WithBaseImage +func WithWorkspaceImageRequest(req *imgbldr.ResolveWorkspaceImageRequest) LaunchWorkspaceDirectlyOpt { + return func(lwdo *launchWorkspaceDirectlyOptions) error { + lwdo.WorkspaceImageRequest = req + return nil + } +} + +// WithImageBuilderOpts allows to pass options to ImageBuilder(opts) +func WithImageBuilderOpts(opts ...APIImageBuilderOpt) LaunchWorkspaceDirectlyOpt { + return func(lwdo *launchWorkspaceDirectlyOptions) error { + lwdo.ImgBldrOpts = opts + return nil + } +} + // LaunchWorkspaceDirectlyResult is returned by LaunchWorkspaceDirectly type LaunchWorkspaceDirectlyResult struct { Req *wsmanapi.StartWorkspaceRequest @@ -120,12 +138,29 @@ func LaunchWorkspaceDirectly(it *Test, opts ...LaunchWorkspaceDirectlyOpt) (res } var workspaceImage string - if options.BaseImage != "" { - workspaceImage, err = it.resolveOrBuildImage(options.BaseImage) - if err != nil { - it.t.Fatalf("cannot resolve base image: %v", err) - return - } + if options.WorkspaceImageRequest != nil { + workspaceImage, err = it.resolveOrBuildImage(options.WorkspaceImageRequest, options.ImgBldrOpts...) + } else if options.BaseImage != "" { + workspaceImage, err = it.resolveOrBuildImage(&imgbldr.ResolveWorkspaceImageRequest{ + Source: &imgbldr.BuildSource{ + From: &imgbldr.BuildSource_Ref{ + Ref: &imgbldr.BuildSourceReference{ + Ref: options.BaseImage, + }, + }, + }, + Auth: &imgbldr.BuildRegistryAuth{ + Mode: &imgbldr.BuildRegistryAuth_Total{ + Total: &imgbldr.BuildRegistryAuthTotal{ + AllowAll: true, + }, + }, + }, + }, options.ImgBldrOpts...) + } + if err != nil { + it.t.Fatalf("cannot resolve base image: %v", err) + return } ideImage := options.IdeImage @@ -512,25 +547,10 @@ func (it *Test) WaitForWorkspace(instanceID string, condition func(status *wsman } } -func (it *Test) resolveOrBuildImage(baseRef string) (absref string, err error) { +func (it *Test) resolveOrBuildImage(req *imgbldr.ResolveWorkspaceImageRequest, imgbldrOpts ...APIImageBuilderOpt) (absref string, err error) { rctx, rcancel := context.WithTimeout(it.ctx, perCallTimeout) - cl := it.API().ImageBuilder() - reslv, err := cl.ResolveWorkspaceImage(rctx, &imgbldr.ResolveWorkspaceImageRequest{ - Source: &imgbldr.BuildSource{ - From: &imgbldr.BuildSource_Ref{ - Ref: &imgbldr.BuildSourceReference{ - Ref: baseRef, - }, - }, - }, - Auth: &imgbldr.BuildRegistryAuth{ - Mode: &imgbldr.BuildRegistryAuth_Total{ - Total: &imgbldr.BuildRegistryAuthTotal{ - AllowAll: true, - }, - }, - }, - }) + cl := it.API().ImageBuilder(imgbldrOpts...) + reslv, err := cl.ResolveWorkspaceImage(rctx, req) rcancel() if err != nil { return @@ -546,19 +566,9 @@ func (it *Test) resolveOrBuildImage(baseRef string) (absref string, err error) { defer rcancel() bld, err := cl.Build(rctx, &imgbldr.BuildRequest{ Source: &imgbldr.BuildSource{ - From: &imgbldr.BuildSource_Ref{ - Ref: &imgbldr.BuildSourceReference{ - Ref: baseRef, - }, - }, - }, - Auth: &imgbldr.BuildRegistryAuth{ - Mode: &imgbldr.BuildRegistryAuth_Total{ - Total: &imgbldr.BuildRegistryAuthTotal{ - AllowAll: true, - }, - }, + From: req.Source.From, }, + Auth: req.Auth, }) if err != nil { return diff --git a/test/tests/workspace/workspace_image_test.go b/test/tests/workspace/workspace_image_test.go new file mode 100644 index 00000000000000..8ed3643ab54af7 --- /dev/null +++ b/test/tests/workspace/workspace_image_test.go @@ -0,0 +1,72 @@ +// Copyright (c) 2021 Gitpod GmbH. All rights reserved. +// Licensed under the GNU Affero General Public License (AGPL). +// See License-AGPL.txt in the project root for license information. + +package workspace_test + +import ( + "strings" + "testing" + "time" + + csapi "github.com/gitpod-io/gitpod/content-service/api" + imgapi "github.com/gitpod-io/gitpod/image-builder/api" + "github.com/gitpod-io/gitpod/test/pkg/integration" + agent "github.com/gitpod-io/gitpod/test/tests/workspace/workspace_agent/api" + "github.com/gitpod-io/gitpod/ws-manager/api" +) + +func TestImageBuildPreservesEnvVarMk3(t *testing.T) { + it, ctx := integration.NewTest(t, 5*time.Minute) + defer it.Done() + + res := integration.LaunchWorkspaceDirectly(it, integration.WithWorkspaceImageRequest(&imgapi.ResolveWorkspaceImageRequest{ + Source: &imgapi.BuildSource{ + From: &imgapi.BuildSource_File{ + File: &imgapi.BuildSourceDockerfile{ + DockerfileVersion: "some-version", + DockerfilePath: ".gitpod.Dockerfile", + ContextPath: ".", + Source: &csapi.WorkspaceInitializer{ + Spec: &csapi.WorkspaceInitializer_Git{ + Git: &csapi.GitInitializer{ + RemoteUri: "https://github.com/gitpod-io/gitpod-test-repo.git", + TargetMode: csapi.CloneTargetMode_REMOTE_BRANCH, + // this branch has a docker file that adds 'MY_TEST_ENV_VAR=asd' as env var (ref: https://github.com/gitpod-io/gitpod-test-repo/blob/integration-test/imgbldr/env-is-persisted/.gitpod.Dockerfile#L3) + CloneTaget: "integration-test/imgbldr/env-is-persisted", + Config: &csapi.GitConfig{ + Authentication: csapi.GitAuthMethod_NO_AUTH, + }, + }, + }, + }, + }, + }, + }, + }), integration.WithImageBuilderOpts(integration.SelectImageBuilderMK3)) + defer it.API().WorkspaceManager().StopWorkspace(ctx, &api.StopWorkspaceRequest{ + Id: res.Req.Id, + }) + + rsa, err := it.Instrument(integration.ComponentWorkspace, "workspace", integration.WithInstanceID(res.Req.Id)) + if err != nil { + t.Fatal(err) + } + defer rsa.Close() + + var resp agent.ExecResponse + err = rsa.Call("WorkspaceAgent.Exec", &agent.ExecRequest{ + Dir: "/workspace", + Command: "bash", + Args: []string{"-c", "echo $MY_TEST_ENV_VAR"}, + }, &resp) + if err != nil { + t.Fatal(err) + } + if resp.ExitCode != 0 { + t.Fatalf("got non-zero exit code: %d", resp.ExitCode) + } + if strings.TrimSpace(resp.Stdout) == "" { + t.Fatalf("env var MY_TEST_ENV_VAR is not preserved!") + } +} From 793fc846a20facf78a61cbc0e847f11e77911a0c Mon Sep 17 00:00:00 2001 From: Gero Posmyk-Leinemann Date: Wed, 15 Sep 2021 11:41:16 +0000 Subject: [PATCH 2/3] [content] FilesInitializer --- components/content-service-api/go/blobs.pb.go | 4 +- .../content-service-api/go/content.pb.go | 4 +- .../content-service-api/go/headless-log.pb.go | 4 +- .../content-service-api/go/ideplugin.pb.go | 4 +- .../content-service-api/go/initializer.pb.go | 534 ++++++++++++------ .../content-service-api/go/workspace.pb.go | 4 +- .../content-service-api/initializer.proto | 15 + .../typescript/src/initializer_pb.d.ts | 57 ++ .../typescript/src/initializer_pb.js | 452 ++++++++++++++- .../content-service/pkg/initializer/files.go | 66 +++ .../pkg/initializer/initializer.go | 16 + components/gitpod-protocol/src/wsready.ts | 11 - 12 files changed, 967 insertions(+), 204 deletions(-) create mode 100644 components/content-service/pkg/initializer/files.go diff --git a/components/content-service-api/go/blobs.pb.go b/components/content-service-api/go/blobs.pb.go index 94c25043ed6205..d2159ec7b17541 100644 --- a/components/content-service-api/go/blobs.pb.go +++ b/components/content-service-api/go/blobs.pb.go @@ -4,8 +4,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.5 +// protoc-gen-go v1.27.1 +// protoc v3.17.3 // source: blobs.proto package api diff --git a/components/content-service-api/go/content.pb.go b/components/content-service-api/go/content.pb.go index de4468c4a471ed..bf476ed89d1347 100644 --- a/components/content-service-api/go/content.pb.go +++ b/components/content-service-api/go/content.pb.go @@ -4,8 +4,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.5 +// protoc-gen-go v1.27.1 +// protoc v3.17.3 // source: content.proto package api diff --git a/components/content-service-api/go/headless-log.pb.go b/components/content-service-api/go/headless-log.pb.go index 1e696f926a9792..c0f53410aeb8ea 100644 --- a/components/content-service-api/go/headless-log.pb.go +++ b/components/content-service-api/go/headless-log.pb.go @@ -4,8 +4,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.5 +// protoc-gen-go v1.27.1 +// protoc v3.17.3 // source: headless-log.proto package api diff --git a/components/content-service-api/go/ideplugin.pb.go b/components/content-service-api/go/ideplugin.pb.go index a7237a0ae07946..7f10826dcb6d8f 100644 --- a/components/content-service-api/go/ideplugin.pb.go +++ b/components/content-service-api/go/ideplugin.pb.go @@ -4,8 +4,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.5 +// protoc-gen-go v1.27.1 +// protoc v3.17.3 // source: ideplugin.proto package api diff --git a/components/content-service-api/go/initializer.pb.go b/components/content-service-api/go/initializer.pb.go index e86fac1ac56bf4..c4e729eaefb354 100644 --- a/components/content-service-api/go/initializer.pb.go +++ b/components/content-service-api/go/initializer.pb.go @@ -4,8 +4,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.5 +// protoc-gen-go v1.27.1 +// protoc v3.17.3 // source: initializer.proto package api @@ -149,6 +149,7 @@ type WorkspaceInitializer struct { // *WorkspaceInitializer_Composite // *WorkspaceInitializer_Download // *WorkspaceInitializer_Backup + // *WorkspaceInitializer_Files Spec isWorkspaceInitializer_Spec `protobuf_oneof:"spec"` } @@ -240,6 +241,13 @@ func (x *WorkspaceInitializer) GetBackup() *FromBackupInitializer { return nil } +func (x *WorkspaceInitializer) GetFiles() *FilesInitializer { + if x, ok := x.GetSpec().(*WorkspaceInitializer_Files); ok { + return x.Files + } + return nil +} + type isWorkspaceInitializer_Spec interface { isWorkspaceInitializer_Spec() } @@ -272,6 +280,10 @@ type WorkspaceInitializer_Backup struct { Backup *FromBackupInitializer `protobuf:"bytes,7,opt,name=backup,proto3,oneof"` } +type WorkspaceInitializer_Files struct { + Files *FilesInitializer `protobuf:"bytes,8,opt,name=files,proto3,oneof"` +} + func (*WorkspaceInitializer_Empty) isWorkspaceInitializer_Spec() {} func (*WorkspaceInitializer_Git) isWorkspaceInitializer_Spec() {} @@ -286,6 +298,8 @@ func (*WorkspaceInitializer_Download) isWorkspaceInitializer_Spec() {} func (*WorkspaceInitializer_Backup) isWorkspaceInitializer_Spec() {} +func (*WorkspaceInitializer_Files) isWorkspaceInitializer_Spec() {} + // CompositeInitializer uses a collection of initializer to produce workspace content. // All initializer are executed in the order they're provided. type CompositeInitializer struct { @@ -335,6 +349,62 @@ func (x *CompositeInitializer) GetInitializer() []*WorkspaceInitializer { return nil } +// FilesInitializer takes raw files bytes and uses them as workspace content. +type FilesInitializer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Files []*FilesInitializer_File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` + TargetLocation string `protobuf:"bytes,2,opt,name=target_location,json=targetLocation,proto3" json:"target_location,omitempty"` +} + +func (x *FilesInitializer) Reset() { + *x = FilesInitializer{} + if protoimpl.UnsafeEnabled { + mi := &file_initializer_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FilesInitializer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FilesInitializer) ProtoMessage() {} + +func (x *FilesInitializer) ProtoReflect() protoreflect.Message { + mi := &file_initializer_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FilesInitializer.ProtoReflect.Descriptor instead. +func (*FilesInitializer) Descriptor() ([]byte, []int) { + return file_initializer_proto_rawDescGZIP(), []int{2} +} + +func (x *FilesInitializer) GetFiles() []*FilesInitializer_File { + if x != nil { + return x.Files + } + return nil +} + +func (x *FilesInitializer) GetTargetLocation() string { + if x != nil { + return x.TargetLocation + } + return "" +} + // FileDownloadInitializer downloads files and uses them as workspace content. type FileDownloadInitializer struct { state protoimpl.MessageState @@ -348,7 +418,7 @@ type FileDownloadInitializer struct { func (x *FileDownloadInitializer) Reset() { *x = FileDownloadInitializer{} if protoimpl.UnsafeEnabled { - mi := &file_initializer_proto_msgTypes[2] + mi := &file_initializer_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -361,7 +431,7 @@ func (x *FileDownloadInitializer) String() string { func (*FileDownloadInitializer) ProtoMessage() {} func (x *FileDownloadInitializer) ProtoReflect() protoreflect.Message { - mi := &file_initializer_proto_msgTypes[2] + mi := &file_initializer_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -374,7 +444,7 @@ func (x *FileDownloadInitializer) ProtoReflect() protoreflect.Message { // Deprecated: Use FileDownloadInitializer.ProtoReflect.Descriptor instead. func (*FileDownloadInitializer) Descriptor() ([]byte, []int) { - return file_initializer_proto_rawDescGZIP(), []int{2} + return file_initializer_proto_rawDescGZIP(), []int{3} } func (x *FileDownloadInitializer) GetFiles() []*FileDownloadInitializer_FileInfo { @@ -400,7 +470,7 @@ type EmptyInitializer struct { func (x *EmptyInitializer) Reset() { *x = EmptyInitializer{} if protoimpl.UnsafeEnabled { - mi := &file_initializer_proto_msgTypes[3] + mi := &file_initializer_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -413,7 +483,7 @@ func (x *EmptyInitializer) String() string { func (*EmptyInitializer) ProtoMessage() {} func (x *EmptyInitializer) ProtoReflect() protoreflect.Message { - mi := &file_initializer_proto_msgTypes[3] + mi := &file_initializer_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -426,7 +496,7 @@ func (x *EmptyInitializer) ProtoReflect() protoreflect.Message { // Deprecated: Use EmptyInitializer.ProtoReflect.Descriptor instead. func (*EmptyInitializer) Descriptor() ([]byte, []int) { - return file_initializer_proto_rawDescGZIP(), []int{3} + return file_initializer_proto_rawDescGZIP(), []int{4} } type GitInitializer struct { @@ -451,7 +521,7 @@ type GitInitializer struct { func (x *GitInitializer) Reset() { *x = GitInitializer{} if protoimpl.UnsafeEnabled { - mi := &file_initializer_proto_msgTypes[4] + mi := &file_initializer_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -464,7 +534,7 @@ func (x *GitInitializer) String() string { func (*GitInitializer) ProtoMessage() {} func (x *GitInitializer) ProtoReflect() protoreflect.Message { - mi := &file_initializer_proto_msgTypes[4] + mi := &file_initializer_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -477,7 +547,7 @@ func (x *GitInitializer) ProtoReflect() protoreflect.Message { // Deprecated: Use GitInitializer.ProtoReflect.Descriptor instead. func (*GitInitializer) Descriptor() ([]byte, []int) { - return file_initializer_proto_rawDescGZIP(), []int{4} + return file_initializer_proto_rawDescGZIP(), []int{5} } func (x *GitInitializer) GetRemoteUri() string { @@ -543,7 +613,7 @@ type GitConfig struct { func (x *GitConfig) Reset() { *x = GitConfig{} if protoimpl.UnsafeEnabled { - mi := &file_initializer_proto_msgTypes[5] + mi := &file_initializer_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -556,7 +626,7 @@ func (x *GitConfig) String() string { func (*GitConfig) ProtoMessage() {} func (x *GitConfig) ProtoReflect() protoreflect.Message { - mi := &file_initializer_proto_msgTypes[5] + mi := &file_initializer_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -569,7 +639,7 @@ func (x *GitConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use GitConfig.ProtoReflect.Descriptor instead. func (*GitConfig) Descriptor() ([]byte, []int) { - return file_initializer_proto_rawDescGZIP(), []int{5} + return file_initializer_proto_rawDescGZIP(), []int{6} } func (x *GitConfig) GetCustomConfig() map[string]string { @@ -619,7 +689,7 @@ type SnapshotInitializer struct { func (x *SnapshotInitializer) Reset() { *x = SnapshotInitializer{} if protoimpl.UnsafeEnabled { - mi := &file_initializer_proto_msgTypes[6] + mi := &file_initializer_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -632,7 +702,7 @@ func (x *SnapshotInitializer) String() string { func (*SnapshotInitializer) ProtoMessage() {} func (x *SnapshotInitializer) ProtoReflect() protoreflect.Message { - mi := &file_initializer_proto_msgTypes[6] + mi := &file_initializer_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -645,7 +715,7 @@ func (x *SnapshotInitializer) ProtoReflect() protoreflect.Message { // Deprecated: Use SnapshotInitializer.ProtoReflect.Descriptor instead. func (*SnapshotInitializer) Descriptor() ([]byte, []int) { - return file_initializer_proto_rawDescGZIP(), []int{6} + return file_initializer_proto_rawDescGZIP(), []int{7} } func (x *SnapshotInitializer) GetSnapshot() string { @@ -669,7 +739,7 @@ type PrebuildInitializer struct { func (x *PrebuildInitializer) Reset() { *x = PrebuildInitializer{} if protoimpl.UnsafeEnabled { - mi := &file_initializer_proto_msgTypes[7] + mi := &file_initializer_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -682,7 +752,7 @@ func (x *PrebuildInitializer) String() string { func (*PrebuildInitializer) ProtoMessage() {} func (x *PrebuildInitializer) ProtoReflect() protoreflect.Message { - mi := &file_initializer_proto_msgTypes[7] + mi := &file_initializer_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -695,7 +765,7 @@ func (x *PrebuildInitializer) ProtoReflect() protoreflect.Message { // Deprecated: Use PrebuildInitializer.ProtoReflect.Descriptor instead. func (*PrebuildInitializer) Descriptor() ([]byte, []int) { - return file_initializer_proto_rawDescGZIP(), []int{7} + return file_initializer_proto_rawDescGZIP(), []int{8} } func (x *PrebuildInitializer) GetPrebuild() *SnapshotInitializer { @@ -722,7 +792,7 @@ type FromBackupInitializer struct { func (x *FromBackupInitializer) Reset() { *x = FromBackupInitializer{} if protoimpl.UnsafeEnabled { - mi := &file_initializer_proto_msgTypes[8] + mi := &file_initializer_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -735,7 +805,7 @@ func (x *FromBackupInitializer) String() string { func (*FromBackupInitializer) ProtoMessage() {} func (x *FromBackupInitializer) ProtoReflect() protoreflect.Message { - mi := &file_initializer_proto_msgTypes[8] + mi := &file_initializer_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -748,7 +818,7 @@ func (x *FromBackupInitializer) ProtoReflect() protoreflect.Message { // Deprecated: Use FromBackupInitializer.ProtoReflect.Descriptor instead. func (*FromBackupInitializer) Descriptor() ([]byte, []int) { - return file_initializer_proto_rawDescGZIP(), []int{8} + return file_initializer_proto_rawDescGZIP(), []int{9} } // GitStatus describes the current Git working copy status, akin to a combination of "git status" and "git branch" @@ -778,7 +848,7 @@ type GitStatus struct { func (x *GitStatus) Reset() { *x = GitStatus{} if protoimpl.UnsafeEnabled { - mi := &file_initializer_proto_msgTypes[9] + mi := &file_initializer_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -791,7 +861,7 @@ func (x *GitStatus) String() string { func (*GitStatus) ProtoMessage() {} func (x *GitStatus) ProtoReflect() protoreflect.Message { - mi := &file_initializer_proto_msgTypes[9] + mi := &file_initializer_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -804,7 +874,7 @@ func (x *GitStatus) ProtoReflect() protoreflect.Message { // Deprecated: Use GitStatus.ProtoReflect.Descriptor instead. func (*GitStatus) Descriptor() ([]byte, []int) { - return file_initializer_proto_rawDescGZIP(), []int{9} + return file_initializer_proto_rawDescGZIP(), []int{10} } func (x *GitStatus) GetBranch() string { @@ -863,6 +933,65 @@ func (x *GitStatus) GetTotalUnpushedCommits() int64 { return 0 } +type FilesInitializer_File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + // file_path is relative to the target_location, e.g. if target_location is in `/workspace/myrepo` + // a file_path of `foobar/file` would produce a file in `/workspace/myrepo/foobar/file`. + // file_path must include the filename. The FileDownloadInitializer will create any parent directories + // necessary to place the file. + FilePath string `protobuf:"bytes,2,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` +} + +func (x *FilesInitializer_File) Reset() { + *x = FilesInitializer_File{} + if protoimpl.UnsafeEnabled { + mi := &file_initializer_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FilesInitializer_File) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FilesInitializer_File) ProtoMessage() {} + +func (x *FilesInitializer_File) ProtoReflect() protoreflect.Message { + mi := &file_initializer_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FilesInitializer_File.ProtoReflect.Descriptor instead. +func (*FilesInitializer_File) Descriptor() ([]byte, []int) { + return file_initializer_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *FilesInitializer_File) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *FilesInitializer_File) GetFilePath() string { + if x != nil { + return x.FilePath + } + return "" +} + type FileDownloadInitializer_FileInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -883,7 +1012,7 @@ type FileDownloadInitializer_FileInfo struct { func (x *FileDownloadInitializer_FileInfo) Reset() { *x = FileDownloadInitializer_FileInfo{} if protoimpl.UnsafeEnabled { - mi := &file_initializer_proto_msgTypes[10] + mi := &file_initializer_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -896,7 +1025,7 @@ func (x *FileDownloadInitializer_FileInfo) String() string { func (*FileDownloadInitializer_FileInfo) ProtoMessage() {} func (x *FileDownloadInitializer_FileInfo) ProtoReflect() protoreflect.Message { - mi := &file_initializer_proto_msgTypes[10] + mi := &file_initializer_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -909,7 +1038,7 @@ func (x *FileDownloadInitializer_FileInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use FileDownloadInitializer_FileInfo.ProtoReflect.Descriptor instead. func (*FileDownloadInitializer_FileInfo) Descriptor() ([]byte, []int) { - return file_initializer_proto_rawDescGZIP(), []int{2, 0} + return file_initializer_proto_rawDescGZIP(), []int{3, 0} } func (x *FileDownloadInitializer_FileInfo) GetUrl() string { @@ -938,7 +1067,7 @@ var File_initializer_proto protoreflect.FileDescriptor var file_initializer_proto_rawDesc = []byte{ 0x0a, 0x11, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x22, 0xe0, 0x03, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x69, 0x63, 0x65, 0x22, 0x9a, 0x04, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x05, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, @@ -967,117 +1096,133 @@ var file_initializer_proto_rawDesc = []byte{ 0x06, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, - 0x69, 0x7a, 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x42, 0x06, - 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x5e, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x46, - 0x0a, 0x0b, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x6e, - 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x0b, 0x69, 0x6e, 0x69, 0x74, 0x69, - 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x22, 0xdd, 0x01, 0x0a, 0x17, 0x46, 0x69, 0x6c, 0x65, 0x44, - 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, - 0x65, 0x72, 0x12, 0x46, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x49, - 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x1a, 0x51, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, - 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, - 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x49, - 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x22, 0xa2, 0x02, 0x0a, 0x0e, 0x47, - 0x69, 0x74, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x1d, 0x0a, - 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x55, 0x72, 0x69, 0x12, 0x2e, 0x0a, 0x13, - 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, - 0x75, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x75, 0x70, 0x73, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x55, 0x72, 0x69, 0x12, 0x40, 0x0a, 0x0b, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x6e, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x6f, - 0x64, 0x65, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x63, 0x6c, 0x6f, 0x6e, 0x65, 0x5f, 0x74, 0x61, 0x67, 0x65, 0x74, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6c, 0x6f, 0x6e, 0x65, 0x54, 0x61, 0x67, 0x65, 0x74, 0x12, - 0x2b, 0x0a, 0x11, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x68, 0x65, 0x63, - 0x6b, 0x6f, 0x75, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x06, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x69, - 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, - 0xc2, 0x02, 0x0a, 0x09, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x50, 0x0a, - 0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x45, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x69, 0x74, 0x41, 0x75, 0x74, 0x68, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x75, - 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x55, - 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x75, 0x74, 0x68, - 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, - 0x5f, 0x6f, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x75, 0x74, 0x68, - 0x4f, 0x74, 0x73, 0x1a, 0x3f, 0x0a, 0x11, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0x31, 0x0a, 0x13, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, - 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x73, - 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, - 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x22, 0x88, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x65, 0x62, - 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x12, - 0x3f, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x49, 0x6e, 0x69, 0x74, 0x69, - 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, - 0x12, 0x30, 0x0a, 0x03, 0x67, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, - 0x69, 0x74, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x03, 0x67, - 0x69, 0x74, 0x22, 0x17, 0x0a, 0x15, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, - 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x22, 0xe7, 0x02, 0x0a, 0x09, - 0x47, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x72, 0x61, - 0x6e, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, - 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, - 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0f, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, - 0x73, 0x12, 0x34, 0x0a, 0x16, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x75, 0x6e, 0x63, 0x6f, 0x6d, - 0x6d, 0x69, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x14, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, - 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x75, 0x6e, 0x74, 0x72, 0x61, - 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0e, 0x75, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, - 0x12, 0x32, 0x0a, 0x15, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x75, 0x6e, 0x74, 0x72, 0x61, 0x63, - 0x6b, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x13, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x55, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x46, - 0x69, 0x6c, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x75, 0x6e, 0x70, 0x75, 0x73, 0x68, 0x65, 0x64, - 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, - 0x75, 0x6e, 0x70, 0x75, 0x73, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12, - 0x34, 0x0a, 0x16, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x75, 0x6e, 0x70, 0x75, 0x73, 0x68, 0x65, - 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x14, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x55, 0x6e, 0x70, 0x75, 0x73, 0x68, 0x65, 0x64, 0x43, 0x6f, - 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x2a, 0x5a, 0x0a, 0x0f, 0x43, 0x6c, 0x6f, 0x6e, 0x65, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x45, 0x4d, 0x4f, - 0x54, 0x45, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x45, 0x4d, - 0x4f, 0x54, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x49, 0x54, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, - 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x5f, 0x42, 0x52, 0x41, 0x4e, 0x43, 0x48, 0x10, 0x02, 0x12, - 0x10, 0x0a, 0x0c, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x5f, 0x42, 0x52, 0x41, 0x4e, 0x43, 0x48, 0x10, - 0x03, 0x2a, 0x40, 0x0a, 0x0d, 0x47, 0x69, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x5f, 0x41, 0x55, 0x54, 0x48, 0x10, 0x00, 0x12, - 0x0e, 0x0a, 0x0a, 0x42, 0x41, 0x53, 0x49, 0x43, 0x5f, 0x41, 0x55, 0x54, 0x48, 0x10, 0x01, 0x12, - 0x12, 0x0a, 0x0e, 0x42, 0x41, 0x53, 0x49, 0x43, 0x5f, 0x41, 0x55, 0x54, 0x48, 0x5f, 0x4f, 0x54, - 0x53, 0x10, 0x02, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2d, 0x69, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x70, - 0x6f, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x7a, 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x12, 0x38, + 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x48, + 0x00, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, + 0x22, 0x5e, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x49, 0x6e, 0x69, + 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x0b, 0x69, 0x6e, 0x69, 0x74, + 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x57, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, + 0x7a, 0x65, 0x72, 0x52, 0x0b, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, + 0x22, 0xb7, 0x01, 0x0a, 0x10, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, + 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, + 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, + 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x3d, 0x0a, 0x04, 0x46, + 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, + 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x22, 0xdd, 0x01, 0x0a, 0x17, 0x46, + 0x69, 0x6c, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x69, + 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x6c, + 0x6f, 0x61, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x27, + 0x0a, 0x0f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x51, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x61, + 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x22, 0xa2, + 0x02, 0x0a, 0x0e, 0x47, 0x69, 0x74, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, + 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x75, 0x72, 0x69, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x55, 0x72, 0x69, + 0x12, 0x2e, 0x0a, 0x13, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x52, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x75, + 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x55, 0x72, 0x69, + 0x12, 0x40, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x6e, 0x65, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x6f, + 0x64, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6c, 0x6f, 0x6e, 0x65, 0x5f, 0x74, 0x61, 0x67, 0x65, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6c, 0x6f, 0x6e, 0x65, 0x54, 0x61, + 0x67, 0x65, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x31, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x22, 0xc2, 0x02, 0x0a, 0x09, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x50, 0x0a, 0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x45, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x69, 0x74, + 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, + 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x75, + 0x74, 0x68, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, + 0x75, 0x74, 0x68, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x5f, + 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x61, 0x75, 0x74, 0x68, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x19, 0x0a, 0x08, + 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6f, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x61, 0x75, 0x74, 0x68, 0x4f, 0x74, 0x73, 0x1a, 0x3f, 0x0a, 0x11, 0x43, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x31, 0x0a, 0x13, 0x53, 0x6e, 0x61, 0x70, + 0x73, 0x68, 0x6f, 0x74, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x12, + 0x1a, 0x0a, 0x08, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x22, 0x88, 0x01, 0x0a, 0x13, + 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, + 0x7a, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x49, + 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x65, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x12, 0x30, 0x0a, 0x03, 0x67, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x47, 0x69, 0x74, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, + 0x72, 0x52, 0x03, 0x67, 0x69, 0x74, 0x22, 0x17, 0x0a, 0x15, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x61, + 0x63, 0x6b, 0x75, 0x70, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x22, + 0xe7, 0x02, 0x0a, 0x09, 0x47, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, + 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, + 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6c, 0x61, + 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x75, 0x6e, + 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x65, 0x64, + 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x75, + 0x6e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x55, 0x6e, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x75, + 0x6e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x75, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x46, + 0x69, 0x6c, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x75, 0x6e, + 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x13, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x55, 0x6e, 0x74, 0x72, 0x61, 0x63, + 0x6b, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x75, 0x6e, 0x70, 0x75, + 0x73, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0f, 0x75, 0x6e, 0x70, 0x75, 0x73, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x75, 0x6e, 0x70, + 0x75, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x14, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x55, 0x6e, 0x70, 0x75, 0x73, 0x68, + 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x2a, 0x5a, 0x0a, 0x0f, 0x43, 0x6c, 0x6f, + 0x6e, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, + 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, + 0x0d, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x49, 0x54, 0x10, 0x01, + 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x5f, 0x42, 0x52, 0x41, 0x4e, 0x43, + 0x48, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x5f, 0x42, 0x52, 0x41, + 0x4e, 0x43, 0x48, 0x10, 0x03, 0x2a, 0x40, 0x0a, 0x0d, 0x47, 0x69, 0x74, 0x41, 0x75, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x5f, 0x41, 0x55, 0x54, + 0x48, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x42, 0x41, 0x53, 0x49, 0x43, 0x5f, 0x41, 0x55, 0x54, + 0x48, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x41, 0x53, 0x49, 0x43, 0x5f, 0x41, 0x55, 0x54, + 0x48, 0x5f, 0x4f, 0x54, 0x53, 0x10, 0x02, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2d, 0x69, 0x6f, 0x2f, + 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1093,44 +1238,48 @@ func file_initializer_proto_rawDescGZIP() []byte { } var file_initializer_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_initializer_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_initializer_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_initializer_proto_goTypes = []interface{}{ (CloneTargetMode)(0), // 0: contentservice.CloneTargetMode (GitAuthMethod)(0), // 1: contentservice.GitAuthMethod (*WorkspaceInitializer)(nil), // 2: contentservice.WorkspaceInitializer (*CompositeInitializer)(nil), // 3: contentservice.CompositeInitializer - (*FileDownloadInitializer)(nil), // 4: contentservice.FileDownloadInitializer - (*EmptyInitializer)(nil), // 5: contentservice.EmptyInitializer - (*GitInitializer)(nil), // 6: contentservice.GitInitializer - (*GitConfig)(nil), // 7: contentservice.GitConfig - (*SnapshotInitializer)(nil), // 8: contentservice.SnapshotInitializer - (*PrebuildInitializer)(nil), // 9: contentservice.PrebuildInitializer - (*FromBackupInitializer)(nil), // 10: contentservice.FromBackupInitializer - (*GitStatus)(nil), // 11: contentservice.GitStatus - (*FileDownloadInitializer_FileInfo)(nil), // 12: contentservice.FileDownloadInitializer.FileInfo - nil, // 13: contentservice.GitConfig.CustomConfigEntry + (*FilesInitializer)(nil), // 4: contentservice.FilesInitializer + (*FileDownloadInitializer)(nil), // 5: contentservice.FileDownloadInitializer + (*EmptyInitializer)(nil), // 6: contentservice.EmptyInitializer + (*GitInitializer)(nil), // 7: contentservice.GitInitializer + (*GitConfig)(nil), // 8: contentservice.GitConfig + (*SnapshotInitializer)(nil), // 9: contentservice.SnapshotInitializer + (*PrebuildInitializer)(nil), // 10: contentservice.PrebuildInitializer + (*FromBackupInitializer)(nil), // 11: contentservice.FromBackupInitializer + (*GitStatus)(nil), // 12: contentservice.GitStatus + (*FilesInitializer_File)(nil), // 13: contentservice.FilesInitializer.File + (*FileDownloadInitializer_FileInfo)(nil), // 14: contentservice.FileDownloadInitializer.FileInfo + nil, // 15: contentservice.GitConfig.CustomConfigEntry } var file_initializer_proto_depIdxs = []int32{ - 5, // 0: contentservice.WorkspaceInitializer.empty:type_name -> contentservice.EmptyInitializer - 6, // 1: contentservice.WorkspaceInitializer.git:type_name -> contentservice.GitInitializer - 8, // 2: contentservice.WorkspaceInitializer.snapshot:type_name -> contentservice.SnapshotInitializer - 9, // 3: contentservice.WorkspaceInitializer.prebuild:type_name -> contentservice.PrebuildInitializer + 6, // 0: contentservice.WorkspaceInitializer.empty:type_name -> contentservice.EmptyInitializer + 7, // 1: contentservice.WorkspaceInitializer.git:type_name -> contentservice.GitInitializer + 9, // 2: contentservice.WorkspaceInitializer.snapshot:type_name -> contentservice.SnapshotInitializer + 10, // 3: contentservice.WorkspaceInitializer.prebuild:type_name -> contentservice.PrebuildInitializer 3, // 4: contentservice.WorkspaceInitializer.composite:type_name -> contentservice.CompositeInitializer - 4, // 5: contentservice.WorkspaceInitializer.download:type_name -> contentservice.FileDownloadInitializer - 10, // 6: contentservice.WorkspaceInitializer.backup:type_name -> contentservice.FromBackupInitializer - 2, // 7: contentservice.CompositeInitializer.initializer:type_name -> contentservice.WorkspaceInitializer - 12, // 8: contentservice.FileDownloadInitializer.files:type_name -> contentservice.FileDownloadInitializer.FileInfo - 0, // 9: contentservice.GitInitializer.target_mode:type_name -> contentservice.CloneTargetMode - 7, // 10: contentservice.GitInitializer.config:type_name -> contentservice.GitConfig - 13, // 11: contentservice.GitConfig.custom_config:type_name -> contentservice.GitConfig.CustomConfigEntry - 1, // 12: contentservice.GitConfig.authentication:type_name -> contentservice.GitAuthMethod - 8, // 13: contentservice.PrebuildInitializer.prebuild:type_name -> contentservice.SnapshotInitializer - 6, // 14: contentservice.PrebuildInitializer.git:type_name -> contentservice.GitInitializer - 15, // [15:15] is the sub-list for method output_type - 15, // [15:15] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 5, // 5: contentservice.WorkspaceInitializer.download:type_name -> contentservice.FileDownloadInitializer + 11, // 6: contentservice.WorkspaceInitializer.backup:type_name -> contentservice.FromBackupInitializer + 4, // 7: contentservice.WorkspaceInitializer.files:type_name -> contentservice.FilesInitializer + 2, // 8: contentservice.CompositeInitializer.initializer:type_name -> contentservice.WorkspaceInitializer + 13, // 9: contentservice.FilesInitializer.files:type_name -> contentservice.FilesInitializer.File + 14, // 10: contentservice.FileDownloadInitializer.files:type_name -> contentservice.FileDownloadInitializer.FileInfo + 0, // 11: contentservice.GitInitializer.target_mode:type_name -> contentservice.CloneTargetMode + 8, // 12: contentservice.GitInitializer.config:type_name -> contentservice.GitConfig + 15, // 13: contentservice.GitConfig.custom_config:type_name -> contentservice.GitConfig.CustomConfigEntry + 1, // 14: contentservice.GitConfig.authentication:type_name -> contentservice.GitAuthMethod + 9, // 15: contentservice.PrebuildInitializer.prebuild:type_name -> contentservice.SnapshotInitializer + 7, // 16: contentservice.PrebuildInitializer.git:type_name -> contentservice.GitInitializer + 17, // [17:17] is the sub-list for method output_type + 17, // [17:17] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name } func init() { file_initializer_proto_init() } @@ -1164,7 +1313,7 @@ func file_initializer_proto_init() { } } file_initializer_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileDownloadInitializer); i { + switch v := v.(*FilesInitializer); i { case 0: return &v.state case 1: @@ -1176,7 +1325,7 @@ func file_initializer_proto_init() { } } file_initializer_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmptyInitializer); i { + switch v := v.(*FileDownloadInitializer); i { case 0: return &v.state case 1: @@ -1188,7 +1337,7 @@ func file_initializer_proto_init() { } } file_initializer_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GitInitializer); i { + switch v := v.(*EmptyInitializer); i { case 0: return &v.state case 1: @@ -1200,7 +1349,7 @@ func file_initializer_proto_init() { } } file_initializer_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GitConfig); i { + switch v := v.(*GitInitializer); i { case 0: return &v.state case 1: @@ -1212,7 +1361,7 @@ func file_initializer_proto_init() { } } file_initializer_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SnapshotInitializer); i { + switch v := v.(*GitConfig); i { case 0: return &v.state case 1: @@ -1224,7 +1373,7 @@ func file_initializer_proto_init() { } } file_initializer_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrebuildInitializer); i { + switch v := v.(*SnapshotInitializer); i { case 0: return &v.state case 1: @@ -1236,7 +1385,7 @@ func file_initializer_proto_init() { } } file_initializer_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FromBackupInitializer); i { + switch v := v.(*PrebuildInitializer); i { case 0: return &v.state case 1: @@ -1248,7 +1397,7 @@ func file_initializer_proto_init() { } } file_initializer_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GitStatus); i { + switch v := v.(*FromBackupInitializer); i { case 0: return &v.state case 1: @@ -1260,6 +1409,30 @@ func file_initializer_proto_init() { } } file_initializer_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GitStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_initializer_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FilesInitializer_File); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_initializer_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FileDownloadInitializer_FileInfo); i { case 0: return &v.state @@ -1280,6 +1453,7 @@ func file_initializer_proto_init() { (*WorkspaceInitializer_Composite)(nil), (*WorkspaceInitializer_Download)(nil), (*WorkspaceInitializer_Backup)(nil), + (*WorkspaceInitializer_Files)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -1287,7 +1461,7 @@ func file_initializer_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_initializer_proto_rawDesc, NumEnums: 2, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, diff --git a/components/content-service-api/go/workspace.pb.go b/components/content-service-api/go/workspace.pb.go index e605fbbcb37c52..6d89e97c49d5d6 100644 --- a/components/content-service-api/go/workspace.pb.go +++ b/components/content-service-api/go/workspace.pb.go @@ -4,8 +4,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.5 +// protoc-gen-go v1.27.1 +// protoc v3.17.3 // source: workspace.proto package api diff --git a/components/content-service-api/initializer.proto b/components/content-service-api/initializer.proto index 2ada5a7c18b622..1efc0d54d2766a 100644 --- a/components/content-service-api/initializer.proto +++ b/components/content-service-api/initializer.proto @@ -14,6 +14,7 @@ message WorkspaceInitializer { CompositeInitializer composite = 5; FileDownloadInitializer download = 6; FromBackupInitializer backup = 7; + FilesInitializer files = 8; } } @@ -23,6 +24,20 @@ message CompositeInitializer { repeated WorkspaceInitializer initializer = 1; } +// FilesInitializer takes raw files bytes and uses them as workspace content. +message FilesInitializer { + message File { + string content = 1; + // file_path is relative to the target_location, e.g. if target_location is in `/workspace/myrepo` + // a file_path of `foobar/file` would produce a file in `/workspace/myrepo/foobar/file`. + // file_path must include the filename. The FileDownloadInitializer will create any parent directories + // necessary to place the file. + string file_path = 2; + } + repeated File files = 1; + string target_location = 2; +} + // FileDownloadInitializer downloads files and uses them as workspace content. message FileDownloadInitializer { message FileInfo { diff --git a/components/content-service-api/typescript/src/initializer_pb.d.ts b/components/content-service-api/typescript/src/initializer_pb.d.ts index 9d8c6df4fa075f..0b945b4347c99e 100644 --- a/components/content-service-api/typescript/src/initializer_pb.d.ts +++ b/components/content-service-api/typescript/src/initializer_pb.d.ts @@ -49,6 +49,11 @@ export class WorkspaceInitializer extends jspb.Message { getBackup(): FromBackupInitializer | undefined; setBackup(value?: FromBackupInitializer): WorkspaceInitializer; + hasFiles(): boolean; + clearFiles(): void; + getFiles(): FilesInitializer | undefined; + setFiles(value?: FilesInitializer): WorkspaceInitializer; + getSpecCase(): WorkspaceInitializer.SpecCase; serializeBinary(): Uint8Array; @@ -70,6 +75,7 @@ export namespace WorkspaceInitializer { composite?: CompositeInitializer.AsObject, download?: FileDownloadInitializer.AsObject, backup?: FromBackupInitializer.AsObject, + files?: FilesInitializer.AsObject, } export enum SpecCase { @@ -81,6 +87,7 @@ export namespace WorkspaceInitializer { COMPOSITE = 5, DOWNLOAD = 6, BACKUP = 7, + FILES = 8, } } @@ -107,6 +114,56 @@ export namespace CompositeInitializer { } } +export class FilesInitializer extends jspb.Message { + clearFilesList(): void; + getFilesList(): Array; + setFilesList(value: Array): FilesInitializer; + addFiles(value?: FilesInitializer.File, index?: number): FilesInitializer.File; + getTargetLocation(): string; + setTargetLocation(value: string): FilesInitializer; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FilesInitializer.AsObject; + static toObject(includeInstance: boolean, msg: FilesInitializer): FilesInitializer.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FilesInitializer, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FilesInitializer; + static deserializeBinaryFromReader(message: FilesInitializer, reader: jspb.BinaryReader): FilesInitializer; +} + +export namespace FilesInitializer { + export type AsObject = { + filesList: Array, + targetLocation: string, + } + + + export class File extends jspb.Message { + getContent(): string; + setContent(value: string): File; + getFilePath(): string; + setFilePath(value: string): File; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): File.AsObject; + static toObject(includeInstance: boolean, msg: File): File.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: File, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): File; + static deserializeBinaryFromReader(message: File, reader: jspb.BinaryReader): File; + } + + export namespace File { + export type AsObject = { + content: string, + filePath: string, + } + } + +} + export class FileDownloadInitializer extends jspb.Message { clearFilesList(): void; getFilesList(): Array; diff --git a/components/content-service-api/typescript/src/initializer_pb.js b/components/content-service-api/typescript/src/initializer_pb.js index fb4db171dab588..358a11c5ff3cba 100644 --- a/components/content-service-api/typescript/src/initializer_pb.js +++ b/components/content-service-api/typescript/src/initializer_pb.js @@ -26,6 +26,8 @@ goog.exportSymbol('proto.contentservice.CompositeInitializer', null, global); goog.exportSymbol('proto.contentservice.EmptyInitializer', null, global); goog.exportSymbol('proto.contentservice.FileDownloadInitializer', null, global); goog.exportSymbol('proto.contentservice.FileDownloadInitializer.FileInfo', null, global); +goog.exportSymbol('proto.contentservice.FilesInitializer', null, global); +goog.exportSymbol('proto.contentservice.FilesInitializer.File', null, global); goog.exportSymbol('proto.contentservice.FromBackupInitializer', null, global); goog.exportSymbol('proto.contentservice.GitAuthMethod', null, global); goog.exportSymbol('proto.contentservice.GitConfig', null, global); @@ -77,6 +79,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.contentservice.CompositeInitializer.displayName = 'proto.contentservice.CompositeInitializer'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.contentservice.FilesInitializer = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.contentservice.FilesInitializer.repeatedFields_, null); +}; +goog.inherits(proto.contentservice.FilesInitializer, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.contentservice.FilesInitializer.displayName = 'proto.contentservice.FilesInitializer'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.contentservice.FilesInitializer.File = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.contentservice.FilesInitializer.File, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.contentservice.FilesInitializer.File.displayName = 'proto.contentservice.FilesInitializer.File'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -275,7 +319,7 @@ if (goog.DEBUG && !COMPILED) { * @private {!Array>} * @const */ -proto.contentservice.WorkspaceInitializer.oneofGroups_ = [[1,2,3,4,5,6,7]]; +proto.contentservice.WorkspaceInitializer.oneofGroups_ = [[1,2,3,4,5,6,7,8]]; /** * @enum {number} @@ -288,7 +332,8 @@ proto.contentservice.WorkspaceInitializer.SpecCase = { PREBUILD: 4, COMPOSITE: 5, DOWNLOAD: 6, - BACKUP: 7 + BACKUP: 7, + FILES: 8 }; /** @@ -335,7 +380,8 @@ proto.contentservice.WorkspaceInitializer.toObject = function(includeInstance, m prebuild: (f = msg.getPrebuild()) && proto.contentservice.PrebuildInitializer.toObject(includeInstance, f), composite: (f = msg.getComposite()) && proto.contentservice.CompositeInitializer.toObject(includeInstance, f), download: (f = msg.getDownload()) && proto.contentservice.FileDownloadInitializer.toObject(includeInstance, f), - backup: (f = msg.getBackup()) && proto.contentservice.FromBackupInitializer.toObject(includeInstance, f) + backup: (f = msg.getBackup()) && proto.contentservice.FromBackupInitializer.toObject(includeInstance, f), + files: (f = msg.getFiles()) && proto.contentservice.FilesInitializer.toObject(includeInstance, f) }; if (includeInstance) { @@ -407,6 +453,11 @@ proto.contentservice.WorkspaceInitializer.deserializeBinaryFromReader = function reader.readMessage(value,proto.contentservice.FromBackupInitializer.deserializeBinaryFromReader); msg.setBackup(value); break; + case 8: + var value = new proto.contentservice.FilesInitializer; + reader.readMessage(value,proto.contentservice.FilesInitializer.deserializeBinaryFromReader); + msg.setFiles(value); + break; default: reader.skipField(); break; @@ -492,6 +543,14 @@ proto.contentservice.WorkspaceInitializer.serializeBinaryToWriter = function(mes proto.contentservice.FromBackupInitializer.serializeBinaryToWriter ); } + f = message.getFiles(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.contentservice.FilesInitializer.serializeBinaryToWriter + ); + } }; @@ -754,6 +813,43 @@ proto.contentservice.WorkspaceInitializer.prototype.hasBackup = function() { }; +/** + * optional FilesInitializer files = 8; + * @return {?proto.contentservice.FilesInitializer} + */ +proto.contentservice.WorkspaceInitializer.prototype.getFiles = function() { + return /** @type{?proto.contentservice.FilesInitializer} */ ( + jspb.Message.getWrapperField(this, proto.contentservice.FilesInitializer, 8)); +}; + + +/** + * @param {?proto.contentservice.FilesInitializer|undefined} value + * @return {!proto.contentservice.WorkspaceInitializer} returns this +*/ +proto.contentservice.WorkspaceInitializer.prototype.setFiles = function(value) { + return jspb.Message.setOneofWrapperField(this, 8, proto.contentservice.WorkspaceInitializer.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.contentservice.WorkspaceInitializer} returns this + */ +proto.contentservice.WorkspaceInitializer.prototype.clearFiles = function() { + return this.setFiles(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.contentservice.WorkspaceInitializer.prototype.hasFiles = function() { + return jspb.Message.getField(this, 8) != null; +}; + + /** * List of repeated fields within this message type. @@ -915,6 +1011,356 @@ proto.contentservice.CompositeInitializer.prototype.clearInitializerList = funct +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.contentservice.FilesInitializer.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.contentservice.FilesInitializer.prototype.toObject = function(opt_includeInstance) { + return proto.contentservice.FilesInitializer.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.FilesInitializer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.contentservice.FilesInitializer.toObject = function(includeInstance, msg) { + var f, obj = { + filesList: jspb.Message.toObjectList(msg.getFilesList(), + proto.contentservice.FilesInitializer.File.toObject, includeInstance), + targetLocation: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.contentservice.FilesInitializer} + */ +proto.contentservice.FilesInitializer.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.contentservice.FilesInitializer; + return proto.contentservice.FilesInitializer.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.contentservice.FilesInitializer} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.contentservice.FilesInitializer} + */ +proto.contentservice.FilesInitializer.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.contentservice.FilesInitializer.File; + reader.readMessage(value,proto.contentservice.FilesInitializer.File.deserializeBinaryFromReader); + msg.addFiles(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setTargetLocation(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.contentservice.FilesInitializer.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.contentservice.FilesInitializer.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.contentservice.FilesInitializer} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.contentservice.FilesInitializer.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getFilesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.contentservice.FilesInitializer.File.serializeBinaryToWriter + ); + } + f = message.getTargetLocation(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.contentservice.FilesInitializer.File.prototype.toObject = function(opt_includeInstance) { + return proto.contentservice.FilesInitializer.File.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.FilesInitializer.File} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.contentservice.FilesInitializer.File.toObject = function(includeInstance, msg) { + var f, obj = { + content: jspb.Message.getFieldWithDefault(msg, 1, ""), + filePath: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.contentservice.FilesInitializer.File} + */ +proto.contentservice.FilesInitializer.File.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.contentservice.FilesInitializer.File; + return proto.contentservice.FilesInitializer.File.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.contentservice.FilesInitializer.File} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.contentservice.FilesInitializer.File} + */ +proto.contentservice.FilesInitializer.File.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setContent(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setFilePath(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.contentservice.FilesInitializer.File.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.contentservice.FilesInitializer.File.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.contentservice.FilesInitializer.File} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.contentservice.FilesInitializer.File.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContent(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getFilePath(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string content = 1; + * @return {string} + */ +proto.contentservice.FilesInitializer.File.prototype.getContent = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.contentservice.FilesInitializer.File} returns this + */ +proto.contentservice.FilesInitializer.File.prototype.setContent = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string file_path = 2; + * @return {string} + */ +proto.contentservice.FilesInitializer.File.prototype.getFilePath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.contentservice.FilesInitializer.File} returns this + */ +proto.contentservice.FilesInitializer.File.prototype.setFilePath = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * repeated File files = 1; + * @return {!Array} + */ +proto.contentservice.FilesInitializer.prototype.getFilesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.contentservice.FilesInitializer.File, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.contentservice.FilesInitializer} returns this +*/ +proto.contentservice.FilesInitializer.prototype.setFilesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.contentservice.FilesInitializer.File=} opt_value + * @param {number=} opt_index + * @return {!proto.contentservice.FilesInitializer.File} + */ +proto.contentservice.FilesInitializer.prototype.addFiles = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.contentservice.FilesInitializer.File, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.contentservice.FilesInitializer} returns this + */ +proto.contentservice.FilesInitializer.prototype.clearFilesList = function() { + return this.setFilesList([]); +}; + + +/** + * optional string target_location = 2; + * @return {string} + */ +proto.contentservice.FilesInitializer.prototype.getTargetLocation = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.contentservice.FilesInitializer} returns this + */ +proto.contentservice.FilesInitializer.prototype.setTargetLocation = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + /** * List of repeated fields within this message type. * @private {!Array} diff --git a/components/content-service/pkg/initializer/files.go b/components/content-service/pkg/initializer/files.go new file mode 100644 index 00000000000000..48bf6e10318bc9 --- /dev/null +++ b/components/content-service/pkg/initializer/files.go @@ -0,0 +1,66 @@ +// Copyright (c) 2021 Gitpod GmbH. All rights reserved. +// Licensed under the GNU Affero General Public License (AGPL). +// See License-AGPL.txt in the project root for license information. + +package initializer + +import ( + "context" + "os" + "path/filepath" + + "github.com/gitpod-io/gitpod/common-go/tracing" + csapi "github.com/gitpod-io/gitpod/content-service/api" + "github.com/gitpod-io/gitpod/content-service/pkg/archive" + "github.com/opentracing/opentracing-go" + "golang.org/x/xerrors" +) + +type file struct { + Content string + + // Path is relative to the FileDownloadInitializer's TargetLocation, e.g. if TargetLocation is in `/workspace/myrepo` + // a Path of `foobar/file` would produce a file in `/workspace/myrepo/foobar/file`. + // Path must include the filename. The FileDownloadInitializer will create any parent directories + // necessary to place the file. + Path string +} + +type filesInitializer struct { + Files []file + TargetLocation string +} + +// Run initializes the workspace +func (ws *filesInitializer) Run(ctx context.Context, mappings []archive.IDMapping) (src csapi.WorkspaceInitSource, err error) { + span, ctx := opentracing.StartSpanFromContext(ctx, "FilesInitializer.Run") + defer tracing.FinishSpan(span, &err) + + for _, f := range ws.Files { + ws.writeFile(ctx, f) + if err != nil { + tracing.LogError(span, xerrors.Errorf("error writing file content to %s: %w", f.Path, err)) + return src, err + } + } + return csapi.WorkspaceInitFromOther, nil +} + +func (ws *filesInitializer) writeFile(ctx context.Context, f file) (err error) { + span, ctx := opentracing.StartSpanFromContext(ctx, "FilesInitializer.writeFile") + defer tracing.FinishSpan(span, &err) + + fn := filepath.Join(ws.TargetLocation, f.Path) + err = os.MkdirAll(filepath.Dir(fn), 0755) + if err != nil { + tracing.LogError(span, xerrors.Errorf("cannot mkdir %s: %w", filepath.Dir(fn), err)) + } + + fd, err := os.OpenFile(fn, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + if err != nil { + return err + } + + _, err = fd.WriteString(f.Content) + return err +} diff --git a/components/content-service/pkg/initializer/initializer.go b/components/content-service/pkg/initializer/initializer.go index 37c02c346cab9e..6d9b77716ce8f5 100644 --- a/components/content-service/pkg/initializer/initializer.go +++ b/components/content-service/pkg/initializer/initializer.go @@ -136,6 +136,8 @@ func NewFromRequest(ctx context.Context, loc string, rs storage.DirectDownloader initializer, err = newSnapshotInitializer(loc, rs, ir.Snapshot) } else if ir, ok := spec.(*csapi.WorkspaceInitializer_Download); ok { initializer, err = newFileDownloadInitializer(loc, ir.Download) + } else if ir, ok := spec.(*csapi.WorkspaceInitializer_Files); ok { + initializer, err = newFilesInitializer(loc, ir.Files) } else if ir, ok := spec.(*csapi.WorkspaceInitializer_Backup); ok { initializer, err = newFromBackupInitializer(loc, rs, ir.Backup) } else { @@ -147,6 +149,20 @@ func NewFromRequest(ctx context.Context, loc string, rs storage.DirectDownloader return initializer, nil } +func newFilesInitializer(loc string, req *csapi.FilesInitializer) (*filesInitializer, error) { + files := make([]file, len(req.Files)) + for i, f := range req.Files { + files[i] = file{ + Content: f.Content, + Path: f.FilePath, + } + } + return &filesInitializer{ + Files: files, + TargetLocation: req.TargetLocation, + }, nil +} + // newFileDownloadInitializer creates a download initializer for a request func newFileDownloadInitializer(loc string, req *csapi.FileDownloadInitializer) (*fileDownloadInitializer, error) { fileInfos := make([]fileInfo, len(req.Files)) diff --git a/components/gitpod-protocol/src/wsready.ts b/components/gitpod-protocol/src/wsready.ts index 9073ea0c594240..e87dfe09db3794 100644 --- a/components/gitpod-protocol/src/wsready.ts +++ b/components/gitpod-protocol/src/wsready.ts @@ -4,14 +4,3 @@ * See License-AGPL.txt in the project root for license information. */ -// generated using github.com/32leaves/bel on 2021-08-03 10:42:32.582603295 +0000 UTC m=+0.005734479 -// DO NOT MODIFY - -export enum WorkspaceInitSource { - WorkspaceInitFromBackup = "from-backup", - WorkspaceInitFromPrebuild = "from-prebuild", - WorkspaceInitFromOther = "from-other", -} -export interface WorkspaceReadyMessage { - source: WorkspaceInitSource -} From 6d5b5c192536df8b68238b9c3f7e016ba441760d Mon Sep 17 00:00:00 2001 From: Gero Posmyk-Leinemann Date: Wed, 15 Sep 2021 11:50:35 +0000 Subject: [PATCH 3/3] [test] adjust to FilesInitializer --- test/tests/workspace/workspace_image_test.go | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test/tests/workspace/workspace_image_test.go b/test/tests/workspace/workspace_image_test.go index 8ed3643ab54af7..4004e2be85dc1e 100644 --- a/test/tests/workspace/workspace_image_test.go +++ b/test/tests/workspace/workspace_image_test.go @@ -5,6 +5,7 @@ package workspace_test import ( + "fmt" "strings" "testing" "time" @@ -20,6 +21,8 @@ func TestImageBuildPreservesEnvVarMk3(t *testing.T) { it, ctx := integration.NewTest(t, 5*time.Minute) defer it.Done() + envVarName := "MY_TEST_ENV_VAR" + envVarValue := "asd" res := integration.LaunchWorkspaceDirectly(it, integration.WithWorkspaceImageRequest(&imgapi.ResolveWorkspaceImageRequest{ Source: &imgapi.BuildSource{ From: &imgapi.BuildSource_File{ @@ -28,14 +31,13 @@ func TestImageBuildPreservesEnvVarMk3(t *testing.T) { DockerfilePath: ".gitpod.Dockerfile", ContextPath: ".", Source: &csapi.WorkspaceInitializer{ - Spec: &csapi.WorkspaceInitializer_Git{ - Git: &csapi.GitInitializer{ - RemoteUri: "https://github.com/gitpod-io/gitpod-test-repo.git", - TargetMode: csapi.CloneTargetMode_REMOTE_BRANCH, - // this branch has a docker file that adds 'MY_TEST_ENV_VAR=asd' as env var (ref: https://github.com/gitpod-io/gitpod-test-repo/blob/integration-test/imgbldr/env-is-persisted/.gitpod.Dockerfile#L3) - CloneTaget: "integration-test/imgbldr/env-is-persisted", - Config: &csapi.GitConfig{ - Authentication: csapi.GitAuthMethod_NO_AUTH, + Spec: &csapi.WorkspaceInitializer_Files{ + Files: &csapi.FilesInitializer{ + Files: []*csapi.FilesInitializer_File{ + { + Content: fmt.Sprintf("FROM gitpod/workspace-full\nENV %s=%s", envVarName, envVarValue), + FilePath: ".gitpod.Dockerfile", + }, }, }, }, @@ -58,7 +60,7 @@ func TestImageBuildPreservesEnvVarMk3(t *testing.T) { err = rsa.Call("WorkspaceAgent.Exec", &agent.ExecRequest{ Dir: "/workspace", Command: "bash", - Args: []string{"-c", "echo $MY_TEST_ENV_VAR"}, + Args: []string{"-c", fmt.Sprintf("echo $%s", envVarName)}, }, &resp) if err != nil { t.Fatal(err) @@ -67,6 +69,6 @@ func TestImageBuildPreservesEnvVarMk3(t *testing.T) { t.Fatalf("got non-zero exit code: %d", resp.ExitCode) } if strings.TrimSpace(resp.Stdout) == "" { - t.Fatalf("env var MY_TEST_ENV_VAR is not preserved!") + t.Fatalf("env var %s is not preserved!", envVarName) } }