diff --git a/.gitignore b/.gitignore index 21b3b83910..7c9666618d 100644 --- a/.gitignore +++ b/.gitignore @@ -131,4 +131,8 @@ lerna-debug.log # contains several libraries that get shipped yarn.lock package.json -package-lock.json \ No newline at end of file +package-lock.json + +# Nix +# ignores the default result symlink created when building with nix +result diff --git a/api/golang/core/kurtosis_core_rpc_api_bindings/api_container_service.pb.go b/api/golang/core/kurtosis_core_rpc_api_bindings/api_container_service.pb.go index ebb3f041d2..06d347f927 100644 --- a/api/golang/core/kurtosis_core_rpc_api_bindings/api_container_service.pb.go +++ b/api/golang/core/kurtosis_core_rpc_api_bindings/api_container_service.pb.go @@ -3445,10 +3445,12 @@ type StarlarkPackagePlanYamlArgs struct { // Serialized parameters data for the Starlark package main function // This should be a valid JSON string SerializedParams *string `protobuf:"bytes,2,opt,name=serialized_params,json=serializedParams,proto3,oneof" json:"serialized_params,omitempty"` + // whether or not this is package yaml should be pulled from on disk package or cloned + IsRemote bool `protobuf:"varint,3,opt,name=is_remote,json=isRemote,proto3" json:"is_remote,omitempty"` // The relative main file filepath, the default value is the "main.star" file in the root of a package - RelativePathToMainFile *string `protobuf:"bytes,3,opt,name=relative_path_to_main_file,json=relativePathToMainFile,proto3,oneof" json:"relative_path_to_main_file,omitempty"` + RelativePathToMainFile *string `protobuf:"bytes,4,opt,name=relative_path_to_main_file,json=relativePathToMainFile,proto3,oneof" json:"relative_path_to_main_file,omitempty"` // The name of the main function, the default value is "run" - MainFunctionName *string `protobuf:"bytes,4,opt,name=main_function_name,json=mainFunctionName,proto3,oneof" json:"main_function_name,omitempty"` + MainFunctionName *string `protobuf:"bytes,5,opt,name=main_function_name,json=mainFunctionName,proto3,oneof" json:"main_function_name,omitempty"` } func (x *StarlarkPackagePlanYamlArgs) Reset() { @@ -3497,6 +3499,13 @@ func (x *StarlarkPackagePlanYamlArgs) GetSerializedParams() string { return "" } +func (x *StarlarkPackagePlanYamlArgs) GetIsRemote() bool { + if x != nil { + return x.IsRemote + } + return false +} + func (x *StarlarkPackagePlanYamlArgs) GetRelativePathToMainFile() string { if x != nil && x.RelativePathToMainFile != nil { return *x.RelativePathToMainFile @@ -4099,177 +4108,179 @@ var file_api_container_service_proto_rawDesc = []byte{ 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xae, 0x02, 0x0a, 0x1b, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xcb, 0x02, 0x0a, 0x1b, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x50, 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x11, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x10, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x88, 0x01, 0x01, 0x12, 0x3f, 0x0a, 0x1a, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, - 0x66, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x16, 0x72, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x54, 0x6f, 0x4d, 0x61, 0x69, 0x6e, - 0x46, 0x69, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x12, 0x31, 0x0a, 0x12, 0x6d, 0x61, 0x69, 0x6e, 0x5f, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x10, 0x6d, 0x61, 0x69, 0x6e, 0x46, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x73, - 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x42, 0x1d, 0x0a, 0x1b, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, - 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x42, - 0x15, 0x0a, 0x13, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x36, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x50, 0x50, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, - 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x2a, 0x2c, - 0x0a, 0x11, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x4d, - 0x6f, 0x64, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x10, 0x00, 0x12, - 0x0b, 0x0a, 0x07, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x2a, 0x26, 0x0a, 0x07, - 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x4e, 0x4e, 0x45, - 0x43, 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x4f, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, - 0x43, 0x54, 0x10, 0x01, 0x2a, 0x32, 0x0a, 0x13, 0x4b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, - 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x1b, 0x0a, 0x17, 0x4e, - 0x4f, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x52, 0x55, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x5f, 0x43, - 0x41, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x2a, 0x26, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x45, 0x56, - 0x45, 0x52, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x4c, 0x57, 0x41, 0x59, 0x53, 0x10, 0x01, - 0x32, 0xa6, 0x10, 0x0a, 0x13, 0x41, 0x70, 0x69, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6d, 0x0a, 0x11, 0x52, 0x75, 0x6e, 0x53, - 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x28, 0x2e, + 0x61, 0x6d, 0x73, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x52, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x12, 0x3f, 0x0a, 0x1a, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, + 0x70, 0x61, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x66, 0x69, 0x6c, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x16, 0x72, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x54, 0x6f, 0x4d, 0x61, 0x69, 0x6e, 0x46, 0x69, 0x6c, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x31, 0x0a, 0x12, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x66, 0x75, 0x6e, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x02, 0x52, 0x10, 0x6d, 0x61, 0x69, 0x6e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x73, 0x65, 0x72, 0x69, + 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x1d, 0x0a, + 0x1b, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x5f, + 0x74, 0x6f, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x15, 0x0a, 0x13, + 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x2a, 0x36, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0b, + 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x2a, 0x2c, 0x0a, 0x11, 0x49, + 0x6d, 0x61, 0x67, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x6f, 0x64, 0x65, + 0x12, 0x0a, 0x0a, 0x06, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x2a, 0x26, 0x0a, 0x07, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x10, + 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x4f, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x10, + 0x01, 0x2a, 0x32, 0x0a, 0x13, 0x4b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x46, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x4f, 0x5f, 0x49, + 0x4e, 0x53, 0x54, 0x52, 0x55, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x5f, 0x43, 0x41, 0x43, 0x48, + 0x49, 0x4e, 0x47, 0x10, 0x00, 0x2a, 0x26, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x45, 0x56, 0x45, 0x52, 0x10, + 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x4c, 0x57, 0x41, 0x59, 0x53, 0x10, 0x01, 0x32, 0xa6, 0x10, + 0x0a, 0x13, 0x41, 0x70, 0x69, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6d, 0x0a, 0x11, 0x52, 0x75, 0x6e, 0x53, 0x74, 0x61, 0x72, + 0x6c, 0x61, 0x72, 0x6b, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x28, 0x2e, 0x61, 0x70, 0x69, + 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x52, + 0x75, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x41, 0x72, 0x67, 0x73, 0x1a, 0x2a, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, + 0x6b, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4c, 0x69, 0x6e, 0x65, + 0x22, 0x00, 0x30, 0x01, 0x12, 0x59, 0x0a, 0x15, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x74, + 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, - 0x69, 0x2e, 0x52, 0x75, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x53, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x2a, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, - 0x6c, 0x61, 0x72, 0x6b, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4c, - 0x69, 0x6e, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x59, 0x0a, 0x15, 0x55, 0x70, 0x6c, 0x6f, 0x61, - 0x64, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, - 0x12, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x64, 0x44, 0x61, 0x74, - 0x61, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, - 0x28, 0x01, 0x12, 0x6f, 0x0a, 0x12, 0x52, 0x75, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, - 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x29, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x75, 0x6e, - 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x41, - 0x72, 0x67, 0x73, 0x1a, 0x2a, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, - 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4c, 0x69, 0x6e, 0x65, 0x22, - 0x00, 0x30, 0x01, 0x12, 0x5b, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x8d, 0x01, 0x0a, 0x2a, 0x47, 0x65, 0x74, 0x45, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x41, 0x6e, 0x64, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x45, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x45, - 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x6e, 0x64, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, - 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x5b, 0x0a, 0x0b, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, + 0x69, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, + 0x75, 0x6e, 0x6b, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x28, 0x01, 0x12, + 0x6f, 0x0a, 0x12, 0x52, 0x75, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x29, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x75, 0x6e, 0x53, 0x74, 0x61, + 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x41, 0x72, 0x67, 0x73, + 0x1a, 0x2a, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x52, 0x75, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4c, 0x69, 0x6e, 0x65, 0x22, 0x00, 0x30, 0x01, + 0x12, 0x5b, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, - 0x61, 0x70, 0x69, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x41, + 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x79, 0x0a, - 0x22, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x74, 0x45, - 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x12, 0x39, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x48, - 0x74, 0x74, 0x70, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x76, - 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x7b, 0x0a, 0x23, 0x57, 0x61, 0x69, 0x74, - 0x46, 0x6f, 0x72, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x45, 0x6e, 0x64, 0x70, 0x6f, - 0x69, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, - 0x3a, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, - 0x61, 0x70, 0x69, 0x2e, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x48, 0x74, 0x74, 0x70, 0x50, - 0x6f, 0x73, 0x74, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, + 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x8d, 0x01, + 0x0a, 0x2a, 0x47, 0x65, 0x74, 0x45, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x6e, 0x64, + 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x45, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x78, 0x69, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x41, 0x6e, 0x64, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x63, 0x61, + 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, + 0x0b, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x22, 0x2e, 0x61, + 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, + 0x2e, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x41, 0x72, 0x67, 0x73, + 0x1a, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x79, 0x0a, 0x22, 0x57, 0x61, + 0x69, 0x74, 0x46, 0x6f, 0x72, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x64, 0x70, + 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x12, 0x39, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x48, 0x74, 0x74, 0x70, + 0x47, 0x65, 0x74, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x13, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, - 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x24, 0x2e, 0x61, + 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x7b, 0x0a, 0x23, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, + 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x3a, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, - 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, 0x75, - 0x6e, 0x6b, 0x1a, 0x2e, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, - 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x12, 0x6f, 0x0a, 0x15, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, - 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, - 0x2c, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, - 0x61, 0x70, 0x69, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, - 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x24, 0x2e, - 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, - 0x69, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, - 0x75, 0x6e, 0x6b, 0x22, 0x00, 0x30, 0x01, 0x12, 0x79, 0x0a, 0x15, 0x53, 0x74, 0x6f, 0x72, 0x65, - 0x57, 0x65, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, - 0x12, 0x2c, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x65, 0x62, 0x46, 0x69, 0x6c, - 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x30, - 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, - 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x65, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x73, - 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x91, 0x01, 0x0a, 0x1d, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x69, 0x6c, 0x65, - 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x69, - 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x38, 0x2e, 0x61, 0x70, 0x69, - 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, - 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x75, 0x0a, 0x1e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, - 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x41, 0x6e, 0x64, 0x55, 0x75, 0x69, 0x64, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x2e, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, + 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x1a, 0x39, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, - 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x41, 0x6e, 0x64, 0x55, 0x75, - 0x69, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x91, 0x01, - 0x0a, 0x1c, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, - 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x36, - 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, - 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, - 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x43, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x67, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x12, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x2a, 0x2e, 0x61, + 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x13, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, + 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x5f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x1a, + 0x2e, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, + 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, + 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x28, 0x01, 0x12, 0x6f, 0x0a, 0x15, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, + 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x2c, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, - 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x0e, 0x47, 0x65, - 0x74, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x52, 0x75, 0x6e, 0x12, 0x16, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x29, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x72, - 0x6c, 0x61, 0x72, 0x6b, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x69, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, - 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x50, 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x2d, - 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, - 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x53, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x50, 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x1b, 0x2e, - 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, - 0x69, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x22, 0x00, 0x12, 0x6b, 0x0a, 0x1a, - 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x50, 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x2e, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, + 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, - 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x50, 0x6c, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, 0x75, 0x6e, 0x6b, + 0x22, 0x00, 0x30, 0x01, 0x12, 0x79, 0x0a, 0x15, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x65, 0x62, + 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x2c, 0x2e, + 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, + 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x65, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, + 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x30, 0x2e, 0x61, 0x70, + 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x65, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, + 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x91, 0x01, 0x0a, 0x1d, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, + 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x34, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, + 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x38, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x46, 0x72, + 0x6f, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x75, 0x0a, 0x1e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, + 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x41, 0x6e, 0x64, + 0x55, 0x75, 0x69, 0x64, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x39, 0x2e, + 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, + 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, + 0x61, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x41, 0x6e, 0x64, 0x55, 0x75, 0x69, 0x64, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x91, 0x01, 0x0a, 0x1c, 0x49, + 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, + 0x61, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x36, 0x2e, 0x61, 0x70, + 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, + 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, + 0x66, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x46, + 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, + 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x12, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x2a, 0x2e, 0x61, 0x70, 0x69, 0x5f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x74, + 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x52, 0x75, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x1a, 0x29, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, + 0x6b, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x69, + 0x0a, 0x19, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x53, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x50, 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x2d, 0x2e, 0x61, 0x70, + 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, + 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x50, 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x50, - 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x22, 0x00, 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, - 0x2d, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x6b, - 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x72, 0x70, 0x63, - 0x5f, 0x61, 0x70, 0x69, 0x5f, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x22, 0x00, 0x12, 0x6b, 0x0a, 0x1a, 0x47, 0x65, 0x74, + 0x53, 0x74, 0x61, 0x72, 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x50, + 0x6c, 0x61, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x2e, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, + 0x6c, 0x61, 0x72, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x50, 0x6c, 0x61, 0x6e, 0x59, + 0x61, 0x6d, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x6c, 0x61, 0x6e, + 0x59, 0x61, 0x6d, 0x6c, 0x22, 0x00, 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x2d, 0x74, 0x65, + 0x63, 0x68, 0x2f, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x6b, 0x75, 0x72, 0x74, + 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x70, + 0x69, 0x5f, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/api/golang/core/lib/enclaves/enclave_context.go b/api/golang/core/lib/enclaves/enclave_context.go old mode 100644 new mode 100755 index 9849652114..a0b3d50ed5 --- a/api/golang/core/lib/enclaves/enclave_context.go +++ b/api/golang/core/lib/enclaves/enclave_context.go @@ -531,6 +531,75 @@ func (enclaveCtx *EnclaveContext) GetStarlarkRun(ctx context.Context) (*kurtosis return response, nil } +func (enclaveCtx *EnclaveContext) GetStarlarkRemotePackagePlanYaml(ctx context.Context, packageId string, serializedParams string) (*kurtosis_core_rpc_api_bindings.PlanYaml, error) { + serializedParams, err := maybeParseYaml(serializedParams) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred when parsing YAML args for package '%s':\n%s", packageId, serializedParams) + } + response, err := enclaveCtx.client.GetStarlarkPackagePlanYaml(ctx, &kurtosis_core_rpc_api_bindings.StarlarkPackagePlanYamlArgs{ + PackageId: packageId, + SerializedParams: &serializedParams, + IsRemote: true, + RelativePathToMainFile: nil, + MainFunctionName: nil, + }) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred while getting the Starlark package plan yaml.") + } + return response, nil +} + +func (enclaveCtx *EnclaveContext) GetStarlarkPackagePlanYaml(ctx context.Context, packageRootPath string, serializedParams string) (*kurtosis_core_rpc_api_bindings.PlanYaml, error) { + packageName, packageReplaceOptions, err := getPackageNameAndReplaceOptions(packageRootPath) + if err != nil { + return nil, err + } + + serializedParams, err = maybeParseYaml(serializedParams) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred when parsing YAML args for package '%s':\n%s", packageName, serializedParams) + } + + err = enclaveCtx.uploadStarlarkPackage(packageName, packageRootPath) + if err != nil { + return nil, stacktrace.Propagate(err, "Error uploading package '%s' prior to executing it", packageRootPath) + } + + if len(packageReplaceOptions) > 0 { + if err = enclaveCtx.uploadLocalStarlarkPackageDependencies(packageRootPath, packageReplaceOptions); err != nil { + return nil, stacktrace.Propagate(err, "An error occurred while uploading the local starlark package dependencies from the replace options '%+v'", packageReplaceOptions) + } + } + + response, err := enclaveCtx.client.GetStarlarkPackagePlanYaml(ctx, &kurtosis_core_rpc_api_bindings.StarlarkPackagePlanYamlArgs{ + PackageId: packageName, + SerializedParams: &serializedParams, + IsRemote: false, + RelativePathToMainFile: nil, + MainFunctionName: nil, + }) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred while getting the Starlark package plan yaml.") + } + return response, nil +} + +func (enclaveCtx *EnclaveContext) GetStarlarkScriptPlanYaml(ctx context.Context, serializedScript string, serializedParams string) (*kurtosis_core_rpc_api_bindings.PlanYaml, error) { + serializedParams, err := maybeParseYaml(serializedParams) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred when parsing YAML args for package '%v'", serializedParams) + } + response, err := enclaveCtx.client.GetStarlarkScriptPlanYaml(ctx, &kurtosis_core_rpc_api_bindings.StarlarkScriptPlanYamlArgs{ + SerializedScript: serializedScript, + SerializedParams: &serializedParams, + MainFunctionName: nil, + }) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred while getting the starlark script plan yaml.") + } + return response, nil +} + // ==================================================================================================== // // Private helper methods diff --git a/api/protobuf/core/api_container_service.proto b/api/protobuf/core/api_container_service.proto index cc4d0aacaa..c29772ede3 100644 --- a/api/protobuf/core/api_container_service.proto +++ b/api/protobuf/core/api_container_service.proto @@ -607,9 +607,12 @@ message StarlarkPackagePlanYamlArgs { // This should be a valid JSON string optional string serialized_params = 2; + // whether or not this is package yaml should be pulled from on disk package or cloned + bool is_remote = 3; + // The relative main file filepath, the default value is the "main.star" file in the root of a package - optional string relative_path_to_main_file = 3; + optional string relative_path_to_main_file = 4; // The name of the main function, the default value is "run" - optional string main_function_name = 4; + optional string main_function_name = 5; } diff --git a/api/rust/src/api_container_api.rs b/api/rust/src/api_container_api.rs index a3de2c65bc..451c0e5848 100644 --- a/api/rust/src/api_container_api.rs +++ b/api/rust/src/api_container_api.rs @@ -719,13 +719,16 @@ pub struct StarlarkPackagePlanYamlArgs { /// This should be a valid JSON string #[prost(string, optional, tag = "2")] pub serialized_params: ::core::option::Option<::prost::alloc::string::String>, + /// whether or not this is package yaml should be pulled from on disk package or cloned + #[prost(bool, tag = "3")] + pub is_remote: bool, /// The relative main file filepath, the default value is the "main.star" file in the root of a package - #[prost(string, optional, tag = "3")] + #[prost(string, optional, tag = "4")] pub relative_path_to_main_file: ::core::option::Option< ::prost::alloc::string::String, >, /// The name of the main function, the default value is "run" - #[prost(string, optional, tag = "4")] + #[prost(string, optional, tag = "5")] pub main_function_name: ::core::option::Option<::prost::alloc::string::String>, } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] diff --git a/api/typescript/src/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.d.ts b/api/typescript/src/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.d.ts index 1d23b22991..bd338a52f8 100644 --- a/api/typescript/src/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.d.ts +++ b/api/typescript/src/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.d.ts @@ -1546,6 +1546,9 @@ export class StarlarkPackagePlanYamlArgs extends jspb.Message { hasSerializedParams(): boolean; clearSerializedParams(): StarlarkPackagePlanYamlArgs; + getIsRemote(): boolean; + setIsRemote(value: boolean): StarlarkPackagePlanYamlArgs; + getRelativePathToMainFile(): string; setRelativePathToMainFile(value: string): StarlarkPackagePlanYamlArgs; hasRelativePathToMainFile(): boolean; @@ -1568,6 +1571,7 @@ export namespace StarlarkPackagePlanYamlArgs { export type AsObject = { packageId: string, serializedParams?: string, + isRemote: boolean, relativePathToMainFile?: string, mainFunctionName?: string, } @@ -1579,12 +1583,12 @@ export namespace StarlarkPackagePlanYamlArgs { export enum RelativePathToMainFileCase { _RELATIVE_PATH_TO_MAIN_FILE_NOT_SET = 0, - RELATIVE_PATH_TO_MAIN_FILE = 3, + RELATIVE_PATH_TO_MAIN_FILE = 4, } export enum MainFunctionNameCase { _MAIN_FUNCTION_NAME_NOT_SET = 0, - MAIN_FUNCTION_NAME = 4, + MAIN_FUNCTION_NAME = 5, } } diff --git a/api/typescript/src/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.js b/api/typescript/src/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.js index d0c4855650..fcf85dd28d 100644 --- a/api/typescript/src/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.js +++ b/api/typescript/src/core/kurtosis_core_rpc_api_bindings/api_container_service_pb.js @@ -11108,8 +11108,9 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.toObject = function(includeI var f, obj = { packageId: jspb.Message.getFieldWithDefault(msg, 1, ""), serializedParams: jspb.Message.getFieldWithDefault(msg, 2, ""), - relativePathToMainFile: jspb.Message.getFieldWithDefault(msg, 3, ""), - mainFunctionName: jspb.Message.getFieldWithDefault(msg, 4, "") + isRemote: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + relativePathToMainFile: jspb.Message.getFieldWithDefault(msg, 4, ""), + mainFunctionName: jspb.Message.getFieldWithDefault(msg, 5, "") }; if (includeInstance) { @@ -11155,10 +11156,14 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.deserializeBinaryFromReader msg.setSerializedParams(value); break; case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsRemote(value); + break; + case 4: var value = /** @type {string} */ (reader.readString()); msg.setRelativePathToMainFile(value); break; - case 4: + case 5: var value = /** @type {string} */ (reader.readString()); msg.setMainFunctionName(value); break; @@ -11205,9 +11210,9 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.serializeBinaryToWriter = fu f ); } - f = /** @type {string} */ (jspb.Message.getField(message, 3)); - if (f != null) { - writer.writeString( + f = message.getIsRemote(); + if (f) { + writer.writeBool( 3, f ); @@ -11219,6 +11224,13 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.serializeBinaryToWriter = fu f ); } + f = /** @type {string} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeString( + 5, + f + ); + } }; @@ -11277,11 +11289,29 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.hasSerializedParam /** - * optional string relative_path_to_main_file = 3; + * optional bool is_remote = 3; + * @return {boolean} + */ +proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.getIsRemote = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.api_container_api.StarlarkPackagePlanYamlArgs} returns this + */ +proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.setIsRemote = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional string relative_path_to_main_file = 4; * @return {string} */ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.getRelativePathToMainFile = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; @@ -11290,7 +11320,7 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.getRelativePathToM * @return {!proto.api_container_api.StarlarkPackagePlanYamlArgs} returns this */ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.setRelativePathToMainFile = function(value) { - return jspb.Message.setField(this, 3, value); + return jspb.Message.setField(this, 4, value); }; @@ -11299,7 +11329,7 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.setRelativePathToM * @return {!proto.api_container_api.StarlarkPackagePlanYamlArgs} returns this */ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.clearRelativePathToMainFile = function() { - return jspb.Message.setField(this, 3, undefined); + return jspb.Message.setField(this, 4, undefined); }; @@ -11308,16 +11338,16 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.clearRelativePathT * @return {boolean} */ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.hasRelativePathToMainFile = function() { - return jspb.Message.getField(this, 3) != null; + return jspb.Message.getField(this, 4) != null; }; /** - * optional string main_function_name = 4; + * optional string main_function_name = 5; * @return {string} */ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.getMainFunctionName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; @@ -11326,7 +11356,7 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.getMainFunctionNam * @return {!proto.api_container_api.StarlarkPackagePlanYamlArgs} returns this */ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.setMainFunctionName = function(value) { - return jspb.Message.setField(this, 4, value); + return jspb.Message.setField(this, 5, value); }; @@ -11335,7 +11365,7 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.setMainFunctionNam * @return {!proto.api_container_api.StarlarkPackagePlanYamlArgs} returns this */ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.clearMainFunctionName = function() { - return jspb.Message.setField(this, 4, undefined); + return jspb.Message.setField(this, 5, undefined); }; @@ -11344,7 +11374,7 @@ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.clearMainFunctionN * @return {boolean} */ proto.api_container_api.StarlarkPackagePlanYamlArgs.prototype.hasMainFunctionName = function() { - return jspb.Message.getField(this, 4) != null; + return jspb.Message.getField(this, 5) != null; }; diff --git a/api/typescript/src/core/kurtosis_core_rpc_api_bindings/connect/api_container_service_pb.d.ts b/api/typescript/src/core/kurtosis_core_rpc_api_bindings/connect/api_container_service_pb.d.ts index de9778ca61..ed997492ac 100644 --- a/api/typescript/src/core/kurtosis_core_rpc_api_bindings/connect/api_container_service_pb.d.ts +++ b/api/typescript/src/core/kurtosis_core_rpc_api_bindings/connect/api_container_service_pb.d.ts @@ -1914,17 +1914,24 @@ export declare class StarlarkPackagePlanYamlArgs extends Message [ { no: 1, name: "package_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 2, name: "serialized_params", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, - { no: 3, name: "relative_path_to_main_file", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, - { no: 4, name: "main_function_name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, + { no: 3, name: "is_remote", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 4, name: "relative_path_to_main_file", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, + { no: 5, name: "main_function_name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, ], ); diff --git a/cli/cli/commands/run/run.go b/cli/cli/commands/run/run.go old mode 100644 new mode 100755 index e271c849ae..35f647830f --- a/cli/cli/commands/run/run.go +++ b/cli/cli/commands/run/run.go @@ -3,9 +3,19 @@ package run import ( "context" "encoding/json" + "errors" "fmt" + "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/plumbing/transport" + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/starlark_run_config" + "github.com/kurtosis-tech/kurtosis/cli/cli/out" + "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/backend_creator" + "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/configs" + "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/image_download_mode" "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/user_support_constants" + "gopkg.in/yaml.v2" "io" + "k8s.io/utils/strings/slices" "net/http" "net/url" "os" @@ -15,10 +25,6 @@ import ( "regexp" "strings" - "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/starlark_run_config" - "gopkg.in/yaml.v2" - "k8s.io/utils/strings/slices" - "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/enclaves" "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/services" @@ -55,6 +61,11 @@ const ( dryRunFlagKey = "dry-run" defaultDryRun = "false" + dependenciesFlagKey = "dependencies" + dependenciesFlagDefault = "false" + pullDependenciesFlagKey = "pull" + pullDependenciesFlagDefault = "false" + fullUuidsFlagKey = "full-uuids" fullUuidFlagKeyDefault = "false" @@ -84,7 +95,8 @@ const ( kurtosisBackendCtxKey = "kurtosis-backend" engineClientCtxKey = "engine-client" - kurtosisYMLFilePath = "kurtosis.yml" + kurtosisYMLFilePath = "kurtosis.yml" + kurtosisYMLFilePerms = 0644 portMappingSeparatorForLogs = ", " @@ -106,7 +118,9 @@ const ( nonBlockingModeFlagKey = "non-blocking-tasks" defaultBlockingMode = "false" - httpProtocolRegexStr = "^(http|https)://" + httpProtocolRegexStr = "^(http|https)://" + shouldCloneNormalRepo = false + packageReplaceKeyInKurtosisYml = "replace:" ) var StarlarkRunCmd = &engine_consuming_kurtosis_command.EngineConsumingKurtosisCommand{ @@ -128,6 +142,18 @@ var StarlarkRunCmd = &engine_consuming_kurtosis_command.EngineConsumingKurtosisC Type: flags.FlagType_Bool, Default: defaultDryRun, }, + { + Key: dependenciesFlagKey, + Usage: "If true, a yaml will be output (to stdout) with a list of images and packages that this run depends on.", + Type: flags.FlagType_Bool, + Default: dependenciesFlagDefault, + }, + { + Key: pullDependenciesFlagKey, + Usage: fmt.Sprintf("If true, and the %s flag is passed, attempts to pull all images and packages that the run depends on locally. %s is updated with replace directives pointing to locally pulled packages. If a replace directive already exists an error is thrown. Note: this currently only works on the Docker backend.", dependenciesFlagKey, kurtosisYMLFilePath), + Type: flags.FlagType_Bool, + Default: pullDependenciesFlagDefault, + }, { Key: enclaveIdentifierFlagKey, Usage: "The enclave identifier of the enclave in which the script or package will be ran. " + @@ -262,6 +288,16 @@ func run( return stacktrace.Propagate(err, "Expected a boolean flag with key '%v' but none was found; this is an error in Kurtosis!", dryRunFlagKey) } + isDependenciesOnly, err := flags.GetBool(dependenciesFlagKey) + if err != nil { + return stacktrace.Propagate(err, "Expected a boolean flag with key '%v' but none was found; this is an error in Kurtosis!", dependenciesFlagKey) + } + + pullDependencies, err := flags.GetBool(pullDependenciesFlagKey) + if err != nil { + return stacktrace.Propagate(err, "Expected a boolean flag with key '%v' but none was found; this is an error in Kurtosis!", pullDependenciesFlagKey) + } + parallelism, err := flags.GetUint32(parallelismFlagKey) if err != nil { return stacktrace.Propagate(err, "Expected a integer flag with key '%v' but none was found; this is an error in Kurtosis!", parallelismFlagKey) @@ -366,6 +402,52 @@ func run( defer output_printers.PrintEnclaveName(enclaveCtx.GetEnclaveName()) } + isRemotePackage := strings.HasPrefix(starlarkScriptOrPackagePath, githubDomainPrefix) + + if isDependenciesOnly { + dependencyYaml, err := getPackageDependencyYaml(ctx, enclaveCtx, starlarkScriptOrPackagePath, isRemotePackage, packageArgs) + if err != nil { + return stacktrace.Propagate(err, "An error occurred getting package dependencies.") + } + + type PackageDependencies struct { + Images []string `yaml:"images"` + Packages []string `yaml:"packageDependencies"` + } + var pkgDeps PackageDependencies + err = yaml.Unmarshal([]byte(dependencyYaml.PlanYaml), &pkgDeps) + if err != nil { + return stacktrace.Propagate(err, "An error occurred unmarshalling dependency yaml string") + } + out.PrintOutLn("Images:") + for _, imageStr := range pkgDeps.Images { + out.PrintOutLn(fmt.Sprintf(" %s", imageStr)) + } + out.PrintOutLn("Packages:") + for _, packageStr := range pkgDeps.Packages { + out.PrintOutLn(fmt.Sprintf(" %s", packageStr)) + } + + if pullDependencies { + // errors below already wrapped w propagate + err = pullImagesLocally(ctx, pkgDeps.Images) + if err != nil { + return err + } + + packageNamesToLocalFilepaths, err := pullPackagesLocally(pkgDeps.Packages) + if err != nil { + return err + } + + err = updateKurtosisYamlWithReplaceDirectives(packageNamesToLocalFilepaths) + if err != nil { + return err + } + } + return nil + } + var responseLineChan <-chan *kurtosis_core_rpc_api_bindings.StarlarkRunResponseLine var cancelFunc context.CancelFunc var errRunningKurtosis error @@ -375,7 +457,6 @@ func run( connect = kurtosis_core_rpc_api_bindings.Connect_NO_CONNECT } - isRemotePackage := strings.HasPrefix(starlarkScriptOrPackagePath, githubDomainPrefix) if isRemotePackage { responseLineChan, cancelFunc, errRunningKurtosis = executeRemotePackage(ctx, enclaveCtx, starlarkScriptOrPackagePath, starlarkRunConfig) } else { @@ -588,6 +669,54 @@ func getOrCreateEnclaveContext( return enclaveContext, isNewEnclaveFlagWhenCreated, nil } +func getPackageDependencyYaml( + ctx context.Context, + enclaveCtx *enclaves.EnclaveContext, + starlarkScriptOrPackageId string, + isRemote bool, + packageArgs string, +) (*kurtosis_core_rpc_api_bindings.PlanYaml, error) { + var packageYaml *kurtosis_core_rpc_api_bindings.PlanYaml + var err error + if isRemote { + packageYaml, err = enclaveCtx.GetStarlarkRemotePackagePlanYaml(ctx, starlarkScriptOrPackageId, packageArgs) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred retrieving plan yaml for provided package.") + } + } else { + fileOrDir, err := os.Stat(starlarkScriptOrPackageId) + if err != nil { + return nil, stacktrace.Propagate(err, "There was an error reading file or package from disk at '%v'", starlarkScriptOrPackageId) + } + + if isStandaloneScript(fileOrDir, kurtosisYMLFilePath) { + scriptContentBytes, err := os.ReadFile(starlarkScriptOrPackageId) + if err != nil { + return nil, stacktrace.Propagate(err, "Unable to read content of Starlark script file '%s'", starlarkScriptOrPackageId) + } + packageYaml, err = enclaveCtx.GetStarlarkScriptPlanYaml(ctx, string(scriptContentBytes), packageArgs) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred retrieving plan yaml for provided package.") + } + } else { + // if the path is a file with `kurtosis.yml` at the end it's a module dir + // we remove the `kurtosis.yml` to get just the Dir containing the module + if isKurtosisYMLFileInPackageDir(fileOrDir, kurtosisYMLFilePath) { + starlarkScriptOrPackageId = path.Dir(starlarkScriptOrPackageId) + } + // we pass the sanitized path and look for a Kurtosis YML within it to get the package name + if err != nil { + return nil, stacktrace.Propagate(err, "Tried parsing Kurtosis YML at '%v' to get package name but failed", starlarkScriptOrPackageId) + } + packageYaml, err = enclaveCtx.GetStarlarkPackagePlanYaml(ctx, starlarkScriptOrPackageId, packageArgs) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred retrieving plan yaml for provided package.") + } + } + } + return packageYaml, nil +} + // validatePackageArgs just validates the args is a valid JSON or YAML string func validatePackageArgs(_ context.Context, _ *flags.ParsedFlags, args *args.ParsedArgs) error { serializedArgs, err := args.GetNonGreedyArg(inputArgsArgKey) @@ -612,7 +741,6 @@ func parseVerbosityFlag(flags *flags.ParsedFlags) (command_args_run.Verbosity, e // Get the image download flag is present, and parse it to a valid ImageDownload value func parseImageDownloadFlag(flags *flags.ParsedFlags) (*kurtosis_core_rpc_api_bindings.ImageDownloadMode, error) { - imageDownloadStr, err := flags.GetString(imageDownloadFlagKey) if err != nil { return nil, stacktrace.Propagate(err, "An error occurred getting the image-download using flag key '%s'", imageDownloadFlagKey) @@ -734,3 +862,117 @@ func isHttpUrl(maybeHttpUrl string) bool { httpProtocolRegex := regexp.MustCompile(httpProtocolRegexStr) return httpProtocolRegex.MatchString(maybeHttpUrl) } + +func pullImagesLocally(ctx context.Context, images []string) error { + kurtosisBackend, err := backend_creator.GetDockerKurtosisBackend(backend_creator.NoAPIContainerModeArgs, configs.NoRemoteBackendConfig) + if err != nil { + return stacktrace.Propagate(err, "An error occurred retrieving Docker Kurtosis Backend") + } + for _, img := range images { + _, _, err := kurtosisBackend.FetchImage(ctx, img, nil, image_download_mode.ImageDownloadMode_Always) + if err != nil { + return stacktrace.Propagate(err, "An error occurred pulling '%v' locally.", img) + } + } + return nil +} + +func pullPackagesLocally(packageDependencies []string) (map[string]string, error) { + localPackagesToRelativeFilepaths := map[string]string{} + + workingDirectory, err := os.Getwd() + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred getting current working directory.") + } + // ensure a kurtosis yml exists here so that packages get cloned to the right place (one dir above/nested in the same dir as the package) + if _, err := os.Stat(fmt.Sprintf("%s/%s", workingDirectory, kurtosisYMLFilePath)); err != nil { + if errors.Is(err, os.ErrNotExist) { + return nil, stacktrace.Propagate(err, "'%s' does not exist in current working directory. Make sure you are running this at the root of the package with the %s.", kurtosisYMLFilePath, kurtosisYMLFilePath) + } else { + return nil, stacktrace.Propagate(err, "An error occurred checking if %s exists.", kurtosisYMLFilePath) + } + } + + file, err := os.OpenFile(kurtosisYMLFilePath, os.O_WRONLY|os.O_APPEND, kurtosisYMLFilePerms) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred opening '%s' file. Make sure this command is being run from within the directory of a kurtosis package.", kurtosisYMLFilePath) + } + defer file.Close() + + parentCwd := filepath.Dir(workingDirectory) + relParentCwd, err := filepath.Rel(workingDirectory, parentCwd) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred getting rel path between '%v' and '%v'.", workingDirectory, relParentCwd) + } + for _, dependency := range packageDependencies { + packageIdParts := strings.Split(dependency, "/") + packageName := packageIdParts[len(packageIdParts)-1] + logrus.Infof("Pulling package: %v", dependency) + + var repoUrl string + if !strings.HasPrefix("http://", dependency) { + repoUrl = "http://" + dependency + } + if !strings.HasSuffix(".git", dependency) { + repoUrl += ".git" + } + localPackagePath := fmt.Sprintf("%s/%s", parentCwd, packageName) + _, err := git.PlainClone(localPackagePath, shouldCloneNormalRepo, &git.CloneOptions{ + URL: repoUrl, + Auth: nil, + RemoteName: "", + ReferenceName: "", + SingleBranch: false, + Mirror: false, + NoCheckout: false, + Depth: 0, + RecurseSubmodules: 0, + ShallowSubmodules: false, + Progress: nil, + Tags: 0, + InsecureSkipTLS: false, + CABundle: nil, + ProxyOptions: transport.ProxyOptions{ + URL: "", + Username: "", + Password: "", + }, + Shared: false, + }) + if err != nil && !errors.Is(err, git.ErrRepositoryAlreadyExists) { + return nil, stacktrace.Propagate(err, "An error occurred cloning package '%s' to '%s'.", dependency, localPackagePath) + } + localPackagesToRelativeFilepaths[dependency] = fmt.Sprintf("%s/%s", relParentCwd, packageName) + } + + return localPackagesToRelativeFilepaths, nil +} + +func updateKurtosisYamlWithReplaceDirectives(packageNamesToLocalFilepaths map[string]string) error { + file, err := os.OpenFile(kurtosisYMLFilePath, os.O_WRONLY|os.O_APPEND, kurtosisYMLFilePerms) + if err != nil { + return stacktrace.Propagate(err, "An error occurred opening '%s' file.", kurtosisYMLFilePath) + } + defer file.Close() + + // assume kurtosis.yml is a small file so okay to read into memory + kurtosisYmlBytes, err := os.ReadFile(kurtosisYMLFilePath) + if err != nil { + return stacktrace.Propagate(err, "An error occurred reading '%s' file.", kurtosisYMLFilePath) + } + replaceDirectiveStr := fmt.Sprintf("%s\n", packageReplaceKeyInKurtosisYml) + for packageName, localFilepath := range packageNamesToLocalFilepaths { + // TODO: this assumes the users kurtosis yml is indented by two spaces which might always not be true and this could break a users kurtosis.yml + // TODO: find a way to handle other indentation levels + replaceDirectiveStr += fmt.Sprintf(" %s: %s\n", packageName, localFilepath) + } + if strings.Contains(string(kurtosisYmlBytes), packageReplaceKeyInKurtosisYml) { + logrus.Infof("A replace directive was already detected in '%s' so we will avoid overwriting it. Update the replace directive with the following:\n%s", kurtosisYMLFilePath, replaceDirectiveStr) + return nil + } + _, err = file.Write([]byte(replaceDirectiveStr)) + if err != nil { + return stacktrace.Propagate(err, "An error occurred writing '%s' to kurtosis.yml", replaceDirectiveStr) + } + return nil +} diff --git a/cli/cli/helpers/host_machine_directories/host_machine_directories.go b/cli/cli/helpers/host_machine_directories/host_machine_directories.go index d78a53dbb9..3d210728be 100644 --- a/cli/cli/helpers/host_machine_directories/host_machine_directories.go +++ b/cli/cli/helpers/host_machine_directories/host_machine_directories.go @@ -1,9 +1,13 @@ package host_machine_directories import ( + "io/ioutil" + "path" + "path/filepath" + "github.com/adrg/xdg" "github.com/kurtosis-tech/stacktrace" - "path" + "github.com/sirupsen/logrus" ) const ( @@ -107,9 +111,19 @@ func GetLastPesteredUserAboutOldVersionsFilepath() (string, error) { func GetKurtosisCliLogsFileDirPath(fileName string) (string, error) { xdgRelDirPath := getRelativeFilePathForKurtosisCliLogs() - kurtosisCliLogFilePath, err := xdg.DataFile(path.Join(xdgRelDirPath, fileName)) - if err != nil { - return "", stacktrace.Propagate(err, "An error occurred getting the kurtosis cli logs file path using '%v'", kurtosisCliLogFilePath) + // kurtosisCliLogFilePath, err := xdg.DataFile(path.Join(xdgRelDirPath, fileName)) + // if err != nil { + // return "", stacktrace.Propagate(err, "An error occurred getting the kurtosis cli logs file path using '%v'", kurtosisCliLogFilePath) + // } + kurtosisCliLogFilePath, errXdg := xdg.DataFile(path.Join(xdgRelDirPath, fileName)) + if errXdg != nil { + // Fallback to temp folder if XDG fails to find a suitable location. For instance XDG will fail when testing inside Nix sandbox. + logrus.WithError(errXdg).Warnf("Couldn't create kurtosis cli logs file path in the user space '%v'. Trying on temp folder.", kurtosisCliLogFilePath) + kurtosisCliLogDir, errTemp := ioutil.TempDir("", applicationDirname) + if errTemp != nil { + return "", stacktrace.Propagate(errTemp, "An error occurred creating kurtosis cli logs file path using '%v'", kurtosisCliLogDir) + } + kurtosisCliLogFilePath = filepath.Join(kurtosisCliLogDir, fileName) } return kurtosisCliLogFilePath, nil } diff --git a/cli/cli/kurtosis_package/kurtosis_package.go b/cli/cli/kurtosis_package/kurtosis_package.go index aad6888721..e4ec209f18 100644 --- a/cli/cli/kurtosis_package/kurtosis_package.go +++ b/cli/cli/kurtosis_package/kurtosis_package.go @@ -26,7 +26,7 @@ func InitializeKurtosisPackage(packageDirpath string, packageName string, isExec // validate package name _, err := shared_utils.ParseGitURL(packageName) if err != nil { - return stacktrace.Propagate(err, "An erro occurred validating package name '%v', invalid GitHub URL", packageName) + return stacktrace.Propagate(err, "An error occurred validating package name '%v', invalid GitHub URL", packageName) } logrus.Debugf("Initializaing the '%s' Kurtosis package...", packageName) diff --git a/cli/cli/scripts/build.sh b/cli/cli/scripts/build.sh index 0f8401c209..026a0de506 100755 --- a/cli/cli/scripts/build.sh +++ b/cli/cli/scripts/build.sh @@ -97,10 +97,11 @@ fi exit 1 fi # Executing goreleaser v1.26.2 without needing to install it - if ! curl -sfL https://goreleaser.com/static/run | VERSION=v1.26.2 DISTRIBUTION=oss bash -s -- ${goreleaser_verb_and_flags}; then - echo "Error: Couldn't build the CLI binary for the current OS/arch" >&2 - exit 1 - fi +# if ! curl -sfL https://goreleaser.com/static/run | VERSION=v1.26.2 DISTRIBUTION=oss bash -s -- ${goreleaser_verb_and_flags}; then + if ! GORELEASER_CURRENT_TAG=$(cat $root_dirpath/version.txt) goreleaser ${goreleaser_verb_and_flags}; then + echo "Error: Couldn't build the CLI binary for the current OS/arch" >&2 + exit 1 + fi ) # Final verification diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/consts/consts.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/consts/consts.go index 8bf4bbefae..62aa91dae6 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/consts/consts.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/consts/consts.go @@ -29,7 +29,7 @@ const ( EngineConfigLocalDir = "/run/engine" //The Docker network name where all the containers in the engine and logs service context will be added - NameOfNetworkToStartEngineAndLogServiceContainersIn = "bridge" + NameOfNetworkToStartEngineAndLogServiceContainersIn = "podman" HttpApplicationProtocol = "http" GitHubAuthStorageDirPath = "/kurtosis-data/github-auth/" diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/reverse_proxy_functions/network_reverse_proxy.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/reverse_proxy_functions/network_reverse_proxy.go index 109e4c1c20..539e91eb9c 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/reverse_proxy_functions/network_reverse_proxy.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/reverse_proxy_functions/network_reverse_proxy.go @@ -2,7 +2,9 @@ package reverse_proxy_functions import ( "context" + "github.com/sirupsen/logrus" "net" + "time" "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_manager" "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/docker_label_key" @@ -34,6 +36,9 @@ func ConnectReverseProxyToNetwork(ctx context.Context, dockerManager *docker_man return nil } + logrus.Infof("Waiting a few second before connecting reverse proxy to network...") + time.Sleep(10 * time.Second) + logrus.Infof("Okay lets try and connect now.") if err = dockerManager.ConnectContainerToNetwork(ctx, networkId, maybeReverseProxyContainerId, autoAssignIpAddressToReverseProxy, emptyAliasForReverseProxy); err != nil { return stacktrace.Propagate(err, "An error occurred while connecting the reverse proxy with container id '%v' to the enclave network '%v'", maybeReverseProxyContainerId, networkId) } diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/shared_helpers/shared_helpers.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/shared_helpers/shared_helpers.go index 18c3e533e2..ba9c236e66 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/shared_helpers/shared_helpers.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/shared_helpers/shared_helpers.go @@ -5,7 +5,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/docker_label_key" "io" "net" "os" @@ -14,6 +13,8 @@ import ( "strings" "time" + "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/docker_label_key" + "github.com/docker/docker/pkg/stdcopy" "github.com/docker/go-connections/nat" "github.com/gammazero/workerpool" @@ -417,24 +418,24 @@ func GetEngineAndLogsComponentsNetwork( ctx context.Context, dockerManager *docker_manager.DockerManager, ) (*types.Network, error) { - matchingNetworks, err := dockerManager.GetNetworksByName(ctx, consts.NameOfNetworkToStartEngineAndLogServiceContainersIn) - if err != nil { - return nil, stacktrace.Propagate( - err, - "An error occurred getting networks matching the network we want to start the engine in, '%v'", - consts.NameOfNetworkToStartEngineAndLogServiceContainersIn, - ) - } - numMatchingNetworks := len(matchingNetworks) - if numMatchingNetworks == 0 && numMatchingNetworks > 1 { - return nil, stacktrace.NewError( - "Expected exactly one network matching the name of the network that we want to start the engine in, '%v', but got %v", - consts.NameOfNetworkToStartEngineAndLogServiceContainersIn, - numMatchingNetworks, - ) - } - targetNetwork := matchingNetworks[0] - return targetNetwork, nil + // matchingNetworks, err := dockerManager.GetNetworksByName(ctx, consts.NameOfNetworkToStartEngineAndLogServiceContainersIn) + // if err != nil { + // return nil, stacktrace.Propagate( + // err, + // "An error occurred getting networks matching the network we want to start the engine in, '%v'", + // consts.NameOfNetworkToStartEngineAndLogServiceContainersIn, + // ) + // } + // numMatchingNetworks := len(matchingNetworks) + // if numMatchingNetworks == 0 && numMatchingNetworks > 1 { + // return nil, stacktrace.NewError( + // "Expected exactly one network matching the name of the network that we want to start the engine in, '%v', but got %v", + // consts.NameOfNetworkToStartEngineAndLogServiceContainersIn, + // numMatchingNetworks, + // ) + // } + // targetNetwork := matchingNetworks[0] + return dockerManager.GetDefaultNetwork(ctx) } func DumpContainers(ctx context.Context, dockerManager *docker_manager.DockerManager, containers []*types.Container, outputDirpath string) error { diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/user_services_functions/start_user_services.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/user_services_functions/start_user_services.go index 371937bbf6..ce2759b592 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/user_services_functions/start_user_services.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/user_services_functions/start_user_services.go @@ -669,15 +669,15 @@ func createStartServiceOperation( } } - if logsCollectorAddress == "" { - return nil, stacktrace.NewError("Expected to have a logs collector server address value to send the user service logs, but it is empty") - } + // if logsCollectorAddress == "" { + // return nil, stacktrace.NewError("Expected to have a logs collector server address value to send the user service logs, but it is empty") + // } - // The container will be configured to send the logs to the Fluentbit logs collector server - fluentdLoggingDriverCnfg := docker_manager.NewFluentdLoggingDriver( - logsCollectorAddress, - logsCollectorLabels, - ) + // // The container will be configured to send the logs to the Fluentbit logs collector server + // fluentdLoggingDriverCnfg := docker_manager.NewFluentdLoggingDriver( + // logsCollectorAddress, + // logsCollectorLabels, + // ) createAndStartArgsBuilder := docker_manager.NewCreateAndStartContainerArgsBuilder( containerImageName, @@ -703,8 +703,8 @@ func createStartServiceOperation( tiniEnabled, ).WithVolumeMounts( volumeMounts, - ).WithLoggingDriver( - fluentdLoggingDriverCnfg, + // ).WithLoggingDriver( + // fluentdLoggingDriverCnfg, ).WithRestartPolicy( restartPolicy, ).WithUser( diff --git a/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_auth.go b/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_auth.go index e956126d92..8e0d47f19c 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_auth.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_auth.go @@ -143,6 +143,11 @@ func GetAuthFromDockerConfig(repo string) (*registry.AuthConfig, error) { return nil, err } + // if repo string doesn't contain a repo prefix assume its an official docker library image + if !strings.Contains(repo, "/") { + repo = "library/" + repo + } + registryHost := dockerregistry.ConvertToHostname(repo) if !strings.Contains(registryHost, ".") || registryHost == "docker.io" || registryHost == "registry-1.docker.io" { diff --git a/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_manager.go b/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_manager.go index cff367eb32..c8e8e0432e 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_manager.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_manager.go @@ -413,6 +413,32 @@ func (manager *DockerManager) RemoveNetwork(context context.Context, networkId s return nil } +func (manager *DockerManager) GetDefaultNetwork(ctx context.Context) (*docker_manager_types.Network, error) { + + matchingNetworks, err := manager.GetNetworksByName(ctx, consts.NameOfNetworkToStartEngineAndLogServiceContainersIn) + if err != nil { + return nil, stacktrace.Propagate( + err, + "An error occurred getting networks matching the network we want to start the engine in, '%v'", + consts.NameOfNetworkToStartEngineAndLogServiceContainersIn, + ) + } + numMatchingNetworks := len(matchingNetworks) + if numMatchingNetworks > 1 { + return nil, stacktrace.NewError( + "Expected exactly one network matching the name of the network that we want to start the engine in, '%v', but got %v", + consts.NameOfNetworkToStartEngineAndLogServiceContainersIn, + numMatchingNetworks, + ) + } + + if numMatchingNetworks == 0 { + return nil, stacktrace.NewError(fmt.Sprintf("No matching network found with the configured name: %v", consts.NameOfNetworkToStartEngineAndLogServiceContainersIn)) + } + + return matchingNetworks[0], nil +} + /* CreateVolume Creates a Docker volume identified by the given name. @@ -481,6 +507,21 @@ func (manager *DockerManager) GetVolumesByLabels(ctx context.Context, labels map result := []*volume.Volume{} if resp.Volumes != nil { + // Podman API inconsistency - filter out the union matches that podman returns while docker only returns the intersect matches when filtering by label + for _, vol := range resp.Volumes { + allLabelsMatch := true + + for label, val := range labels { + if volValue, exists := vol.Labels[label]; !exists || volValue != val { + allLabelsMatch = false + break + } + } + + if allLabelsMatch { + result = append(result, vol) + } + } result = resp.Volumes } @@ -804,8 +845,17 @@ func (manager *DockerManager) GetContainerIps(ctx context.Context, containerId s return nil, stacktrace.Propagate(err, "An error occurred inspecting container with ID '%v'", containerId) } allNetworkInfo := resp.NetworkSettings.Networks - for _, networkInfo := range allNetworkInfo { - containerIps[networkInfo.NetworkID] = networkInfo.IPAddress + // for _, networkInfo := range allNetworkInfo { + // containerIps[networkInfo.NetworkID] = networkInfo.IPAddress + // } + for networkKey, networkInfo := range allNetworkInfo { + // podman does not return the networkID properly and as such we need to make sure we get it. + network, err := manager.dockerClient.NetworkInspect(ctx, networkInfo.NetworkID, types.NetworkInspectOptions{}) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred inspecting network: '%v'", networkKey) + } + + containerIps[network.ID] = networkInfo.IPAddress } return containerIps, nil } @@ -1172,6 +1222,15 @@ func (manager *DockerManager) ConnectContainerToNetwork(ctx context.Context, net config := getEndpointSettingsForIpAddress(staticIpAddressStr, alias) + logrus.Infof("Listing all networks right before attempting to connect to network...") + networkResources, err := manager.dockerClient.NetworkList(ctx, types.NetworkListOptions{}) + for _, networkResource := range networkResources { + logrus.Infof("Information about network '%v' that exists: %v", networkResource.Name, networkResource) + if networkResource.ID == networkId { + logrus.Infof("The network we are trying to connect to exists right before connection.") + } + } + err = manager.dockerClient.NetworkConnect( ctx, networkId, @@ -1738,7 +1797,7 @@ func (manager *DockerManager) getContainerHostConfig( portMap[containerPort] = []nat.PortBinding{ // Leaving this struct empty will cause Docker to automatically choose an interface IP & port on the host machine { - HostIP: "", + HostIP: "0.0.0.0", HostPort: "", }, } @@ -1773,6 +1832,7 @@ func (manager *DockerManager) getContainerHostConfig( securityOptStr := string(securityOpt) securityOptsSlice = append(securityOptsSlice, securityOptStr) } + securityOptsSlice = append(securityOptsSlice, "") extraHosts := []string{} if needsToAccessDockerHostMachine { @@ -1875,21 +1935,25 @@ func (manager *DockerManager) getContainerHostConfig( Privileged: false, PublishAllPorts: false, ReadonlyRootfs: false, - SecurityOpt: securityOptsSlice, - StorageOpt: nil, - Tmpfs: nil, - UTSMode: "", - UsernsMode: "", - ShmSize: 0, - Sysctls: nil, - Runtime: "", - ConsoleSize: [2]uint{}, - Isolation: "", - Resources: resources, - Mounts: nil, - MaskedPaths: nil, - ReadonlyPaths: nil, - Init: &useInit, + //SecurityOpt: securityOptsSlice, + SecurityOpt: []string{ + "label=disable", // Disables SELinux + "apparmor:unconfined", // Disables AppArmor + }, + StorageOpt: nil, + Tmpfs: nil, + UTSMode: "", + UsernsMode: "", + ShmSize: 0, + Sysctls: nil, + Runtime: "", + ConsoleSize: [2]uint{}, + Isolation: "", + Resources: resources, + Mounts: nil, + MaskedPaths: nil, + ReadonlyPaths: nil, + Init: &useInit, } return containerHostConfigPtr, nil } @@ -2283,13 +2347,15 @@ func pullImage(dockerClient *client.Client, imageName string, registrySpec *imag // Try to obtain the auth configuration from the docker config file authConfig, err := GetAuthFromDockerConfig(imageName) if err != nil { - logrus.Errorf("An error occurred while getting auth config for image: %s: %s", imageName, err.Error()) + logrus.Warnf("An error occurred while getting auth config for image: %s: %s", imageName, err.Error()) + logrus.Warnf("Falling back to pulling image with no auth config.") } if authConfig != nil { authFromConfig, err := registry.EncodeAuthConfig(*authConfig) if err != nil { - logrus.Errorf("An error occurred while encoding auth config for image: %s: %s", imageName, err.Error()) + logrus.Warnf("An error occurred while encoding auth config for image: %s: %s", imageName, err.Error()) + logrus.Warnf("Falling back to pulling image with no auth config.") } else { imagePullOptions.RegistryAuth = authFromConfig } diff --git a/core/server/api_container/server/api_container_service.go b/core/server/api_container/server/api_container_service.go index eabdf4a60d..656346d21b 100644 --- a/core/server/api_container/server/api_container_service.go +++ b/core/server/api_container/server/api_container_service.go @@ -670,7 +670,7 @@ func (apicService *ApiContainerService) GetStarlarkPackagePlanYaml(ctx context.C var detectedPackageReplaceOptions map[string]string var actualRelativePathToMainFile string scriptWithRunFunction, actualRelativePathToMainFile, detectedPackageId, detectedPackageReplaceOptions, interpretationError = - apicService.runStarlarkPackageSetup(packageIdFromArgs, true, nil, requestedRelativePathToMainFile) + apicService.runStarlarkPackageSetup(packageIdFromArgs, args.IsRemote, nil, requestedRelativePathToMainFile) if interpretationError != nil { return nil, stacktrace.Propagate(interpretationError, "An interpretation error occurred setting up the package for retrieving plan yaml for package: %v", packageIdFromArgs) } diff --git a/core/server/api_container/server/startosis_engine/builtins/import_module/import_module.go b/core/server/api_container/server/startosis_engine/builtins/import_module/import_module.go index 7e2351748f..143c9ce354 100644 --- a/core/server/api_container/server/startosis_engine/builtins/import_module/import_module.go +++ b/core/server/api_container/server/startosis_engine/builtins/import_module/import_module.go @@ -19,7 +19,7 @@ const ( /* NewImportModule returns a sequential (not parallel) implementation of an equivalent or `load` in Starlark - This function returns a starlarkstruct.Module object that can then me used to get variables and call functions from the loaded module. + This function returns a starlarkstruct.Module object that can then be used to get variables and call functions from the loaded module. How does the returned function work? 1. The function first checks whether a module is currently loading. If so then there's cycle and it errors immediately, diff --git a/core/server/api_container/server/startosis_engine/instructions_plan/instructions_plan.go b/core/server/api_container/server/startosis_engine/instructions_plan/instructions_plan.go index 38e42655d4..4b5f8b2dc6 100644 --- a/core/server/api_container/server/startosis_engine/instructions_plan/instructions_plan.go +++ b/core/server/api_container/server/startosis_engine/instructions_plan/instructions_plan.go @@ -21,6 +21,9 @@ type InstructionsPlan struct { scheduledInstructionsIndex map[ScheduledInstructionUuid]*ScheduledInstruction instructionsSequence []ScheduledInstructionUuid + + // list of package names that this instructions plan relies on + packageDependencies map[string]bool } func NewInstructionsPlan() *InstructionsPlan { @@ -28,6 +31,7 @@ func NewInstructionsPlan() *InstructionsPlan { indexOfFirstInstruction: 0, scheduledInstructionsIndex: map[ScheduledInstructionUuid]*ScheduledInstruction{}, instructionsSequence: []ScheduledInstructionUuid{}, + packageDependencies: map[string]bool{}, } } @@ -77,7 +81,7 @@ func (plan *InstructionsPlan) GeneratePlan() ([]*ScheduledInstruction, *startosi } // GenerateYaml takes in an existing planYaml (usually empty) and returns a yaml string containing the effects of the plan -func (plan *InstructionsPlan) GenerateYaml(planYaml *plan_yaml.PlanYaml) (string, error) { +func (plan *InstructionsPlan) GenerateYaml(planYaml *plan_yaml.PlanYamlGenerator) (string, error) { for _, instructionUuid := range plan.instructionsSequence { instruction, found := plan.scheduledInstructionsIndex[instructionUuid] if !found { @@ -88,9 +92,14 @@ func (plan *InstructionsPlan) GenerateYaml(planYaml *plan_yaml.PlanYaml) (string return "", startosis_errors.WrapWithInterpretationError(err, "An error occurred updating the plan with instruction: %v.", instructionUuid) } } + planYaml.AddPackageDependencies(plan.packageDependencies) return planYaml.GenerateYaml() } +func (plan *InstructionsPlan) AddPackageDependency(packageDependency string) { + plan.packageDependencies[packageDependency] = true +} + func (plan *InstructionsPlan) Size() int { return len(plan.instructionsSequence) } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service.go index 903b30c358..b92b70528c 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service.go @@ -286,7 +286,7 @@ func (builtin *AddServiceCapabilities) FillPersistableAttributes(builder *enclav ) } -func (builtin *AddServiceCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYaml) error { +func (builtin *AddServiceCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYamlGenerator) error { var buildContextLocator string var targetStage string var registryAddress string diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_services.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_services.go index c221488f85..6e1ec87f8a 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_services.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_services.go @@ -370,7 +370,7 @@ func (builtin *AddServicesCapabilities) allServicesReadinessCheck( return failedServiceChecksRegularMap } -func (builtin *AddServicesCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *AddServicesCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { // TOOD: Implement logrus.Warn("ADD SERVICES NOT IMPLEMENTED YET FOR UPDATING PLAN YAML.") return nil diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/exec/exec.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/exec/exec.go index 14f9ef0821..bcea5246b1 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/exec/exec.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/exec/exec.go @@ -214,7 +214,7 @@ func (builtin *ExecCapabilities) FillPersistableAttributes(builder *enclave_plan builder.SetType(ExecBuiltinName) } -func (builtin *ExecCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYaml) error { +func (builtin *ExecCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYamlGenerator) error { err := planYaml.AddExec(string(builtin.serviceName), builtin.description, builtin.returnValue, builtin.cmdList, builtin.acceptableCodes) if err != nil { return stacktrace.Propagate(err, "An error occurred updating plan with exec.") diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_files_artifact/get_files_artifact.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_files_artifact/get_files_artifact.go index da3b565027..60122ee167 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_files_artifact/get_files_artifact.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_files_artifact/get_files_artifact.go @@ -93,7 +93,7 @@ func (builtin *GetFilesArtifactCapabilities) FillPersistableAttributes(builder * builder.SetType(GetFilesArtifactBuiltinName).AddFilesArtifact(builtin.artifactName, nil) } -func (builtin *GetFilesArtifactCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYaml) error { +func (builtin *GetFilesArtifactCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYamlGenerator) error { // get files artifact does not affect the planYaml return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_service/get_service.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_service/get_service.go index 17b5aa7a2a..98ce8d9fd1 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_service/get_service.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_service/get_service.go @@ -103,7 +103,7 @@ func (builtin *GetServiceCapabilities) FillPersistableAttributes(builder *enclav builder.SetType(GetServiceBuiltinName).AddServiceName(builtin.serviceName) } -func (builtin *GetServiceCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYaml) error { +func (builtin *GetServiceCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYamlGenerator) error { // get service does not affect the plan return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_services/get_services.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_services/get_services.go index 05d2667a24..991cbdb907 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_services/get_services.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_services/get_services.go @@ -92,7 +92,7 @@ func (builtin *GetServicesCapabilities) FillPersistableAttributes(builder *encla builder.SetType(GetServicesBuiltinName) } -func (builtin *GetServicesCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYaml) error { +func (builtin *GetServicesCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYamlGenerator) error { // get services does not affect the plan return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/kurtosis_instruction.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/kurtosis_instruction.go index 97c2fd1749..cf959b6c98 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/kurtosis_instruction.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/kurtosis_instruction.go @@ -36,5 +36,5 @@ type KurtosisInstruction interface { GetPersistableAttributes() *enclave_plan_persistence.EnclavePlanInstructionBuilder // UpdatePlan updates the plan with the effects of running this instruction. - UpdatePlan(plan *plan_yaml.PlanYaml) error + UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/kurtosis_print/kurtosis_print.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/kurtosis_print/kurtosis_print.go index c111b0a098..6608f7e68c 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/kurtosis_print/kurtosis_print.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/kurtosis_print/kurtosis_print.go @@ -106,7 +106,7 @@ func (builtin *PrintCapabilities) FillPersistableAttributes(builder *enclave_pla builder.SetType(PrintBuiltinName) } -func (builitin *PrintCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builitin *PrintCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { // print does not affect the plan return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/mock_instruction/mock_kurtosis_instruction.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/mock_instruction/mock_kurtosis_instruction.go index 6d22f66a9c..a81b33fe94 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/mock_instruction/mock_kurtosis_instruction.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/mock_instruction/mock_kurtosis_instruction.go @@ -347,11 +347,11 @@ func (_c *MockKurtosisInstruction_TryResolveWith_Call) RunAndReturn(run func(*en } // UpdatePlan provides a mock function with given fields: plan -func (_m *MockKurtosisInstruction) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (_m *MockKurtosisInstruction) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { ret := _m.Called(plan) var r0 error - if rf, ok := ret.Get(0).(func(*plan_yaml.PlanYaml) error); ok { + if rf, ok := ret.Get(0).(func(*plan_yaml.PlanYamlGenerator) error); ok { r0 = rf(plan) } else { r0 = ret.Error(0) @@ -366,14 +366,14 @@ type MockKurtosisInstruction_UpdatePlan_Call struct { } // UpdatePlan is a helper method to define mock.On call -// - plan *plan_yaml.PlanYaml +// - plan *plan_yaml.PlanYamlGenerator func (_e *MockKurtosisInstruction_Expecter) UpdatePlan(plan interface{}) *MockKurtosisInstruction_UpdatePlan_Call { return &MockKurtosisInstruction_UpdatePlan_Call{Call: _e.mock.On("UpdatePlan", plan)} } -func (_c *MockKurtosisInstruction_UpdatePlan_Call) Run(run func(plan *plan_yaml.PlanYaml)) *MockKurtosisInstruction_UpdatePlan_Call { +func (_c *MockKurtosisInstruction_UpdatePlan_Call) Run(run func(plan *plan_yaml.PlanYamlGenerator)) *MockKurtosisInstruction_UpdatePlan_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*plan_yaml.PlanYaml)) + run(args[0].(*plan_yaml.PlanYamlGenerator)) }) return _c } @@ -383,7 +383,7 @@ func (_c *MockKurtosisInstruction_UpdatePlan_Call) Return(_a0 error) *MockKurtos return _c } -func (_c *MockKurtosisInstruction_UpdatePlan_Call) RunAndReturn(run func(*plan_yaml.PlanYaml) error) *MockKurtosisInstruction_UpdatePlan_Call { +func (_c *MockKurtosisInstruction_UpdatePlan_Call) RunAndReturn(run func(*plan_yaml.PlanYamlGenerator) error) *MockKurtosisInstruction_UpdatePlan_Call { _c.Call.Return(run) return _c } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/remove_service/remove_service.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/remove_service/remove_service.go index d905da7e81..d4358a62b8 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/remove_service/remove_service.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/remove_service/remove_service.go @@ -114,7 +114,7 @@ func (builtin *RemoveServiceCapabilities) FillPersistableAttributes(builder *enc ) } -func (builtin *RemoveServiceCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *RemoveServiceCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { plan.RemoveService(string(builtin.serviceName)) return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/render_templates/render_templates.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/render_templates/render_templates.go index 40e92fbf56..e2a05e08a6 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/render_templates/render_templates.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/render_templates/render_templates.go @@ -174,7 +174,7 @@ func (builtin *RenderTemplatesCapabilities) FillPersistableAttributes(builder *e ) } -func (builtin *RenderTemplatesCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *RenderTemplatesCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { filepaths := []string{} for filepath := range builtin.templatesAndDataByDestRelFilepath { filepaths = append(filepaths, filepath) diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/request/request.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/request/request.go index 2a893d2672..538ec28afa 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/request/request.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/request/request.go @@ -209,7 +209,7 @@ func (builtin *RequestCapabilities) FillPersistableAttributes(builder *enclave_p builder.SetType(RequestBuiltinName) } -func (builtin *RequestCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *RequestCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { // TODO: Implement logrus.Warn("REQUEST NOT IMPLEMENTED YET FOR UPDATING PLAN") return nil diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/set_service/set_service.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/set_service/set_service.go index 03f3d75094..d741ec199d 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/set_service/set_service.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/set_service/set_service.go @@ -187,7 +187,7 @@ func (builtin *SetServiceCapabilities) FillPersistableAttributes(builder *enclav builder.SetType(SetServiceBuiltinName).AddServiceName(builtin.serviceName) } -func (builtin *SetServiceCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYaml) error { +func (builtin *SetServiceCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYamlGenerator) error { // update service does not affect the plan return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/start_service/start_service.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/start_service/start_service.go index 2856274444..05822d05bc 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/start_service/start_service.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/start_service/start_service.go @@ -107,7 +107,7 @@ func (builtin *StartServiceCapabilities) FillPersistableAttributes(builder *encl ) } -func (builtin *StartServiceCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *StartServiceCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { // start services doesn't affect the plan return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/stop_service/stop_service.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/stop_service/stop_service.go index 82fc1a86c7..6e7cb18898 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/stop_service/stop_service.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/stop_service/stop_service.go @@ -107,7 +107,7 @@ func (builtin *StopServiceCapabilities) FillPersistableAttributes(builder *encla ) } -func (builtin *StopServiceCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *StopServiceCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { // stop service does not affect the plan return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/store_service_files/store_service_files.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/store_service_files/store_service_files.go index ab17ad1b5b..a5cbdc4de5 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/store_service_files/store_service_files.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/store_service_files/store_service_files.go @@ -180,7 +180,7 @@ func (builtin *StoreServiceFilesCapabilities) FillPersistableAttributes(builder ) } -func (builtin *StoreServiceFilesCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *StoreServiceFilesCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { err := plan.AddStoreServiceFiles(builtin.artifactName, builtin.src) if err != nil { return stacktrace.Propagate(err, "An error occurred updating plan with store service files") diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_python.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_python.go index fd1e820452..86e1f66f85 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_python.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_python.go @@ -373,7 +373,7 @@ func (builtin *RunPythonCapabilities) FillPersistableAttributes(builder *enclave builder.SetType(RunPythonBuiltinName) } -func (builtin *RunPythonCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *RunPythonCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { err := plan.AddRunPython(builtin.run, builtin.description, builtin.returnValue, builtin.serviceConfig, builtin.storeSpecList, builtin.pythonArguments, builtin.packages) if err != nil { return stacktrace.Propagate(err, "An error occurred updating plan with run python") diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_sh.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_sh.go index afe8de2ee2..a1e0b1cf4b 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_sh.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_sh.go @@ -329,7 +329,7 @@ func (builtin *RunShCapabilities) FillPersistableAttributes(builder *enclave_pla builder.SetType(RunShBuiltinName) } -func (builtin *RunShCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *RunShCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { err := plan.AddRunSh(builtin.run, builtin.description, builtin.returnValue, builtin.serviceConfig, builtin.storeSpecList) if err != nil { return stacktrace.Propagate(err, "An error occurred adding run sh task to the plan") diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/upload_files/upload_files.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/upload_files/upload_files.go index b1b02397fc..80e6e2572b 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/upload_files/upload_files.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/upload_files/upload_files.go @@ -219,7 +219,7 @@ func (builtin *UploadFilesCapabilities) FillPersistableAttributes(builder *encla ) } -func (builtin *UploadFilesCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *UploadFilesCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { err := plan.AddUploadFiles(builtin.artifactName, builtin.src) if err != nil { return stacktrace.Propagate(err, "An error occurred updating plan with upload files.") diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/verify/verify.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/verify/verify.go index 842f5d0ddf..b5944d85ea 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/verify/verify.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/verify/verify.go @@ -161,7 +161,7 @@ func (builtin *VerifyCapabilities) FillPersistableAttributes(builder *enclave_pl builder.SetType(VerifyBuiltinName) } -func (builtin *VerifyCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *VerifyCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { // verify does not affect the plan return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/wait/wait.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/wait/wait.go index ee89af066e..6526cf6860 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/wait/wait.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/wait/wait.go @@ -294,7 +294,7 @@ func (builtin *WaitCapabilities) FillPersistableAttributes(builder *enclave_plan builder.SetType(WaitBuiltinName) } -func (builtin *WaitCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *WaitCapabilities) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { // wait does not affect the plan return nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_starlark_framework/kurtosis_plan_instruction/kurtosis_plan_instruction_capabilities.go b/core/server/api_container/server/startosis_engine/kurtosis_starlark_framework/kurtosis_plan_instruction/kurtosis_plan_instruction_capabilities.go index 5037f15fad..47a2b32853 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_starlark_framework/kurtosis_plan_instruction/kurtosis_plan_instruction_capabilities.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_starlark_framework/kurtosis_plan_instruction/kurtosis_plan_instruction_capabilities.go @@ -28,5 +28,5 @@ type KurtosisPlanInstructionCapabilities interface { Description() string // UpdatePlan applies the effect of this instruction capabilities onto the yaml representation of the instruction plan. - UpdatePlan(plan *plan_yaml.PlanYaml) error + UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_starlark_framework/kurtosis_plan_instruction/kurtosis_plan_instruction_internal.go b/core/server/api_container/server/startosis_engine/kurtosis_starlark_framework/kurtosis_plan_instruction/kurtosis_plan_instruction_internal.go index 968181cb55..41aa54aeda 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_starlark_framework/kurtosis_plan_instruction/kurtosis_plan_instruction_internal.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_starlark_framework/kurtosis_plan_instruction/kurtosis_plan_instruction_internal.go @@ -98,7 +98,7 @@ func (builtin *kurtosisPlanInstructionInternal) GetPersistableAttributes() *encl return enclavePlaneInstructionBuilder.SetStarlarkCode(builtin.String()) } -func (builtin *kurtosisPlanInstructionInternal) UpdatePlan(plan *plan_yaml.PlanYaml) error { +func (builtin *kurtosisPlanInstructionInternal) UpdatePlan(plan *plan_yaml.PlanYamlGenerator) error { return builtin.capabilities.UpdatePlan(plan) } diff --git a/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml.go b/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml.go index 3677b2004c..fe04379788 100644 --- a/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml.go +++ b/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml.go @@ -8,11 +8,13 @@ const ( exec TaskType = "exec" ) -type privatePlanYaml struct { - PackageId string `yaml:"packageId,omitempty"` - Services []*Service `yaml:"services,omitempty"` - FilesArtifacts []*FilesArtifact `yaml:"filesArtifacts,omitempty"` - Tasks []*Task `yaml:"tasks,omitempty"` +type PlanYaml struct { + PackageId string `yaml:"packageId,omitempty"` + Services []*Service `yaml:"services,omitempty"` + FilesArtifacts []*FilesArtifact `yaml:"filesArtifacts,omitempty"` + Tasks []*Task `yaml:"tasks,omitempty"` + Images []string `yaml:"images,omitempty"` + PackageDependencies []string `yaml:"packageDependencies,omitempty"` } // Service represents a service in the system. @@ -110,3 +112,16 @@ type Task struct { // TaskType represents the type of task (either python or shell) type TaskType string + +type Package struct { + PackageId string + ContainerImages []string +} + +type PackageDependencyGraph struct { + RootPackageId string + + PackageIndex map[string]Package + + PackageGraph map[string][]Package +} diff --git a/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml_generator.go b/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml_generator.go index 36fa1ea211..114b85432e 100644 --- a/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml_generator.go +++ b/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml_generator.go @@ -22,38 +22,47 @@ const ( outputFutureRefType = "output" ) -// PlanYaml is a yaml representation of the effect of an Instructions Plan or sequence of instructions on the state of the Enclave. -type PlanYaml struct { - privatePlanYaml *privatePlanYaml +// PlanYamlGenerator generates a PlanYaml representing the effect of an Instructions Plan or sequence of instructions on the state of the Enclave. +type PlanYamlGenerator struct { + privatePlanYaml *PlanYaml futureReferenceIndex map[string]string filesArtifactIndex map[string]*FilesArtifact latestUuid int + imageSet map[string]bool + packageDependencySet map[string]bool } -func CreateEmptyPlan(packageId string) *PlanYaml { - return &PlanYaml{ - privatePlanYaml: &privatePlanYaml{ - PackageId: packageId, - Services: []*Service{}, - Tasks: []*Task{}, - FilesArtifacts: []*FilesArtifact{}, +func CreateEmptyPlan(packageId string) *PlanYamlGenerator { + return &PlanYamlGenerator{ + privatePlanYaml: &PlanYaml{ + PackageId: packageId, + Services: []*Service{}, + Tasks: []*Task{}, + FilesArtifacts: []*FilesArtifact{}, + Images: []string{}, + PackageDependencies: []string{}, }, + imageSet: map[string]bool{}, + packageDependencySet: map[string]bool{}, futureReferenceIndex: map[string]string{}, filesArtifactIndex: map[string]*FilesArtifact{}, latestUuid: 0, } } -func (planYaml *PlanYaml) GenerateYaml() (string, error) { - yamlBytes, err := yaml.Marshal(planYaml.privatePlanYaml) +func (planYaml *PlanYamlGenerator) GenerateYaml() (string, error) { + planYaml.privatePlanYaml.Images = convertStrMapSetToSortedStrList(planYaml.imageSet) + planYaml.privatePlanYaml.PackageDependencies = convertStrMapSetToSortedStrList(planYaml.packageDependencySet) + + yamlBytes, err := yaml.Marshal(*planYaml.privatePlanYaml) if err != nil { return "", stacktrace.Propagate(err, "An error occurred generating plan yaml.") } return string(yamlBytes), nil } -func (planYaml *PlanYaml) AddService( +func (planYaml *PlanYamlGenerator) AddService( serviceName service.ServiceName, serviceInfo *kurtosis_types.Service, serviceConfig *service.ServiceConfig, @@ -84,6 +93,8 @@ func (planYaml *PlanYaml) AddService( imageYaml := &ImageSpec{} //nolint:exhaustruct imageYaml.ImageName = serviceConfig.GetContainerImageName() + planYaml.addImage(imageYaml.ImageName) + imageYaml.BuildContextLocator = imageBuildContextLocator imageYaml.TargetStage = imageTargetStage imageYaml.Registry = imageRegistryAddress @@ -131,7 +142,7 @@ func (planYaml *PlanYaml) AddService( return nil } -func (planYaml *PlanYaml) AddRunSh( +func (planYaml *PlanYamlGenerator) AddRunSh( runCommand string, description string, returnValue *starlarkstruct.Struct, @@ -168,6 +179,7 @@ func (planYaml *PlanYaml) AddRunSh( taskYaml.RunCmd = []string{planYaml.swapFutureReference(runCommand)} taskYaml.Image = serviceConfig.GetContainerImageName() + planYaml.addImage(taskYaml.Image) var envVars []*EnvironmentVariable for key, val := range serviceConfig.GetEnvVars() { @@ -205,7 +217,7 @@ func (planYaml *PlanYaml) AddRunSh( return nil } -func (planYaml *PlanYaml) AddRunPython( +func (planYaml *PlanYamlGenerator) AddRunPython( runCommand string, description string, returnValue *starlarkstruct.Struct, @@ -243,6 +255,7 @@ func (planYaml *PlanYaml) AddRunPython( taskYaml.RunCmd = []string{planYaml.swapFutureReference(runCommand)} taskYaml.Image = serviceConfig.GetContainerImageName() + planYaml.addImage(taskYaml.Image) var envVars []*EnvironmentVariable for key, val := range serviceConfig.GetEnvVars() { @@ -284,7 +297,7 @@ func (planYaml *PlanYaml) AddRunPython( return nil } -func (planYaml *PlanYaml) AddExec( +func (planYaml *PlanYamlGenerator) AddExec( serviceName string, description string, returnValue *starlark.Dict, @@ -336,7 +349,7 @@ func (planYaml *PlanYaml) AddExec( return nil } -func (planYaml *PlanYaml) AddRenderTemplates(filesArtifactName string, filepaths []string) error { +func (planYaml *PlanYamlGenerator) AddRenderTemplates(filesArtifactName string, filepaths []string) error { uuid := planYaml.generateUuid() filesArtifactYaml := &FilesArtifact{} //nolint exhaustruct filesArtifactYaml.Uuid = uuid @@ -346,7 +359,7 @@ func (planYaml *PlanYaml) AddRenderTemplates(filesArtifactName string, filepaths return nil } -func (planYaml *PlanYaml) AddUploadFiles(filesArtifactName, locator string) error { +func (planYaml *PlanYamlGenerator) AddUploadFiles(filesArtifactName, locator string) error { uuid := planYaml.generateUuid() filesArtifactYaml := &FilesArtifact{} //nolint exhauststruct filesArtifactYaml.Uuid = uuid @@ -356,7 +369,7 @@ func (planYaml *PlanYaml) AddUploadFiles(filesArtifactName, locator string) erro return nil } -func (planYaml *PlanYaml) AddStoreServiceFiles(filesArtifactName, locator string) error { +func (planYaml *PlanYamlGenerator) AddStoreServiceFiles(filesArtifactName, locator string) error { uuid := planYaml.generateUuid() filesArtifactYaml := &FilesArtifact{} //nolint exhaustruct filesArtifactYaml.Uuid = uuid @@ -366,7 +379,7 @@ func (planYaml *PlanYaml) AddStoreServiceFiles(filesArtifactName, locator string return nil } -func (planYaml *PlanYaml) RemoveService(serviceName string) { +func (planYaml *PlanYamlGenerator) RemoveService(serviceName string) { for idx, service := range planYaml.privatePlanYaml.Services { if service.Name == serviceName { planYaml.privatePlanYaml.Services = slices.Delete(planYaml.privatePlanYaml.Services, idx, idx+1) @@ -375,6 +388,19 @@ func (planYaml *PlanYaml) RemoveService(serviceName string) { } } +func (planYaml *PlanYamlGenerator) AddPackageDependencies(packageDependency map[string]bool) { + for dependency := range packageDependency { + planYaml.packageDependencySet[dependency] = true + } +} + +func (planYaml *PlanYamlGenerator) AddImages() { + for img := range planYaml.imageSet { + planYaml.privatePlanYaml.Images = append(planYaml.privatePlanYaml.Images, img) + } + slices.Sort(planYaml.privatePlanYaml.Images) +} + // getFileMountsFromFilesArtifacts turns filesArtifactExpansions into FileMount's // file mounts have two cases: // 1. the referenced files artifact already exists in the planYaml, in which case add the referenced files artifact to the proper filepath as a file mount @@ -383,7 +409,7 @@ func (planYaml *PlanYaml) RemoveService(serviceName string) { // - create new files artifact // - add the files artifact to the plan // - add it to as a file mount accordingly -func (planYaml *PlanYaml) getFileMountsFromFilesArtifacts(filesArtifactExpansion *service_directory.FilesArtifactsExpansion) []*FileMount { +func (planYaml *PlanYamlGenerator) getFileMountsFromFilesArtifacts(filesArtifactExpansion *service_directory.FilesArtifactsExpansion) []*FileMount { var fileMounts []*FileMount if filesArtifactExpansion == nil { return fileMounts @@ -420,26 +446,30 @@ func (planYaml *PlanYaml) getFileMountsFromFilesArtifacts(filesArtifactExpansion return fileMounts } -func (planYaml *PlanYaml) addServiceYaml(service *Service) { +func (planYaml *PlanYamlGenerator) addServiceYaml(service *Service) { planYaml.privatePlanYaml.Services = append(planYaml.privatePlanYaml.Services, service) } -func (planYaml *PlanYaml) addFilesArtifactYaml(filesArtifact *FilesArtifact) { +func (planYaml *PlanYamlGenerator) addFilesArtifactYaml(filesArtifact *FilesArtifact) { planYaml.filesArtifactIndex[filesArtifact.Name] = filesArtifact planYaml.privatePlanYaml.FilesArtifacts = append(planYaml.privatePlanYaml.FilesArtifacts, filesArtifact) } -func (planYaml *PlanYaml) addTaskYaml(task *Task) { +func (planYaml *PlanYamlGenerator) addTaskYaml(task *Task) { planYaml.privatePlanYaml.Tasks = append(planYaml.privatePlanYaml.Tasks, task) } +func (planYaml *PlanYamlGenerator) addImage(img string) { + planYaml.imageSet[img] = true +} + // yaml future reference format: {{ kurtosis.. ../server + github.com/kurtosis-tech/kurtosis/contexts-config-store => ../../contexts-config-store + github.com/kurtosis-tech/kurtosis/kurtosis_version => ../../kurtosis_version +) + +require ( + github.com/kurtosis-tech/kurtosis/enclave-manager v0.0.0-20230828153722-32770ca96513 + github.com/sirupsen/logrus v1.9.3 +) + +require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect diff --git a/enclave-manager/local/go.sum b/enclave-manager/local/go.sum new file mode 100644 index 0000000000..21f9bfb372 --- /dev/null +++ b/enclave-manager/local/go.sum @@ -0,0 +1,15 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/flake.lock b/flake.lock index 60e9d3d49c..9c05eae1a9 100644 --- a/flake.lock +++ b/flake.lock @@ -58,11 +58,11 @@ }, "unstable": { "locked": { - "lastModified": 1706371002, - "narHash": "sha256-dwuorKimqSYgyu8Cw6ncKhyQjUDOyuXoxDTVmAXq88s=", + "lastModified": 1716509168, + "narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c002c6aa977ad22c60398daaa9be52f2203d0006", + "rev": "bfb7a882678e518398ce9a31a881538679f6f092", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ef4d08fceb..cb00960565 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { nixpkgs, unstable, flake-utils, ... }: + outputs = { self, nixpkgs, unstable, flake-utils, ... }: let utils = flake-utils; in utils.lib.eachDefaultSystem (system: let @@ -17,9 +17,15 @@ inherit pkgs system; nodejs = pkgs.nodejs_20; }; - in { + in + { formatter = pkgs.nixpkgs-fmt; + packages = rec { + default = kurtosis; + kurtosis = unstable_pkgs.callPackage ./package.nix { }; + }; + devShell = pkgs.mkShell { nativeBuildInputs = with pkgs; let @@ -27,7 +33,8 @@ import ./nix-pkgs/openapi-codegen.nix { inherit pkgs; }; grpc-tools-node = import ./nix-pkgs/grpc-tools-node.nix { inherit pkgs; }; - in [ + in + [ goreleaser go_1_20 gopls diff --git a/go.work b/go.work index 318f912450..9a20f823bb 100644 --- a/go.work +++ b/go.work @@ -10,6 +10,7 @@ use ( ./core/launcher ./core/server ./enclave-manager/api/golang + ./enclave-manager/local ./enclave-manager/server ./engine/launcher ./engine/server diff --git a/package.nix b/package.nix new file mode 100644 index 0000000000..92aead7926 --- /dev/null +++ b/package.nix @@ -0,0 +1,54 @@ +{ lib +, buildGoModule +, writeTextFile +}: + +buildGoModule rec { + pname = "kurtosis"; + version = "0.89.11"; + + src = ./.; + + proxyVendor = true; + vendorHash = "sha256-GaEIitoRiuYxtS7cDKobFyIlraDNQjcvbRvzG3nUKFU="; + + postPatch = + let + kurtosisVersion = writeTextFile { + name = "kurtosis_verion.go"; + text = '' + package kurtosis_version + const ( + KurtosisVersion = "${version}" + ) + ''; + }; + in + '' + ln -s ${kurtosisVersion} kurtosis_version/kurtosis_version.go + ''; + + # disable checks temporarily since they connect to the internet + # namely user_support_constants_test.go + doCheck = false; + + # keep this for future reference + preCheck = '' + # some tests in commands use XDG home related environment variables + export HOME=/tmp + ''; + + postInstall = '' + mv $out/bin/cli $out/bin/kurtosis + mv $out/bin/files_artifacts_expander $out/bin/files-artifacts-expander + mv $out/bin/api_container $out/bin/api-container + + ''; + + meta = with lib; { + description = "A platform for launching an ephemeral Ethereum backend"; + mainProgram = "kurtosis"; + homepage = "https://github.com/kurtosis-tech/kurtosis"; + license = licenses.asl20; + }; +} diff --git a/scripts/docker-image-builder.sh b/scripts/docker-image-builder.sh index 7c470f322f..ca47784529 100755 --- a/scripts/docker-image-builder.sh +++ b/scripts/docker-image-builder.sh @@ -70,33 +70,33 @@ done ## Start by making sure the builder and the context do not already exist. If that's the case remove them kurtosis_docker_builder="kurtosis-docker-builder" docker_buildx_context='kurtosis-docker-builder-context' -if docker buildx inspect "${kurtosis_docker_builder}" &>/dev/null; then - echo "Removing docker buildx builder ${kurtosis_docker_builder} as it seems to already exist" - if ! docker buildx rm ${kurtosis_docker_builder} &>/dev/null; then - echo "Failed removing docker buildx builder ${kurtosis_docker_builder}. Try removing it manually with 'docker buildx rm ${kurtosis_docker_builder}' before re-running this script" - exit 1 - fi -fi -if docker context inspect "${docker_buildx_context}" &>/dev/null; then - echo "Removing docker context ${docker_buildx_context} as it seems to already exist" - if ! docker context rm ${docker_buildx_context} &>/dev/null; then - echo "Failed removing docker context ${docker_buildx_context}. Try removing it manually with 'docker context rm ${docker_buildx_context}' before re-running this script" - exit 1 - fi -fi - -## Create Docker context and buildx builder -if ! docker context create "${docker_buildx_context}" &>/dev/null; then - echo "Error: Docker context creation for buildx failed" >&2 - exit 1 -fi -if ! docker buildx create --use --name "${kurtosis_docker_builder}" "${docker_buildx_context}" &>/dev/null; then - echo "Error: Docker context switch for buildx failed" >&2d - exit 1 -fi +#if docker buildx inspect "${kurtosis_docker_builder}" &>/dev/null; then +# echo "Removing docker buildx builder ${kurtosis_docker_builder} as it seems to already exist" +# if ! docker buildx rm ${kurtosis_docker_builder} &>/dev/null; then +# echo "Failed removing docker buildx builder ${kurtosis_docker_builder}. Try removing it manually with 'docker buildx rm ${kurtosis_docker_builder}' before re-running this script" +# exit 1 +# fi +#fi +#if docker context inspect "${docker_buildx_context}" &>/dev/null; then +# echo "Removing docker context ${docker_buildx_context} as it seems to already exist" +# if ! docker context rm ${docker_buildx_context} &>/dev/null; then +# echo "Failed removing docker context ${docker_buildx_context}. Try removing it manually with 'docker context rm ${docker_buildx_context}' before re-running this script" +# exit 1 +# fi +#fi +# +### Create Docker context and buildx builder +#if ! docker context create "${docker_buildx_context}" &>/dev/null; then +# echo "Error: Docker context creation for buildx failed" >&2 +# exit 1 +#fi +#if ! docker buildx create --use --name "${kurtosis_docker_builder}" "${docker_buildx_context}" &>/dev/null; then +# echo "Error: Docker context switch for buildx failed" >&2d +# exit 1 +#fi ## Actually build the Docker image -docker_buildx_cmd="docker buildx build ${push_flag} --platform ${buildx_platform_arg} ${image_tags_concatenated} -f ${dockerfile_filepath} ${dockerfile_dirpath}" +docker_buildx_cmd="sudo podman buildx build ${push_flag} --platform ${buildx_platform_arg} ${image_tags_concatenated} -f ${dockerfile_filepath} ${dockerfile_dirpath}" echo "Running the following docker buildx command:" echo "${docker_buildx_cmd}" if ! eval "${docker_buildx_cmd}"; then @@ -104,14 +104,14 @@ if ! eval "${docker_buildx_cmd}"; then exit 1 fi -# Cleanup context and buildx runner -echo "Cleaning up remaining resources" -if ! docker buildx rm "${kurtosis_docker_builder}" &>/dev/null; then - echo "Warn: Failed removing the buildx builder '${kurtosis_docker_builder}'. Try manually removing it with 'docker buildx rm ${kurtosis_docker_builder}'" >&2 - exit 1 -fi -if ! docker context rm "${docker_buildx_context}" &>/dev/null; then - echo "Warn: Failed removing the buildx context '${docker_buildx_context}'. Try manually removing it with 'docker context rm ${docker_buildx_context}'" >&2 - exit 1 -fi -echo "Successfully built docker image" +## Cleanup context and buildx runner +#echo "Cleaning up remaining resources" +#if ! docker buildx rm "${kurtosis_docker_builder}" &>/dev/null; then +# echo "Warn: Failed removing the buildx builder '${kurtosis_docker_builder}'. Try manually removing it with 'docker buildx rm ${kurtosis_docker_builder}'" >&2 +# exit 1 +#fi +#if ! docker context rm "${docker_buildx_context}" &>/dev/null; then +# echo "Warn: Failed removing the buildx context '${docker_buildx_context}'. Try manually removing it with 'docker context rm ${docker_buildx_context}'" >&2 +# exit 1 +#fi +#echo "Successfully built docker image"