From 11d1dba7541fc87fdf0e6bee3efe345edd732c23 Mon Sep 17 00:00:00 2001 From: Omar Ali <524542+omar711@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:30:36 +0100 Subject: [PATCH 1/7] fix: correct the link to kurtosis upgrade docs (#1574) ## Description: The link to upgrade kurtosis is out of date. This updates it. ## Is this change user facing? YES Co-authored-by: Omar --- api/golang/engine/lib/kurtosis_context/kurtosis_context.go | 2 +- .../src/engine/lib/kurtosis_context/kurtosis_context.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/golang/engine/lib/kurtosis_context/kurtosis_context.go b/api/golang/engine/lib/kurtosis_context/kurtosis_context.go index e0402feeac..a350bc4b85 100644 --- a/api/golang/engine/lib/kurtosis_context/kurtosis_context.go +++ b/api/golang/engine/lib/kurtosis_context/kurtosis_context.go @@ -485,7 +485,7 @@ func validateEngineApiVersion(ctx context.Context, engineServiceClient kurtosis_ if !doApiVersionsMatch { return stacktrace.NewError( "An API version mismatch was detected between the running engine version '%v' and the engine version this Kurtosis SDK library expects, '%v'. You should:\n"+ - " 1) upgrade your Kurtosis CLI to latest using the instructions at https://docs.kurtosis.com/install#upgrading\n"+ + " 1) upgrade your Kurtosis CLI to latest using the instructions at https://docs.kurtosis.com/upgrade\n"+ " 2) use the Kurtosis CLI to restart your engine via 'kurtosis engine restart'\n"+ " 3) upgrade your Kurtosis SDK library using the instructions at https://github.com/kurtosis-tech/kurtosis-engine-api-lib\n", runningEngineSemver.String(), diff --git a/api/typescript/src/engine/lib/kurtosis_context/kurtosis_context.ts b/api/typescript/src/engine/lib/kurtosis_context/kurtosis_context.ts index e6023f15da..88ee484564 100644 --- a/api/typescript/src/engine/lib/kurtosis_context/kurtosis_context.ts +++ b/api/typescript/src/engine/lib/kurtosis_context/kurtosis_context.ts @@ -342,7 +342,7 @@ export class KurtosisContext { if (!doApiVersionsMatch) { return err(new Error( `An API version mismatch was detected between the running engine version '${runningEngineSemver.version}' and the engine version this Kurtosis SDK library expects, '${libraryEngineSemver.version}'. You should:\n` + - ` 1) upgrade your Kurtosis CLI to latest using the instructions at https://docs.kurtosis.com/install#upgrading\n` + + ` 1) upgrade your Kurtosis CLI to latest using the instructions at https://docs.kurtosis.com/upgrade\n` + ` 2) use the Kurtosis CLI to restart your engine via 'kurtosis engine restart'\n` + ` 3) upgrade your Kurtosis SDK library using the instructions at https://github.com/kurtosis-tech/kurtosis-sdk\n`, )); From db8b549982a8933a1167dac0f06ed79ba3dd5d44 Mon Sep 17 00:00:00 2001 From: Galen Marchetti Date: Tue, 17 Oct 2023 07:19:37 -0600 Subject: [PATCH 2/7] docs: Add demo video to readme (#1572) ## Description: Adding a demo video to our readme ## Is this change user facing? YES --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 1bee557955..2695031970 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ Kurtosis shines when creating, working with, and destroying self-contained distr If you're in web3, we have even more specific web3 usecases [here](https://web3.kurtosis.com). +Check out an introductory demo video here: + + + How do I get going? =================== To see Kurtosis in action, first install it using the instructions [here](https://docs.kurtosis.com/install). _Note that we're working on a cloud-hosted version of Kurtosis that doesn't require any local installation; if this is interesting to you then let us know [here](https://mp2k8nqxxgj.typeform.com/to/U1HcXT1H) and we'll let you know when it's available._ From 6411c8f8b8f2ed3737d04c6d8a7a0938f7486aa3 Mon Sep 17 00:00:00 2001 From: leoporoli Date: Tue, 17 Oct 2023 10:24:15 -0300 Subject: [PATCH 3/7] feat: kurtosis package init command (#1547) ## Description: kurtosis package init command ## Is this change user facing? YES ## References (if applicable): Fix #1416 This is part of the [Forked cleanup package project](https://www.notion.so/kurtosistech/Forked-Package-Cleanup-16d86c4e274547b28496f17154bf3d62) --- api/golang/core/lib/enclaves/kurtosis_yaml.go | 4 + .../core/lib/shared_utils}/parsed_git_url.go | 78 +++++--- .../lib/shared_utils}/parsed_git_url_test.go | 38 ++-- .../command_str_consts/command_str_consts.go | 2 + cli/cli/commands/package/init_cmd/init_cmd.go | 85 ++++++++ cli/cli/commands/package/package.go | 19 ++ cli/cli/commands/root.go | 2 + .../kurtosis_config/kurtosis_config_store.go | 2 +- cli/cli/kurtosis_package/kurtosis_package.go | 104 ++++++++++ .../kurtosis_package/kurtosis_package_test.go | 184 ++++++++++++++++++ .../startosis_constants.go | 7 +- .../git_package_content_provider.go | 125 ++++++------ .../git_package_content_provider_test.go | 5 +- .../git_package_content_provider/locators.go | 7 +- .../mock_package_content_provider.go | 4 +- docs/docs/cli-reference/package-init.md | 17 ++ 16 files changed, 567 insertions(+), 116 deletions(-) rename {core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider => api/golang/core/lib/shared_utils}/parsed_git_url.go (68%) rename {core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider => api/golang/core/lib/shared_utils}/parsed_git_url_test.go (84%) create mode 100644 cli/cli/commands/package/init_cmd/init_cmd.go create mode 100644 cli/cli/commands/package/package.go create mode 100644 cli/cli/kurtosis_package/kurtosis_package.go create mode 100644 cli/cli/kurtosis_package/kurtosis_package_test.go create mode 100644 docs/docs/cli-reference/package-init.md diff --git a/api/golang/core/lib/enclaves/kurtosis_yaml.go b/api/golang/core/lib/enclaves/kurtosis_yaml.go index 0473b18238..dce74a9152 100644 --- a/api/golang/core/lib/enclaves/kurtosis_yaml.go +++ b/api/golang/core/lib/enclaves/kurtosis_yaml.go @@ -17,6 +17,10 @@ type KurtosisYaml struct { PackageReplaceOptions map[string]string `yaml:"replace"` } +func NewKurtosisYaml(packageName string, packageDescription string, packageReplaceOptions map[string]string) *KurtosisYaml { + return &KurtosisYaml{PackageName: packageName, PackageDescription: packageDescription, PackageReplaceOptions: packageReplaceOptions} +} + func ParseKurtosisYaml(kurtosisYamlFilepath string) (*KurtosisYaml, error) { kurtosisYamlContents, err := os.ReadFile(kurtosisYamlFilepath) if err != nil { diff --git a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/parsed_git_url.go b/api/golang/core/lib/shared_utils/parsed_git_url.go similarity index 68% rename from core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/parsed_git_url.go rename to api/golang/core/lib/shared_utils/parsed_git_url.go index 89e006079e..5a413712b8 100644 --- a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/parsed_git_url.go +++ b/api/golang/core/lib/shared_utils/parsed_git_url.go @@ -1,20 +1,20 @@ -package git_package_content_provider +package shared_utils import ( "fmt" - "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_constants" - "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_errors" + "github.com/kurtosis-tech/stacktrace" "net/url" "path" "strings" ) const ( - httpsSchema = "https" - urlPathSeparator = "/" - // for a valid GitURl we need it to look like github.com/author/moduleName + GithubDomainPrefix = "github.com" + httpsSchema = "https" + UrlPathSeparator = "/" + //MinimumSubPathsForValidGitURL for a valid GitURl we need it to look like github.com/author/moduleName // the last two are the minimum requirements for a valid Startosis URL - minimumSubPathsForValidGitURL = 2 + MinimumSubPathsForValidGitURL = 2 tagBranchOrCommitDelimiter = "@" emptyTagBranchOrCommit = "" @@ -54,44 +54,75 @@ func newParsedGitURL(moduleAuthor, moduleName, gitURL, relativeRepoPath, relativ } } -// parseGitURL this takes a Git url (GitHub) for now and converts it into the struct ParsedGitURL +func (parsedUrl *ParsedGitURL) GetModuleAuthor() string { + return parsedUrl.moduleAuthor +} + +func (parsedUrl *ParsedGitURL) GetModuleName() string { + return parsedUrl.moduleName +} + +func (parsedUrl *ParsedGitURL) GetGitURL() string { + return parsedUrl.gitURL +} + +func (parsedUrl *ParsedGitURL) GetRelativeRepoPath() string { + return parsedUrl.relativeRepoPath +} + +func (parsedUrl *ParsedGitURL) GetRelativeFilePath() string { + return parsedUrl.relativeFilePath +} + +func (parsedUrl *ParsedGitURL) GetTagBranchOrCommit() string { + return parsedUrl.tagBranchOrCommit +} + +func (parsedUrl *ParsedGitURL) GetAbsoluteLocatorRelativeToThisURL(relativeUrl string) string { + if strings.HasPrefix(relativeUrl, packageRootPrefixIndicatorInRelativeLocators) { + return path.Join(GithubDomainPrefix, parsedUrl.relativeRepoPath, relativeUrl) + } + return path.Join(GithubDomainPrefix, path.Dir(parsedUrl.relativeFilePath), relativeUrl) +} + +// ParseGitURL this takes a Git url (GitHub) for now and converts it into the struct ParsedGitURL // This can in the future be extended to GitLab or BitBucket or any other Git Host -func parseGitURL(packageURL string) (*ParsedGitURL, *startosis_errors.InterpretationError) { +func ParseGitURL(packageURL string) (*ParsedGitURL, error) { // we expect something like github.com/author/module/path.star // we don't want schemas parsedURL, err := url.Parse(packageURL) if err != nil { - return nil, startosis_errors.WrapWithInterpretationError(err, "Error parsing the URL of module '%v'", packageURL) + return nil, stacktrace.Propagate(err, "Error parsing the URL of module '%v'", packageURL) } if parsedURL.Scheme != "" { - return nil, startosis_errors.NewInterpretationError("Error parsing the URL of module '%v'. Expected schema to be empty got '%v'", packageURL, parsedURL.Scheme) + return nil, stacktrace.NewError("Error parsing the URL of module '%v'. Expected schema to be empty got '%v'", packageURL, parsedURL.Scheme) } // we prefix schema and make sure that the URL still parses packageURLPrefixedWithHttps := httpsSchema + "://" + packageURL parsedURL, err = url.Parse(packageURLPrefixedWithHttps) if err != nil { - return nil, startosis_errors.WrapWithInterpretationError(err, "Error parsing the URL with scheme for module '%v'", packageURLPrefixedWithHttps) + return nil, stacktrace.Propagate(err, "Error parsing the URL with scheme for module '%v'", packageURLPrefixedWithHttps) } - if parsedURL.Host != startosis_constants.GithubDomainPrefix { - return nil, startosis_errors.NewInterpretationError("Error parsing the URL of module. We only support modules on Github for now but got '%v'", packageURL) + if parsedURL.Host != GithubDomainPrefix { + return nil, stacktrace.NewError("Error parsing the URL of module. We only support modules on Github for now but got '%v'", packageURL) } pathWithoutVersion, maybeTagBranchOrCommit := parseOutTagBranchOrCommit(parsedURL.Path) splitURLPath := cleanPathAndSplit(pathWithoutVersion) - if len(splitURLPath) < minimumSubPathsForValidGitURL { - return nil, startosis_errors.NewInterpretationError("Error parsing the URL of module: '%v'. The path should contain at least %d subpaths got '%v'", packageURL, minimumSubPathsForValidGitURL, splitURLPath) + if len(splitURLPath) < MinimumSubPathsForValidGitURL { + return nil, stacktrace.NewError("Error parsing the URL of module: '%v'. The path should contain at least %d subpaths got '%v'", packageURL, MinimumSubPathsForValidGitURL, splitURLPath) } moduleAuthor := splitURLPath[0] moduleName := splitURLPath[1] - gitURL := fmt.Sprintf("%v://%v/%v/%v.git", httpsSchema, startosis_constants.GithubDomainPrefix, moduleAuthor, moduleName) + gitURL := fmt.Sprintf("%v://%v/%v/%v.git", httpsSchema, GithubDomainPrefix, moduleAuthor, moduleName) relativeModulePath := path.Join(moduleAuthor, moduleName) relativeFilePath := "" - if len(splitURLPath) > minimumSubPathsForValidGitURL { + if len(splitURLPath) > MinimumSubPathsForValidGitURL { relativeFilePath = path.Join(splitURLPath...) } @@ -107,17 +138,10 @@ func parseGitURL(packageURL string) (*ParsedGitURL, *startosis_errors.Interpreta return parsedGitURL, nil } -func (parsedUrl *ParsedGitURL) getAbsoluteLocatorRelativeToThisURL(relativeUrl string) string { - if strings.HasPrefix(relativeUrl, packageRootPrefixIndicatorInRelativeLocators) { - return path.Join(startosis_constants.GithubDomainPrefix, parsedUrl.relativeRepoPath, relativeUrl) - } - return path.Join(startosis_constants.GithubDomainPrefix, path.Dir(parsedUrl.relativeFilePath), relativeUrl) -} - // cleanPath removes empty "" from the string slice func cleanPathAndSplit(urlPath string) []string { cleanPath := path.Clean(urlPath) - splitPath := strings.Split(cleanPath, urlPathSeparator) + splitPath := strings.Split(cleanPath, UrlPathSeparator) var sliceWithoutEmptyStrings []string for _, subPath := range splitPath { if subPath != "" { @@ -138,7 +162,7 @@ func parseOutTagBranchOrCommit(input string) (string, string) { // 3- github.com/kurtosis-tech/sample-dependency-package/main.star@foo/bar - here the tag is foo/bar; // 4- github.com/kurtosis-tech/sample-dependency-package@foo/bar/mains.tar - here the tag is foo/bar; while file is /kurtosis-tech/sample-dependency-package/main.star // we check if there is a file in maybeTagBranchOrCommitWithFile and then add it to pathWithoutVersion - maybeTagBranchOrCommit, lastSectionOfTagBranchCommitWithFile, _ := cutLast(maybeTagBranchOrCommitWithFile, urlPathSeparator) + maybeTagBranchOrCommit, lastSectionOfTagBranchCommitWithFile, _ := cutLast(maybeTagBranchOrCommitWithFile, UrlPathSeparator) if lastSectionOfTagBranchCommitWithFile != "" && strings.Contains(lastSectionOfTagBranchCommitWithFile, extensionCharacter) { // we assume pathWithoutVersion does not contain a file inside yet diff --git a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/parsed_git_url_test.go b/api/golang/core/lib/shared_utils/parsed_git_url_test.go similarity index 84% rename from core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/parsed_git_url_test.go rename to api/golang/core/lib/shared_utils/parsed_git_url_test.go index 60ea2b0d25..aa52f9e080 100644 --- a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/parsed_git_url_test.go +++ b/api/golang/core/lib/shared_utils/parsed_git_url_test.go @@ -1,4 +1,4 @@ -package git_package_content_provider +package shared_utils import ( "fmt" @@ -18,7 +18,7 @@ const ( ) func TestParsedGitURL_SimpleParse(t *testing.T) { - parsedURL, err := parseGitURL(githubSampleURL) + parsedURL, err := ParseGitURL(githubSampleURL) require.Nil(t, err) expectedParsedURL := newParsedGitURL( @@ -35,7 +35,7 @@ func TestParsedGitURL_SimpleParse(t *testing.T) { func TestParsedGitURL_FailsOnNonGithubURL(t *testing.T) { nonGithubURL := "kurtosis-git.com/" + testModuleAuthor + "/" + testModuleName + "/" + testFileName - _, err := parseGitURL(nonGithubURL) + _, err := ParseGitURL(nonGithubURL) require.NotNil(t, err) expectedErrorMsg := "We only support modules on Github for now" @@ -46,7 +46,7 @@ func TestParsedGitURL_FailsOnNonGithubURL(t *testing.T) { func TestParsedGitURL_FailsOnNonNonEmptySchema(t *testing.T) { ftpSchema := "ftp" nonGithubURL := ftpSchema + "://github.com/" + testModuleAuthor + "/" + testModuleName + "/" + testFileName - _, err := parseGitURL(nonGithubURL) + _, err := ParseGitURL(nonGithubURL) require.NotNil(t, err) expectedErrorMsg := fmt.Sprintf("Expected schema to be empty got '%v'", ftpSchema) @@ -56,19 +56,19 @@ func TestParsedGitURL_FailsOnNonNonEmptySchema(t *testing.T) { func TestParsedGitURL_IfNoFileThenRelativeFilePathIsEmpty(t *testing.T) { pathWithoutFile := "github.com/" + testModuleAuthor + "/" + testModuleName - parsedURL, err := parseGitURL(pathWithoutFile) + parsedURL, err := ParseGitURL(pathWithoutFile) require.Nil(t, err) require.Equal(t, "", parsedURL.relativeFilePath) } func TestParsedGitURL_ParsingGetsRidOfAnyPathEscapes(t *testing.T) { escapedURLWithoutStartosisFile := "github.com/../etc/passwd" - parsedURL, err := parseGitURL(escapedURLWithoutStartosisFile) + parsedURL, err := ParseGitURL(escapedURLWithoutStartosisFile) require.Nil(t, err) require.Equal(t, "", parsedURL.relativeFilePath) escapedURLWithStartosisFile := "github.com/../../etc/passwd/startosis.star" - parsedURL, err = parseGitURL(escapedURLWithStartosisFile) + parsedURL, err = ParseGitURL(escapedURLWithStartosisFile) require.Nil(t, err) require.Equal(t, parsedURL.moduleAuthor, "etc") require.Equal(t, parsedURL.moduleName, "passwd") @@ -77,7 +77,7 @@ func TestParsedGitURL_ParsingGetsRidOfAnyPathEscapes(t *testing.T) { require.Equal(t, parsedURL.relativeRepoPath, "etc/passwd") escapedURLWithStartosisFile = "github.com/foo/../etc/passwd/startosis.star" - parsedURL, err = parseGitURL(escapedURLWithStartosisFile) + parsedURL, err = ParseGitURL(escapedURLWithStartosisFile) require.Nil(t, err) require.Equal(t, parsedURL.moduleAuthor, "etc") require.Equal(t, parsedURL.moduleName, "passwd") @@ -86,14 +86,14 @@ func TestParsedGitURL_ParsingGetsRidOfAnyPathEscapes(t *testing.T) { require.Equal(t, parsedURL.relativeRepoPath, "etc/passwd") escapedURLWithStartosisFile = "github.com/foo/../etc/../passwd" - _, err = parseGitURL(escapedURLWithStartosisFile) + _, err = ParseGitURL(escapedURLWithStartosisFile) require.NotNil(t, err) expectedErrorMsg := fmt.Sprintf("Error parsing the URL of module: '%s'. The path should contain at least 2 subpaths got '[passwd]'", escapedURLWithStartosisFile) require.Contains(t, err.Error(), expectedErrorMsg) } func TestParsedGitURL_WorksWithVersioningInformation(t *testing.T) { - parsedURL, err := parseGitURL(githubSampleUrlWithTag) + parsedURL, err := ParseGitURL(githubSampleUrlWithTag) require.Nil(t, err) expectedParsedURL := newParsedGitURL( @@ -107,7 +107,7 @@ func TestParsedGitURL_WorksWithVersioningInformation(t *testing.T) { require.Equal(t, expectedParsedURL, parsedURL) - parsedURL, err = parseGitURL(githubSampleUrlWithBranchContainingVersioningDelimiter) + parsedURL, err = ParseGitURL(githubSampleUrlWithBranchContainingVersioningDelimiter) require.Nil(t, err) expectedParsedURL = newParsedGitURL( @@ -123,46 +123,46 @@ func TestParsedGitURL_WorksWithVersioningInformation(t *testing.T) { } func TestParsedGitUrl_ResolvesRelativeUrl(t *testing.T) { - parsedUrl, err := parseGitURL(githubSampleURL) + parsedUrl, err := ParseGitURL(githubSampleURL) require.Nil(t, err) relativeUrl := "./lib.star" - absoluteUrl := parsedUrl.getAbsoluteLocatorRelativeToThisURL(relativeUrl) + absoluteUrl := parsedUrl.GetAbsoluteLocatorRelativeToThisURL(relativeUrl) require.Nil(t, err) expected := "github.com/kurtosis-tech/sample-startosis-load/lib.star" require.Equal(t, expected, absoluteUrl) relativeUrl = "./src/lib.star" - absoluteUrl = parsedUrl.getAbsoluteLocatorRelativeToThisURL(relativeUrl) + absoluteUrl = parsedUrl.GetAbsoluteLocatorRelativeToThisURL(relativeUrl) require.Nil(t, err) expected = "github.com/kurtosis-tech/sample-startosis-load/src/lib.star" require.Equal(t, expected, absoluteUrl) } func TestParsedGitUrl_ResolvesRelativeUrlForUrlWithTag(t *testing.T) { - parsedUrl, err := parseGitURL(githubSampleUrlWithTag) + parsedUrl, err := ParseGitURL(githubSampleUrlWithTag) require.Nil(t, err) relativeUrl := "./lib.star" - absoluteUrl := parsedUrl.getAbsoluteLocatorRelativeToThisURL(relativeUrl) + absoluteUrl := parsedUrl.GetAbsoluteLocatorRelativeToThisURL(relativeUrl) require.Nil(t, err) expected := "github.com/kurtosis-tech/sample-startosis-load/lib.star" require.Equal(t, expected, absoluteUrl) relativeUrl = "./src/lib.star" - absoluteUrl = parsedUrl.getAbsoluteLocatorRelativeToThisURL(relativeUrl) + absoluteUrl = parsedUrl.GetAbsoluteLocatorRelativeToThisURL(relativeUrl) require.Nil(t, err) expected = "github.com/kurtosis-tech/sample-startosis-load/src/lib.star" require.Equal(t, expected, absoluteUrl) } func TestParsedGitUrl_ResolvesWithUrlWithVersionBranchWithSlash(t *testing.T) { - parsedUrl, err := parseGitURL(githubSampleUrlWithVersionWithSlash) + parsedUrl, err := ParseGitURL(githubSampleUrlWithVersionWithSlash) require.Nil(t, err) require.Equal(t, "foo/bar", parsedUrl.tagBranchOrCommit) - parsedUrl, err = parseGitURL(githubSampleUrlWithVersionWithSlashAndFile) + parsedUrl, err = ParseGitURL(githubSampleUrlWithVersionWithSlashAndFile) require.Nil(t, err) require.Equal(t, "foo/bar", parsedUrl.tagBranchOrCommit) require.Equal(t, "kurtosis-tech/sample-startosis-load/main.star", parsedUrl.relativeFilePath) diff --git a/cli/cli/command_str_consts/command_str_consts.go b/cli/cli/command_str_consts/command_str_consts.go index 0041a97edc..9874cb4985 100644 --- a/cli/cli/command_str_consts/command_str_consts.go +++ b/cli/cli/command_str_consts/command_str_consts.go @@ -70,6 +70,8 @@ const ( VersionCmdStr = "version" ImportCmdStr = "import" GatewayCmdStr = "gateway" + PackageCmdStr = "package" + InitCmdStr = "init" PortCmdStr = "port" PortPrintCmdStr = "print" WebCmdStr = "web" diff --git a/cli/cli/commands/package/init_cmd/init_cmd.go b/cli/cli/commands/package/init_cmd/init_cmd.go new file mode 100644 index 0000000000..7adbdd6c49 --- /dev/null +++ b/cli/cli/commands/package/init_cmd/init_cmd.go @@ -0,0 +1,85 @@ +package init_cmd + +import ( + "context" + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/shared_utils" + "github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel" + "github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/args" + "github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags" + "github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts" + "github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_package" + "github.com/kurtosis-tech/stacktrace" + "os" +) + +const ( + packageNameArgKey = "package-name" + packageNameArgDefaultValue = "" + packageNameArgIsOptional = false + packageNameArgIsGreedy = false + + executablePackageFlagKey = "main" + executablePackageFlagDefaultValue = "false" +) + +var InitCmd = &lowlevel.LowlevelKurtosisCommand{ + CommandStr: command_str_consts.InitCmdStr, + ShortDescription: "Creates a new Kurtosis package", + LongDescription: "This command initializes the current directory to be a Kurtosis package by creating a `kurtosis.yml` with the given package name.", + Args: []*args.ArgConfig{ + { + Key: packageNameArgKey, + DefaultValue: packageNameArgDefaultValue, + IsOptional: packageNameArgIsOptional, + IsGreedy: packageNameArgIsGreedy, + ValidationFunc: validatePackageNameArg, + }, + }, + Flags: []*flags.FlagConfig{ + { + Key: executablePackageFlagKey, + Usage: "indicates that the created package is an executable package, and generates a 'main.star' if one does not already exist.", + Type: flags.FlagType_Bool, + Default: executablePackageFlagDefaultValue, + }, + }, + PreValidationAndRunFunc: nil, + RunFunc: run, + PostValidationAndRunFunc: nil, +} + +func run(ctx context.Context, flags *flags.ParsedFlags, args *args.ParsedArgs) error { + packageNameArg, err := args.GetNonGreedyArg(packageNameArgKey) + if err != nil { + return stacktrace.Propagate(err, "an error occurred getting the value of argument with key '%v'", packageNameArgKey) + } + + executablePackageFlag, err := flags.GetBool(executablePackageFlagKey) + if err != nil { + return stacktrace.Propagate(err, "an error occurred getting the value of flag '%v'", executablePackageFlagKey) + } + + packageDestinationDirpath, err := os.Getwd() + if err != nil { + return stacktrace.Propagate(err, "An error occurred getting the current working directory for creating the Kurtosis package") + } + + if err := kurtosis_package.InitializeKurtosisPackage(packageDestinationDirpath, packageNameArg, executablePackageFlag); err != nil { + return stacktrace.Propagate(err, "An error occurred initializing the Kurtosis package '%s' in '%s'", packageNameArg, packageDestinationDirpath) + } + + return nil +} + +func validatePackageNameArg(_ context.Context, _ *flags.ParsedFlags, args *args.ParsedArgs) error { + packageNameArg, err := args.GetNonGreedyArg(packageNameArgKey) + if err != nil { + return stacktrace.Propagate(err, "an error occurred getting the value of argument with key '%v'", packageNameArgKey) + } + + if _, err := shared_utils.ParseGitURL(packageNameArg); err != nil { + return stacktrace.Propagate(err, "An erro occurred validating package name '%v', invalid GitHub URL", packageNameArg) + } + + return nil +} diff --git a/cli/cli/commands/package/package.go b/cli/cli/commands/package/package.go new file mode 100644 index 0000000000..36b6036803 --- /dev/null +++ b/cli/cli/commands/package/package.go @@ -0,0 +1,19 @@ +package _package + +import ( + "github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts" + "github.com/kurtosis-tech/kurtosis/cli/cli/commands/package/init_cmd" + "github.com/spf13/cobra" +) + +// PackageCmd Suppressing exhaustruct requirement because this struct has ~40 properties +// nolint: exhaustruct +var PackageCmd = &cobra.Command{ + Use: command_str_consts.PackageCmdStr, + Short: "Manage packages", + RunE: nil, +} + +func init() { + PackageCmd.AddCommand(init_cmd.InitCmd.MustGetCobraCommand()) +} diff --git a/cli/cli/commands/root.go b/cli/cli/commands/root.go index 820e0423d4..d27ed2a8d0 100644 --- a/cli/cli/commands/root.go +++ b/cli/cli/commands/root.go @@ -27,6 +27,7 @@ import ( "github.com/kurtosis-tech/kurtosis/cli/cli/commands/kurtosis_context" "github.com/kurtosis-tech/kurtosis/cli/cli/commands/lint" "github.com/kurtosis-tech/kurtosis/cli/cli/commands/lsp" + _package "github.com/kurtosis-tech/kurtosis/cli/cli/commands/package" "github.com/kurtosis-tech/kurtosis/cli/cli/commands/port" "github.com/kurtosis-tech/kurtosis/cli/cli/commands/portal" "github.com/kurtosis-tech/kurtosis/cli/cli/commands/run" @@ -130,6 +131,7 @@ func init() { RootCmd.AddCommand(twitter.TwitterCmd.MustGetCobraCommand()) RootCmd.AddCommand(version.VersionCmd) RootCmd.AddCommand(web.WebCmd.MustGetCobraCommand()) + RootCmd.AddCommand(_package.PackageCmd) } // ==================================================================================================== diff --git a/cli/cli/kurtosis_config/kurtosis_config_store.go b/cli/cli/kurtosis_config/kurtosis_config_store.go index c4eb34687e..e662f7e8f3 100644 --- a/cli/cli/kurtosis_config/kurtosis_config_store.go +++ b/cli/cli/kurtosis_config/kurtosis_config_store.go @@ -1,7 +1,6 @@ package kurtosis_config import ( - "github.com/go-yaml/yaml" "github.com/kurtosis-tech/kurtosis/cli/cli/helpers/host_machine_directories" "github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_config/config_version" "github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_config/overrides_deserializers" @@ -9,6 +8,7 @@ import ( "github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_config/resolved_config" "github.com/kurtosis-tech/stacktrace" "github.com/sirupsen/logrus" + "gopkg.in/yaml.v3" "io" "os" "sync" diff --git a/cli/cli/kurtosis_package/kurtosis_package.go b/cli/cli/kurtosis_package/kurtosis_package.go new file mode 100644 index 0000000000..aad6888721 --- /dev/null +++ b/cli/cli/kurtosis_package/kurtosis_package.go @@ -0,0 +1,104 @@ +package kurtosis_package + +import ( + "fmt" + "github.com/go-yaml/yaml" + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/enclaves" + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/shared_utils" + "github.com/kurtosis-tech/stacktrace" + "github.com/sirupsen/logrus" + "os" + "path" +) + +const ( + kurtosisPackageFilePermissions os.FileMode = 0644 + kurtosisYmlFilename = "kurtosis.yml" + mainStarFilename = "main.star" + mainStarFileContentStr = `def run(plan): + # TODO + plan.print("hello world!")` + kurtosisYmlDescriptionFormat = "# %s\nEnter description Markdown here." +) + +func InitializeKurtosisPackage(packageDirpath string, packageName string, isExecutablePackage bool) error { + + // 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) + } + + logrus.Debugf("Initializaing the '%s' Kurtosis package...", packageName) + if err := createKurtosisYamlFile(packageDirpath, packageName); err != nil { + return stacktrace.Propagate(err, "An error occurred creating the '%s' on '%s'", kurtosisYmlFilename, packageDirpath) + } + + if isExecutablePackage { + if err := createMainStarFile(packageDirpath); err != nil { + return stacktrace.Propagate(err, "An error occurred creating the '%s' on '%s'", mainStarFilename, packageDirpath) + } + } + + logrus.Debugf("...'%s' Kurtosis package successfully initialized", packageName) + + return nil +} + +func createKurtosisYamlFile(packageDirpath string, packageName string) error { + + defaultPackageDescriptionForInitPackage := fmt.Sprintf(kurtosisYmlDescriptionFormat, packageName) + defaultPackageReplaceOptionsForInitPackage := map[string]string{} + + kurtosisYaml := enclaves.NewKurtosisYaml(packageName, defaultPackageDescriptionForInitPackage, defaultPackageReplaceOptionsForInitPackage) + + kurtosisYAMLContent, err := yaml.Marshal(kurtosisYaml) + if err != nil { + return stacktrace.Propagate(err, "An error occurred marshalling Kurtosis yaml file '%+v'", kurtosisYaml) + } + + kurtosisYamlFilepath := path.Join(packageDirpath, kurtosisYmlFilename) + + fileInfo, err := os.Stat(kurtosisYamlFilepath) + if fileInfo != nil { + return stacktrace.NewError("Imposible to create a new Kurtosis package inside '%s' because a file with name '%s' already exist on this path", packageDirpath, kurtosisYmlFilename) + } + if os.IsNotExist(err) { + logrus.Debugf("Creating the '%s' file...", kurtosisYmlFilename) + err = os.WriteFile(kurtosisYamlFilepath, kurtosisYAMLContent, kurtosisPackageFilePermissions) + if err != nil { + return stacktrace.Propagate(err, "An error occurred writing the '%s' file", kurtosisYamlFilepath) + } + logrus.Debugf("...'%s' file created", kurtosisYmlFilename) + } + if err != nil { + return stacktrace.Propagate(err, "An error occurred creating the '%s' file on '%s'", kurtosisYmlFilename, packageDirpath) + } + + return nil +} + +func createMainStarFile(packageDirpath string) error { + + mainStarFilepath := path.Join(packageDirpath, mainStarFilename) + + fileInfo, err := os.Stat(mainStarFilepath) + if fileInfo != nil { + return stacktrace.NewError("Imposible to create a new Kurtosis package inside '%s' because a file with name '%s' already exist on this path", packageDirpath, mainStarFilename) + } + + mainStarFileContent := []byte(mainStarFileContentStr) + + if os.IsNotExist(err) { + logrus.Debugf("Creating the '%s' file...", mainStarFilename) + err = os.WriteFile(mainStarFilepath, mainStarFileContent, kurtosisPackageFilePermissions) + if err != nil { + return stacktrace.Propagate(err, "An error occurred writing the '%s' file", mainStarFilepath) + } + logrus.Debugf("...'%s' file created", mainStarFilename) + } + if err != nil { + return stacktrace.Propagate(err, "An error occurred creating the '%s' file on '%s'", mainStarFilename, packageDirpath) + } + return nil +} diff --git a/cli/cli/kurtosis_package/kurtosis_package_test.go b/cli/cli/kurtosis_package/kurtosis_package_test.go new file mode 100644 index 0000000000..165d7624cd --- /dev/null +++ b/cli/cli/kurtosis_package/kurtosis_package_test.go @@ -0,0 +1,184 @@ +package kurtosis_package + +import ( + "github.com/go-yaml/yaml" + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/enclaves" + "github.com/kurtosis-tech/stacktrace" + "github.com/stretchr/testify/require" + "os" + "path" + "testing" +) + +const ( + isExecutablePackage = true + isNotExecutablePackage = false + myTestPackage = "github.com/org/my-package" + mySecondTestPackage = "github.com/org/second-package" + packageInitializeTestDirPattern = "package-initialize-test-dir-*" +) + +func TestInitializeKurtosisPackage_Success(t *testing.T) { + packageDirpath, err := os.MkdirTemp("", packageInitializeTestDirPattern) + require.NoError(t, err) + defer os.RemoveAll(packageDirpath) + + packageName := myTestPackage + err = InitializeKurtosisPackage(packageDirpath, packageName, isExecutablePackage) + require.NoError(t, err) + + // check kurtosis.yml file creation + expectedKurtosisYamlFilepath := path.Join(packageDirpath, kurtosisYmlFilename) + fileBytes, err := os.ReadFile(expectedKurtosisYamlFilepath) + require.NoError(t, err) + + kurtosisYamlObj := &enclaves.KurtosisYaml{ + PackageName: "", + PackageDescription: "", + PackageReplaceOptions: map[string]string{}, + } + err = yaml.UnmarshalStrict(fileBytes, kurtosisYamlObj) + require.NoError(t, err) + require.Equal(t, packageName, kurtosisYamlObj.PackageName) + + // check main.star file creation + expectedMainStarFilepath := path.Join(packageDirpath, mainStarFilename) + fileBytes, err = os.ReadFile(expectedMainStarFilepath) + require.NoError(t, err) + require.Equal(t, mainStarFileContentStr, string(fileBytes)) +} + +func TestInitializeKurtosisPackage_IsNotExecutablePackageSuccess(t *testing.T) { + packageDirpath, err := os.MkdirTemp("", packageInitializeTestDirPattern) + require.NoError(t, err) + defer os.RemoveAll(packageDirpath) + + packageName := myTestPackage + err = InitializeKurtosisPackage(packageDirpath, packageName, isNotExecutablePackage) + require.NoError(t, err) + + // check kurtosis.yml file creation + expectedKurtosisYamlFilepath := path.Join(packageDirpath, kurtosisYmlFilename) + fileBytes, err := os.ReadFile(expectedKurtosisYamlFilepath) + require.NoError(t, err) + + kurtosisYamlObj := &enclaves.KurtosisYaml{ + PackageName: "", + PackageDescription: "", + PackageReplaceOptions: map[string]string{}, + } + err = yaml.UnmarshalStrict(fileBytes, kurtosisYamlObj) + require.NoError(t, err) + require.Equal(t, packageName, kurtosisYamlObj.PackageName) + + // check main.star file was not created + expectedMainStarFilepath := path.Join(packageDirpath, mainStarFilename) + fileBytes, err = os.ReadFile(expectedMainStarFilepath) + require.Error(t, err) + require.True(t, os.IsNotExist(err)) + require.Nil(t, fileBytes) +} + +func TestInitializeKurtosisPackage_FailsIfKurtosisYmlAlreadyExist(t *testing.T) { + packageDirpath, err := os.MkdirTemp("", packageInitializeTestDirPattern) + require.NoError(t, err) + defer os.RemoveAll(packageDirpath) + + packageName := myTestPackage + err = InitializeKurtosisPackage(packageDirpath, packageName, isExecutablePackage) + require.NoError(t, err) + + expectedKurtosisYamlFilepath := path.Join(packageDirpath, kurtosisYmlFilename) + fileBytes, err := os.ReadFile(expectedKurtosisYamlFilepath) + require.NoError(t, err) + + secondPackageName := mySecondTestPackage + err = InitializeKurtosisPackage(packageDirpath, secondPackageName, isExecutablePackage) + require.Error(t, err) + expectedErrorMsgPortion := "'kurtosis.yml' already exist on this path" + require.Contains(t, stacktrace.RootCause(err).Error(), expectedErrorMsgPortion) + + kurtosisYamlObj := &enclaves.KurtosisYaml{ + PackageName: "", + PackageDescription: "", + PackageReplaceOptions: map[string]string{}, + } + + err = yaml.UnmarshalStrict(fileBytes, kurtosisYamlObj) + require.NoError(t, err) + + require.Equal(t, packageName, kurtosisYamlObj.PackageName) +} + +func TestInitializeKurtosisPackage_FailsIfMainStarFileAlreadyExist(t *testing.T) { + packageDirpath, err := os.MkdirTemp("", packageInitializeTestDirPattern) + require.NoError(t, err) + defer os.RemoveAll(packageDirpath) + + // there is a main.star file inside the folder before initializing the package + mainStarFilepath := path.Join(packageDirpath, mainStarFilename) + + _, err = os.Create(mainStarFilepath) + require.NoError(t, err) + + packageName := myTestPackage + err = InitializeKurtosisPackage(packageDirpath, packageName, isNotExecutablePackage) + require.NoError(t, err) + + // check kurtosis.yml file creation + expectedKurtosisYamlFilepath := path.Join(packageDirpath, kurtosisYmlFilename) + fileBytes, err := os.ReadFile(expectedKurtosisYamlFilepath) + require.NoError(t, err) + + kurtosisYamlObj := &enclaves.KurtosisYaml{ + PackageName: "", + PackageDescription: "", + PackageReplaceOptions: map[string]string{}, + } + err = yaml.UnmarshalStrict(fileBytes, kurtosisYamlObj) + require.NoError(t, err) + require.Equal(t, packageName, kurtosisYamlObj.PackageName) + +} + +func TestInitializeKurtosisPackage_InvalidPackageNameError(t *testing.T) { + packageDirpath, err := os.MkdirTemp("", packageInitializeTestDirPattern) + require.NoError(t, err) + defer os.RemoveAll(packageDirpath) + + packageName := "my-url/org/my-package" + err = InitializeKurtosisPackage(packageDirpath, packageName, isExecutablePackage) + require.Error(t, err) + require.ErrorContains(t, err, "invalid GitHub URL") +} + +func TestInitializeKurtosisPackage_MakeScriptPackageSuccess(t *testing.T) { + packageDirpath, err := os.MkdirTemp("", packageInitializeTestDirPattern) + require.NoError(t, err) + defer os.RemoveAll(packageDirpath) + + packageName := myTestPackage + err = InitializeKurtosisPackage(packageDirpath, packageName, isExecutablePackage) + require.NoError(t, err) + + expectedKurtosisYamlFilepath := path.Join(packageDirpath, kurtosisYmlFilename) + fileBytes, err := os.ReadFile(expectedKurtosisYamlFilepath) + require.NoError(t, err) + + secondPackageName := mySecondTestPackage + err = InitializeKurtosisPackage(packageDirpath, secondPackageName, isExecutablePackage) + require.Error(t, err) + expectedErrorMsgPortion := "'kurtosis.yml' already exist on this path" + require.Contains(t, stacktrace.RootCause(err).Error(), expectedErrorMsgPortion) + + kurtosisYamlObj := &enclaves.KurtosisYaml{ + PackageName: "", + PackageDescription: "", + PackageReplaceOptions: map[string]string{}, + } + + err = yaml.UnmarshalStrict(fileBytes, kurtosisYamlObj) + require.NoError(t, err) + + require.Equal(t, packageName, kurtosisYamlObj.PackageName) +} diff --git a/core/server/api_container/server/startosis_engine/startosis_constants/startosis_constants.go b/core/server/api_container/server/startosis_engine/startosis_constants/startosis_constants.go index 90c30a7b86..5262687ccd 100644 --- a/core/server/api_container/server/startosis_engine/startosis_constants/startosis_constants.go +++ b/core/server/api_container/server/startosis_engine/startosis_constants/startosis_constants.go @@ -3,10 +3,9 @@ package startosis_constants type StarlarkContextParam string const ( - MainFileName = "main.star" - KurtosisYamlName = "kurtosis.yml" - GithubDomainPrefix = "github.com" - EmptyInputArgs = "{}" // empty JSON + MainFileName = "main.star" + KurtosisYamlName = "kurtosis.yml" + EmptyInputArgs = "{}" // empty JSON NoOutputObject = "" diff --git a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider.go b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider.go index 337ae2910b..5a0849661b 100644 --- a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider.go +++ b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider.go @@ -4,6 +4,7 @@ import ( "errors" "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing" + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/shared_utils" "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/database_accessors/enclave_db" "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_constants" "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_errors" @@ -21,6 +22,7 @@ const ( temporaryRepoDirPattern = "tmp-repo-dir-*" temporaryArchiveFilePattern = "temp-module-archive-*.tgz" defaultTmpDir = "" + emptyTagBranchOrCommit = "" onlyOneReplacement = 1 replacedWithEmptyString = "" @@ -56,12 +58,12 @@ func NewGitPackageContentProvider(moduleDir string, tmpDir string, enclaveDb *en } func (provider *GitPackageContentProvider) ClonePackage(packageId string) (string, *startosis_errors.InterpretationError) { - parsedURL, interpretationError := parseGitURL(packageId) - if interpretationError != nil { - return "", interpretationError + parsedURL, err := shared_utils.ParseGitURL(packageId) + if err != nil { + return "", startosis_errors.WrapWithInterpretationError(err, "An error occurred parsing Git URL for package ID '%s'", packageId) } - interpretationError = provider.atomicClone(parsedURL) + interpretationError := provider.atomicClone(parsedURL) if interpretationError != nil { return "", interpretationError } @@ -88,15 +90,15 @@ func (provider *GitPackageContentProvider) GetKurtosisYaml(packageAbsolutePathOn } func (provider *GitPackageContentProvider) GetOnDiskAbsoluteFilePath(absoluteFileLocator string) (string, *startosis_errors.InterpretationError) { - parsedURL, interpretationError := parseGitURL(absoluteFileLocator) - if interpretationError != nil { - return "", interpretationError + parsedURL, err := shared_utils.ParseGitURL(absoluteFileLocator) + if err != nil { + return "", startosis_errors.WrapWithInterpretationError(err, "An error occurred parsing Git URL for absolute file locator '%s'", absoluteFileLocator) } - if parsedURL.relativeFilePath == "" { + if parsedURL.GetRelativeFilePath() == "" { return "", startosis_errors.NewInterpretationError("The path '%v' needs to point to a specific file but it didn't. Users can only read or import specific files and not entire packages.", absoluteFileLocator) } - pathToFileOnDisk := path.Join(provider.packagesDir, parsedURL.relativeFilePath) - packagePath := path.Join(provider.packagesDir, parsedURL.relativeRepoPath) + pathToFileOnDisk := path.Join(provider.packagesDir, parsedURL.GetRelativeFilePath()) + packagePath := path.Join(provider.packagesDir, parsedURL.GetRelativeRepoPath()) // Return the file path straight if it exists if _, err := os.Stat(pathToFileOnDisk); err == nil { @@ -106,19 +108,19 @@ func (provider *GitPackageContentProvider) GetOnDiskAbsoluteFilePath(absoluteFil // Check if the repo exists // If the repo exists but the `pathToFileOnDisk` doesn't that means there's a mistake in the locator if _, err := os.Stat(packagePath); err == nil { - relativeFilePathWithoutPackageName := strings.Replace(parsedURL.relativeFilePath, parsedURL.relativeRepoPath, replacedWithEmptyString, onlyOneReplacement) - return "", startosis_errors.NewInterpretationError("'%v' doesn't exist in the package '%v'", relativeFilePathWithoutPackageName, parsedURL.relativeRepoPath) + relativeFilePathWithoutPackageName := strings.Replace(parsedURL.GetRelativeFilePath(), parsedURL.GetRelativeRepoPath(), replacedWithEmptyString, onlyOneReplacement) + return "", startosis_errors.NewInterpretationError("'%v' doesn't exist in the package '%v'", relativeFilePathWithoutPackageName, parsedURL.GetRelativeRepoPath()) } // Otherwise clone the repo and return the absolute path of the requested file - interpretationError = provider.atomicClone(parsedURL) + interpretationError := provider.atomicClone(parsedURL) if interpretationError != nil { return "", interpretationError } // check whether kurtosis yaml exists in the path - maybeKurtosisYamlPath, err := getKurtosisYamlPathForFileUrl(pathToFileOnDisk, provider.packagesDir) - if err != nil { + maybeKurtosisYamlPath, interpretationError := getKurtosisYamlPathForFileUrl(pathToFileOnDisk, provider.packagesDir) + if interpretationError != nil { return "", startosis_errors.WrapWithInterpretationError(err, "Error occurred while verifying whether '%v' belongs to a Kurtosis package.", absoluteFileLocator) } @@ -149,15 +151,15 @@ func (provider *GitPackageContentProvider) GetModuleContents(fileInsideModuleUrl } func (provider *GitPackageContentProvider) GetOnDiskAbsolutePackagePath(packageId string) (string, *startosis_errors.InterpretationError) { - parsedPackageId, interpretationError := parseGitURL(packageId) - if interpretationError != nil { - return "", interpretationError + parsedPackageId, err := shared_utils.ParseGitURL(packageId) + if err != nil { + return "", startosis_errors.WrapWithInterpretationError(err, "An error occurred parsing Git URL for package ID '%s'", packageId) } relPackagePathToPackagesDir := getPathToPackageRoot(parsedPackageId) packageAbsolutePathOnDisk := path.Join(provider.packagesDir, relPackagePathToPackagesDir) - _, err := os.Stat(packageAbsolutePathOnDisk) + _, err = os.Stat(packageAbsolutePathOnDisk) if err != nil { return "", startosis_errors.NewInterpretationError("Package '%v' does not exist on disk at '%s'", packageId, packageAbsolutePathOnDisk) } @@ -165,9 +167,9 @@ func (provider *GitPackageContentProvider) GetOnDiskAbsolutePackagePath(packageI } func (provider *GitPackageContentProvider) StorePackageContents(packageId string, moduleTar io.Reader, overwriteExisting bool) (string, *startosis_errors.InterpretationError) { - parsedPackageId, interpretationError := parseGitURL(packageId) - if interpretationError != nil { - return "", interpretationError + parsedPackageId, err := shared_utils.ParseGitURL(packageId) + if err != nil { + return "", startosis_errors.WrapWithInterpretationError(err, "An error occurred parsing Git URL for package ID '%s'", packageId) } relPackagePathToPackagesDir := getPathToPackageRoot(parsedPackageId) @@ -180,7 +182,7 @@ func (provider *GitPackageContentProvider) StorePackageContents(packageId string } } - _, err := os.Stat(packageAbsolutePathOnDisk) + _, err = os.Stat(packageAbsolutePathOnDisk) if err == nil { return "", startosis_errors.NewInterpretationError("Package '%v' already exists on disk, not overwriting", packageAbsolutePathOnDisk) } @@ -215,16 +217,16 @@ func (provider *GitPackageContentProvider) GetAbsoluteLocatorForRelativeLocator( } // maybe it's not a relative url in which case we return the url - _, errorParsingUrl := parseGitURL(maybeRelativeLocator) + _, errorParsingUrl := shared_utils.ParseGitURL(maybeRelativeLocator) if errorParsingUrl == nil { absoluteLocator = maybeRelativeLocator } else { - parsedParentModuleId, errorParsingPackageId := parseGitURL(parentModuleId) + parsedParentModuleId, errorParsingPackageId := shared_utils.ParseGitURL(parentModuleId) if errorParsingPackageId != nil { return "", startosis_errors.NewInterpretationError("Parent package id '%v' isn't a valid locator; relative URLs don't work with standalone scripts", parentModuleId) } - absoluteLocator = parsedParentModuleId.getAbsoluteLocatorRelativeToThisURL(maybeRelativeLocator) + absoluteLocator = parsedParentModuleId.GetAbsoluteLocatorRelativeToThisURL(maybeRelativeLocator) } replacedAbsoluteLocator := replaceAbsoluteLocator(absoluteLocator, packageReplaceOptions) @@ -243,7 +245,7 @@ func (provider *GitPackageContentProvider) CloneReplacedPackagesIfNeeded(current shouldClonePackage := false - isExistingLocalReplace := isLocalLocator(existingReplace) + isExistingLocalReplace := isLocalDependencyReplace(existingReplace) logrus.Debugf("existingReplace '%v' isExistingLocalReplace? '%v', ", existingReplace, isExistingLocalReplace) currentReplace, isCurrentReplace := currentPackageReplaceOptions[packageId] @@ -281,22 +283,22 @@ func (provider *GitPackageContentProvider) CloneReplacedPackagesIfNeeded(current // atomicClone This first clones to a temporary directory and then moves it // TODO make this support versioning via tags, commit hashes or branches -func (provider *GitPackageContentProvider) atomicClone(parsedURL *ParsedGitURL) *startosis_errors.InterpretationError { +func (provider *GitPackageContentProvider) atomicClone(parsedURL *shared_utils.ParsedGitURL) *startosis_errors.InterpretationError { // First we clone into a temporary directory tempRepoDirPath, err := os.MkdirTemp(provider.packagesTmpDir, temporaryRepoDirPattern) if err != nil { - return startosis_errors.WrapWithInterpretationError(err, "Cloning the module '%s' failed. Error creating temporary directory for the repository to be cloned into", parsedURL.gitURL) + return startosis_errors.WrapWithInterpretationError(err, "Cloning the module '%s' failed. Error creating temporary directory for the repository to be cloned into", parsedURL.GetGitURL()) } defer os.RemoveAll(tempRepoDirPath) - gitClonePath := path.Join(tempRepoDirPath, parsedURL.relativeRepoPath) + gitClonePath := path.Join(tempRepoDirPath, parsedURL.GetRelativeRepoPath()) depth := defaultDepth - if parsedURL.tagBranchOrCommit != emptyTagBranchOrCommit { + if parsedURL.GetTagBranchOrCommit() != emptyTagBranchOrCommit { depth = depthAssumingBranchTagsCommitsAreSpecified } repo, err := git.PlainClone(gitClonePath, isNotBareClone, &git.CloneOptions{ - URL: parsedURL.gitURL, + URL: parsedURL.GetGitURL(), Auth: nil, RemoteName: "", ReferenceName: "", @@ -313,11 +315,11 @@ func (provider *GitPackageContentProvider) atomicClone(parsedURL *ParsedGitURL) // TODO remove public repository from error after we support private repositories // We silent the underlying error here as it can be confusing to the user. For example, when there's a typo in // the repo name, pointing to a non existing repo, the underlying error is: "authentication required" - logrus.Errorf("Error cloning git repository: '%s' to '%s'. Error was: \n%s", parsedURL.gitURL, gitClonePath, err.Error()) - return startosis_errors.NewInterpretationError("Error in cloning git repository '%s' to '%s'. Make sure that '%v' exists and is a public repository.", parsedURL.gitURL, gitClonePath, parsedURL.gitURL) + logrus.Errorf("Error cloning git repository: '%s' to '%s'. Error was: \n%s", parsedURL.GetGitURL(), gitClonePath, err.Error()) + return startosis_errors.NewInterpretationError("Error in cloning git repository '%s' to '%s'. Make sure that '%v' exists and is a public repository.", parsedURL.GetGitURL(), gitClonePath, parsedURL.GetGitURL()) } - if parsedURL.tagBranchOrCommit != emptyTagBranchOrCommit { + if parsedURL.GetTagBranchOrCommit() != emptyTagBranchOrCommit { referenceTagOrBranch, found, referenceErr := getReferenceName(repo, parsedURL) if err != nil { return referenceErr @@ -334,77 +336,77 @@ func (provider *GitPackageContentProvider) atomicClone(parsedURL *ParsedGitURL) // if we have a tag or branch we set it checkoutOptions.Branch = referenceTagOrBranch } else { - maybeHash := plumbing.NewHash(parsedURL.tagBranchOrCommit) + maybeHash := plumbing.NewHash(parsedURL.GetTagBranchOrCommit()) // check whether the hash is a valid hash _, err = repo.CommitObject(maybeHash) if err != nil { - return startosis_errors.NewInterpretationError("Tried using the passed version '%v' as commit as we couldn't find a tag/branch for it in the repo '%v' but failed", parsedURL.tagBranchOrCommit, parsedURL.gitURL) + return startosis_errors.NewInterpretationError("Tried using the passed version '%v' as commit as we couldn't find a tag/branch for it in the repo '%v' but failed", parsedURL.GetTagBranchOrCommit(), parsedURL.GetGitURL()) } checkoutOptions.Hash = maybeHash } workTree, err := repo.Worktree() if err != nil { - return startosis_errors.NewInterpretationError("Tried getting worktree for cloned repo '%v' but failed", parsedURL.gitURL) + return startosis_errors.NewInterpretationError("Tried getting worktree for cloned repo '%v' but failed", parsedURL.GetGitURL()) } if err := workTree.Checkout(checkoutOptions); err != nil { - return startosis_errors.NewInterpretationError("Tried checking out '%v' on repository '%v' but failed", parsedURL.tagBranchOrCommit, parsedURL.gitURL) + return startosis_errors.NewInterpretationError("Tried checking out '%v' on repository '%v' but failed", parsedURL.GetTagBranchOrCommit(), parsedURL.GetGitURL()) } } // Then we move it into the target directory - packageAuthorPath := path.Join(provider.packagesDir, parsedURL.moduleAuthor) - packagePath := path.Join(provider.packagesDir, parsedURL.relativeRepoPath) + packageAuthorPath := path.Join(provider.packagesDir, parsedURL.GetModuleAuthor()) + packagePath := path.Join(provider.packagesDir, parsedURL.GetRelativeRepoPath()) fileMode, err := os.Stat(packageAuthorPath) if err == nil && !fileMode.IsDir() { return startosis_errors.WrapWithInterpretationError(err, "Expected '%s' to be a directory but it is something else", packageAuthorPath) } if err != nil { if err = os.Mkdir(packageAuthorPath, moduleDirPermission); err != nil { - return startosis_errors.WrapWithInterpretationError(err, "Cloning the package '%s' failed. An error occurred while creating the directory '%s'.", parsedURL.gitURL, packageAuthorPath) + return startosis_errors.WrapWithInterpretationError(err, "Cloning the package '%s' failed. An error occurred while creating the directory '%s'.", parsedURL.GetGitURL(), packageAuthorPath) } } if _, err = os.Stat(packagePath); !os.IsNotExist(err) { - logrus.Debugf("Package '%s' already exists in enclave at path '%s'. Going to remove previous version.", parsedURL.gitURL, packagePath) + logrus.Debugf("Package '%s' already exists in enclave at path '%s'. Going to remove previous version.", parsedURL.GetGitURL(), packagePath) if err = os.RemoveAll(packagePath); err != nil { - return startosis_errors.NewInterpretationError("Unable to remove a previous version of package '%s' existing inside Kurtosis enclave at '%s'.", parsedURL.gitURL, packagePath) + return startosis_errors.NewInterpretationError("Unable to remove a previous version of package '%s' existing inside Kurtosis enclave at '%s'.", parsedURL.GetGitURL(), packagePath) } } if err = os.Rename(gitClonePath, packagePath); err != nil { - return startosis_errors.NewInterpretationError("Cloning the package '%s' failed. An error occurred while moving package at temporary destination '%s' to final destination '%s'", parsedURL.gitURL, gitClonePath, packagePath) + return startosis_errors.NewInterpretationError("Cloning the package '%s' failed. An error occurred while moving package at temporary destination '%s' to final destination '%s'", parsedURL.GetGitURL(), gitClonePath, packagePath) } return nil } // methods checks whether the root of the package is same as repository root // or it is a sub-folder under it -func getPathToPackageRoot(parsedPackagePath *ParsedGitURL) string { - packagePathOnDisk := parsedPackagePath.relativeRepoPath - if parsedPackagePath.relativeFilePath != relativeFilePathNotFound { - packagePathOnDisk = parsedPackagePath.relativeFilePath +func getPathToPackageRoot(parsedPackagePath *shared_utils.ParsedGitURL) string { + packagePathOnDisk := parsedPackagePath.GetRelativeRepoPath() + if parsedPackagePath.GetRelativeFilePath() != relativeFilePathNotFound { + packagePathOnDisk = parsedPackagePath.GetRelativeFilePath() } return packagePathOnDisk } -func getReferenceName(repo *git.Repository, parsedURL *ParsedGitURL) (plumbing.ReferenceName, bool, *startosis_errors.InterpretationError) { - tag, err := repo.Tag(parsedURL.tagBranchOrCommit) +func getReferenceName(repo *git.Repository, parsedURL *shared_utils.ParsedGitURL) (plumbing.ReferenceName, bool, *startosis_errors.InterpretationError) { + tag, err := repo.Tag(parsedURL.GetTagBranchOrCommit()) if err == nil { return tag.Name(), true, nil } if err != nil && err != git.ErrTagNotFound { - return "", false, startosis_errors.NewInterpretationError("An error occurred while checking whether '%v' is a tag and exists in '%v'", parsedURL.tagBranchOrCommit, parsedURL.gitURL) + return "", false, startosis_errors.NewInterpretationError("An error occurred while checking whether '%v' is a tag and exists in '%v'", parsedURL.GetTagBranchOrCommit(), parsedURL.GetGitURL()) } // for branches there is repo.Branch() but that doesn't work with remote branches refs, err := repo.References() if err != nil { - return "", false, startosis_errors.NewInterpretationError("An error occurred while fetching references for repository '%v'", parsedURL.gitURL) + return "", false, startosis_errors.NewInterpretationError("An error occurred while fetching references for repository '%v'", parsedURL.GetGitURL()) } var branchReference *plumbing.Reference err = refs.ForEach(func(r *plumbing.Reference) error { - if r.Name() == plumbing.NewRemoteReferenceName(git.DefaultRemoteName, parsedURL.tagBranchOrCommit) { + if r.Name() == plumbing.NewRemoteReferenceName(git.DefaultRemoteName, parsedURL.GetTagBranchOrCommit()) { branchReference = r return nil } @@ -413,7 +415,7 @@ func getReferenceName(repo *git.Repository, parsedURL *ParsedGitURL) (plumbing.R // checking the error even though the above can't ever error if err != nil { - return "", false, startosis_errors.NewInterpretationError("An error occurred while iterating through references in repository '%v'; This is a bug in Kurtosis", parsedURL.gitURL) + return "", false, startosis_errors.NewInterpretationError("An error occurred while iterating through references in repository '%v'; This is a bug in Kurtosis", parsedURL.GetGitURL()) } if branchReference != nil { @@ -441,15 +443,15 @@ func validateAndGetKurtosisYaml(absPathToKurtosisYmlInThePackage string, package // this method validates whether the package name found in kurtosis yml is same as the location where kurtosis.yml is found func validatePackageNameMatchesKurtosisYamlLocation(kurtosisYaml *yaml_parser.KurtosisYaml, absPathToKurtosisYmlInThePackage string, packageDir string) *startosis_errors.InterpretationError { // get package name from absolute path to package - packageNameFromAbsPackagePath := strings.Replace(absPathToKurtosisYmlInThePackage, packageDir, startosis_constants.GithubDomainPrefix, replaceCountPackageDirWithGithubConstant) + packageNameFromAbsPackagePath := strings.Replace(absPathToKurtosisYmlInThePackage, packageDir, shared_utils.GithubDomainPrefix, replaceCountPackageDirWithGithubConstant) packageName := kurtosisYaml.GetPackageName() if strings.HasSuffix(packageName, osPathSeparatorString) { return startosis_errors.NewInterpretationError("Kurtosis package name cannot have trailing %q; package name: %v and kurtosis.yml is found at: %v", osPathSeparatorString, packageName, packageNameFromAbsPackagePath) } - // re-using parseGitURL with packageName found from kurtosis.yml as it already does some validations - _, err := parseGitURL(packageName) + // re-using ParseGitURL with packageName found from kurtosis.yml as it already does some validations + _, err := shared_utils.ParseGitURL(packageName) if err != nil { return startosis_errors.WrapWithInterpretationError(err, "Error occurred while validating package name: %v which is found in kurtosis.yml at: '%v'", kurtosisYaml.GetPackageName(), packageNameFromAbsPackagePath) } @@ -506,3 +508,10 @@ func getKurtosisYamlPathForFileUrlInternal(absPathToFile string, packagesDir str } return filePathToKurtosisYamlNotFound, nil } + +func isLocalDependencyReplace(replace string) bool { + if strings.HasPrefix(replace, osPathSeparatorString) || strings.HasPrefix(replace, dotRelativePathIndicatorString) { + return true + } + return false +} diff --git a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider_test.go b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider_test.go index 964464c5c8..d605565c88 100644 --- a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider_test.go +++ b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider_test.go @@ -2,6 +2,7 @@ package git_package_content_provider import ( "fmt" + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/shared_utils" "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/database_accessors/enclave_db" "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_constants" "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_errors" @@ -315,13 +316,13 @@ func TestGetAbsoluteLocatorForRelativeModuleLocator_LocalPackagehReplaceSucceeds func Test_getPathToPackageRoot(t *testing.T) { githubUrlWithKurtosisPackageInSubfolder := "github.com/sample/sample-package/folder/subpackage" - parsedGitUrl, err := parseGitURL(githubUrlWithKurtosisPackageInSubfolder) + parsedGitUrl, err := shared_utils.ParseGitURL(githubUrlWithKurtosisPackageInSubfolder) require.Nil(t, err, "Unexpected error occurred while parsing git url") actual := getPathToPackageRoot(parsedGitUrl) require.Equal(t, "sample/sample-package/folder/subpackage", actual) githubUrlWithRootKurtosisPackage := "github.com/sample/sample-package" - parsedGitUrl, err = parseGitURL(githubUrlWithRootKurtosisPackage) + parsedGitUrl, err = shared_utils.ParseGitURL(githubUrlWithRootKurtosisPackage) require.Nil(t, err, "Unexpected error occurred while parsing git url") actual = getPathToPackageRoot(parsedGitUrl) require.Equal(t, "sample/sample-package", actual) diff --git a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/locators.go b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/locators.go index 5429424e01..491104d947 100644 --- a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/locators.go +++ b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/locators.go @@ -1,6 +1,7 @@ package git_package_content_provider import ( + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/shared_utils" "github.com/sirupsen/logrus" "strings" ) @@ -49,13 +50,13 @@ func findPackageReplace(absoluteLocator string, packageReplaceOptions map[string pathToAnalyze := absoluteLocator for { - numberSlashes := strings.Count(pathToAnalyze, urlPathSeparator) + numberSlashes := strings.Count(pathToAnalyze, shared_utils.UrlPathSeparator) // check for the minimal path e.g.: github.com/org/package - if numberSlashes < minimumSubPathsForValidGitURL { + if numberSlashes < shared_utils.MinimumSubPathsForValidGitURL { break } - lastIndex := strings.LastIndex(pathToAnalyze, urlPathSeparator) + lastIndex := strings.LastIndex(pathToAnalyze, shared_utils.UrlPathSeparator) packageToBeReplaced := pathToAnalyze[:lastIndex] replaceWithPackage, ok := packageReplaceOptions[packageToBeReplaced] diff --git a/core/server/api_container/server/startosis_engine/startosis_packages/mock_package_content_provider/mock_package_content_provider.go b/core/server/api_container/server/startosis_engine/startosis_packages/mock_package_content_provider/mock_package_content_provider.go index dce7a7072e..65cbb3f723 100644 --- a/core/server/api_container/server/startosis_engine/startosis_packages/mock_package_content_provider/mock_package_content_provider.go +++ b/core/server/api_container/server/startosis_engine/startosis_packages/mock_package_content_provider/mock_package_content_provider.go @@ -1,7 +1,7 @@ package mock_package_content_provider import ( - "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_constants" + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/shared_utils" "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_errors" "github.com/kurtosis-tech/kurtosis/core/server/commons/yaml_parser" "github.com/kurtosis-tech/stacktrace" @@ -81,7 +81,7 @@ func (provider *MockPackageContentProvider) GetAbsoluteLocatorForRelativeLocator return "", startosis_errors.NewInterpretationError("Cannot use local absolute locators") } - if strings.HasPrefix(relativeOrAbsoluteModulePath, startosis_constants.GithubDomainPrefix) { + if strings.HasPrefix(relativeOrAbsoluteModulePath, shared_utils.GithubDomainPrefix) { return relativeOrAbsoluteModulePath, nil } return provider.packageId, nil diff --git a/docs/docs/cli-reference/package-init.md b/docs/docs/cli-reference/package-init.md new file mode 100644 index 0000000000..eab35e63cd --- /dev/null +++ b/docs/docs/cli-reference/package-init.md @@ -0,0 +1,17 @@ +# kurtosis package init +This command initializes the current directory to be a [Kurtosis package][package] by creating a [`kurtosis.yml` file][kurtosis-yml] with the given package name. + +``` +Usage: + kurtosis package init [flags] package_name +``` + +The `package_name` argument is the [locator][locators]to the package, in the format `github.com/USER/REPO`. + +This command accepts the following flags: +- `--main`: indicates that the created package is an [executable package][executable-package], and generates a `main.star` if one does not already exist. If a `main.star` already exists, does nothing. + +[package]: ../concepts-reference/packages.md +[kurtosis-yml]: ../concepts-reference/kurtosis-yml.md +[locators]: ../concepts-reference/locators.md +[executable-package]: ../concepts-reference/packages.md#runnable-packages \ No newline at end of file From 77f9ad42ba18f00faea5937bf3a971056ea8720b Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 17 Oct 2023 14:31:12 +0100 Subject: [PATCH 4/7] fix: error clearly if there are no nodes on the Kubernetes cluster (#1553) ## Description: An AWS EKS cluster starts with no nodes which is quite confusing for the user if the engine doesn't start. This checks if there are any nodes and otherwise tells the user there aren't ## Is this change user facing? YES ## References (if applicable): #1507 --- .../engine_functions/create_engine.go | 8 +++++++ .../kubernetes_manager/kubernetes_manager.go | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_kurtosis_backend/engine_functions/create_engine.go b/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_kurtosis_backend/engine_functions/create_engine.go index 8009b58458..fc0e06bb7e 100644 --- a/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_kurtosis_backend/engine_functions/create_engine.go +++ b/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_kurtosis_backend/engine_functions/create_engine.go @@ -42,6 +42,14 @@ func CreateEngine( *engine.Engine, error, ) { + hasNodes, err := kubernetesManager.HasComputeNodes(ctx) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred while verifying whether the Kubernetes cluster has any compute nodes") + } + if !hasNodes { + return nil, stacktrace.NewError("Can't start engine on the Kubernetes cluster as it has no compute nodes") + } + engineGuidStr, err := uuid_generator.GenerateUUIDString() if err != nil { return nil, stacktrace.Propagate(err, "An error occurred generating a UUID string for the engine") diff --git a/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_manager/kubernetes_manager.go b/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_manager/kubernetes_manager.go index e4ff86c01e..231c0b6340 100644 --- a/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_manager/kubernetes_manager.go +++ b/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_manager/kubernetes_manager.go @@ -122,6 +122,22 @@ var ( }, ResourceVersion: "", } + globalListOptions = metav1.ListOptions{ + TypeMeta: metav1.TypeMeta{ + Kind: "", + APIVersion: "", + }, + LabelSelector: "", + FieldSelector: "", + Watch: false, + AllowWatchBookmarks: false, + ResourceVersion: "", + ResourceVersionMatch: "", + TimeoutSeconds: nil, + Limit: 0, + Continue: "", + SendInitialEvents: nil, + } ) type KubernetesManager struct { @@ -1729,6 +1745,14 @@ func (manager *KubernetesManager) GetExecStream(ctx context.Context, pod *apiv1. }) } +func (manager *KubernetesManager) HasComputeNodes(ctx context.Context) (bool, error) { + nodes, err := manager.kubernetesClientSet.CoreV1().Nodes().List(ctx, globalListOptions) + if err != nil { + return false, stacktrace.Propagate(err, "An error occurred while checking if the Kubernetes cluster has any nodes") + } + return len(nodes.Items) != 0, nil +} + // TODO Delete this after 2022-08-01 if we're not using Jobs /* func (manager *KubernetesManager) CreateJobWithContainerAndVolume(ctx context.Context, From 38cf04cb68c1f3863741ed5d86d23eba166c2488 Mon Sep 17 00:00:00 2001 From: kurtosisbot <89932784+kurtosisbot@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:33:52 +0200 Subject: [PATCH 5/7] chore(main): release 0.84.8 (#1577) :robot: I have created a release *beep* *boop* --- ## [0.84.8](https://github.com/kurtosis-tech/kurtosis/compare/0.84.7...0.84.8) (2023-10-17) ### Features * kurtosis package init command ([#1547](https://github.com/kurtosis-tech/kurtosis/issues/1547)) ([6411c8f](https://github.com/kurtosis-tech/kurtosis/commit/6411c8f8b8f2ed3737d04c6d8a7a0938f7486aa3)) ### Bug Fixes * correct the link to kurtosis upgrade docs ([#1574](https://github.com/kurtosis-tech/kurtosis/issues/1574)) ([11d1dba](https://github.com/kurtosis-tech/kurtosis/commit/11d1dba7541fc87fdf0e6bee3efe345edd732c23)) * error clearly if there are no nodes on the Kubernetes cluster ([#1553](https://github.com/kurtosis-tech/kurtosis/issues/1553)) ([77f9ad4](https://github.com/kurtosis-tech/kurtosis/commit/77f9ad42ba18f00faea5937bf3a971056ea8720b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: kurtosisbot --- CHANGELOG.md | 13 +++++++++++++ LICENSE.md | 4 ++-- api/golang/kurtosis_version/kurtosis_version.go | 2 +- api/rust/Cargo.toml | 2 +- api/typescript/package.json | 2 +- .../src/kurtosis_version/kurtosis_version.ts | 2 +- version.txt | 2 +- 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b198d16de3..59719cbbe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [0.84.8](https://github.com/kurtosis-tech/kurtosis/compare/0.84.7...0.84.8) (2023-10-17) + + +### Features + +* kurtosis package init command ([#1547](https://github.com/kurtosis-tech/kurtosis/issues/1547)) ([6411c8f](https://github.com/kurtosis-tech/kurtosis/commit/6411c8f8b8f2ed3737d04c6d8a7a0938f7486aa3)) + + +### Bug Fixes + +* correct the link to kurtosis upgrade docs ([#1574](https://github.com/kurtosis-tech/kurtosis/issues/1574)) ([11d1dba](https://github.com/kurtosis-tech/kurtosis/commit/11d1dba7541fc87fdf0e6bee3efe345edd732c23)) +* error clearly if there are no nodes on the Kubernetes cluster ([#1553](https://github.com/kurtosis-tech/kurtosis/issues/1553)) ([77f9ad4](https://github.com/kurtosis-tech/kurtosis/commit/77f9ad42ba18f00faea5937bf3a971056ea8720b)) + ## [0.84.7](https://github.com/kurtosis-tech/kurtosis/compare/0.84.6...0.84.7) (2023-10-16) diff --git a/LICENSE.md b/LICENSE.md index eb62169c03..e3deaebb90 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -3,7 +3,7 @@ Business Source License 1.1 Parameters Licensor: Kurtosis Technologies, Inc. -Licensed Work: Kurtosis 0.84.7 +Licensed Work: Kurtosis 0.84.8 The Licensed Work is (c) 2023 Kurtosis Technologies, Inc. Additional Use Grant: You may make use of the Licensed Work, provided that you may not use the Licensed Work for an Environment Orchestration Service. @@ -12,7 +12,7 @@ you may not use the Licensed Work for an Environment Orchestration Service. allows third parties (other than your employees and contractors) to create distributed system environments. -Change Date: 2027-10-16 +Change Date: 2027-10-17 Change License: AGPLv3 (GNU Affero General Public License Version 3) diff --git a/api/golang/kurtosis_version/kurtosis_version.go b/api/golang/kurtosis_version/kurtosis_version.go index c1f0efc110..05d3f77e55 100644 --- a/api/golang/kurtosis_version/kurtosis_version.go +++ b/api/golang/kurtosis_version/kurtosis_version.go @@ -9,6 +9,6 @@ const ( // !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! // This is necessary so that Kurt Core consumers will know if they're compatible with the currently-running // API container - KurtosisVersion = "0.84.7" + KurtosisVersion = "0.84.8" // !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! ) diff --git a/api/rust/Cargo.toml b/api/rust/Cargo.toml index b7991280e6..fe3ec402c1 100644 --- a/api/rust/Cargo.toml +++ b/api/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kurtosis-sdk" -version = "0.84.7" +version = "0.84.8" license = "BUSL-1.1" description = "Rust SDK for Kurtosis" edition = "2021" diff --git a/api/typescript/package.json b/api/typescript/package.json index cfbe76d49c..9764c3982a 100644 --- a/api/typescript/package.json +++ b/api/typescript/package.json @@ -1,7 +1,7 @@ { "name": "kurtosis-sdk", "//": "NOTE: DO NOT UPDATE THIS VERSION MANUALLY - IT WILL BE UPDATED DURING THE RELEASE PROCESS!", - "version": "0.84.7", + "version": "0.84.8", "main": "./build/index", "description": "This repo contains a Typescript client for communicating with the Kurtosis Engine server, which is responsible for creating, managing and destroying Kurtosis Enclaves.", "types": "./build/index", diff --git a/api/typescript/src/kurtosis_version/kurtosis_version.ts b/api/typescript/src/kurtosis_version/kurtosis_version.ts index 269deb901a..c08a5eb21f 100644 --- a/api/typescript/src/kurtosis_version/kurtosis_version.ts +++ b/api/typescript/src/kurtosis_version/kurtosis_version.ts @@ -1,5 +1,5 @@ // !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! // This is necessary so that Kurt Core consumers (e.g. modules) will know if they're compatible with the currently-running // API container -export const KURTOSIS_VERSION: string = "0.84.7" +export const KURTOSIS_VERSION: string = "0.84.8" // !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! diff --git a/version.txt b/version.txt index be7ecfcdc2..b60169d905 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.84.7 +0.84.8 From 9f3d808264fa1d83d6fd0d2ea3dde3b5d3f9e48e Mon Sep 17 00:00:00 2001 From: Laurent Luce Date: Tue, 17 Oct 2023 17:11:24 -0400 Subject: [PATCH 6/7] feat: Cloud backend method to refresh the default payment method (#1569) ## Description: Cloud backend API method to go with https://github.com/kurtosis-tech/kurtosis-cloud-backend/pull/59 ## Is this change user facing? NO --- .../kurtosis_backend_server_api.pb.go | 260 ++++++++++++------ .../kurtosis_backend_server_api_grpc.pb.go | 49 +++- .../kurtosis_backend_server_api.connect.go | 40 ++- .../kurtosis_backend_server_api.proto | 6 + 4 files changed, 255 insertions(+), 100 deletions(-) diff --git a/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_api.pb.go b/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_api.pb.go index 4dc811f950..28c54b3033 100644 --- a/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_api.pb.go +++ b/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_api.pb.go @@ -724,6 +724,61 @@ func (x *GetOrCreatePaymentConfigResponse) GetPaymentMethod() *PaymentMethod { return nil } +type RefreshDefaultPaymentMethodArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + PaymentMethodId string `protobuf:"bytes,2,opt,name=payment_method_id,json=paymentMethodId,proto3" json:"payment_method_id,omitempty"` +} + +func (x *RefreshDefaultPaymentMethodArgs) Reset() { + *x = RefreshDefaultPaymentMethodArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_kurtosis_backend_server_api_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RefreshDefaultPaymentMethodArgs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RefreshDefaultPaymentMethodArgs) ProtoMessage() {} + +func (x *RefreshDefaultPaymentMethodArgs) ProtoReflect() protoreflect.Message { + mi := &file_kurtosis_backend_server_api_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RefreshDefaultPaymentMethodArgs.ProtoReflect.Descriptor instead. +func (*RefreshDefaultPaymentMethodArgs) Descriptor() ([]byte, []int) { + return file_kurtosis_backend_server_api_proto_rawDescGZIP(), []int{12} +} + +func (x *RefreshDefaultPaymentMethodArgs) GetAccessToken() string { + if x != nil { + return x.AccessToken + } + return "" +} + +func (x *RefreshDefaultPaymentMethodArgs) GetPaymentMethodId() string { + if x != nil { + return x.PaymentMethodId + } + return "" +} + type AwsKey struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -736,7 +791,7 @@ type AwsKey struct { func (x *AwsKey) Reset() { *x = AwsKey{} if protoimpl.UnsafeEnabled { - mi := &file_kurtosis_backend_server_api_proto_msgTypes[12] + mi := &file_kurtosis_backend_server_api_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -749,7 +804,7 @@ func (x *AwsKey) String() string { func (*AwsKey) ProtoMessage() {} func (x *AwsKey) ProtoReflect() protoreflect.Message { - mi := &file_kurtosis_backend_server_api_proto_msgTypes[12] + mi := &file_kurtosis_backend_server_api_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -762,7 +817,7 @@ func (x *AwsKey) ProtoReflect() protoreflect.Message { // Deprecated: Use AwsKey.ProtoReflect.Descriptor instead. func (*AwsKey) Descriptor() ([]byte, []int) { - return file_kurtosis_backend_server_api_proto_rawDescGZIP(), []int{12} + return file_kurtosis_backend_server_api_proto_rawDescGZIP(), []int{13} } func (x *AwsKey) GetId() string { @@ -794,7 +849,7 @@ type AwsEnvironment struct { func (x *AwsEnvironment) Reset() { *x = AwsEnvironment{} if protoimpl.UnsafeEnabled { - mi := &file_kurtosis_backend_server_api_proto_msgTypes[13] + mi := &file_kurtosis_backend_server_api_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -807,7 +862,7 @@ func (x *AwsEnvironment) String() string { func (*AwsEnvironment) ProtoMessage() {} func (x *AwsEnvironment) ProtoReflect() protoreflect.Message { - mi := &file_kurtosis_backend_server_api_proto_msgTypes[13] + mi := &file_kurtosis_backend_server_api_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -820,7 +875,7 @@ func (x *AwsEnvironment) ProtoReflect() protoreflect.Message { // Deprecated: Use AwsEnvironment.ProtoReflect.Descriptor instead. func (*AwsEnvironment) Descriptor() ([]byte, []int) { - return file_kurtosis_backend_server_api_proto_rawDescGZIP(), []int{13} + return file_kurtosis_backend_server_api_proto_rawDescGZIP(), []int{14} } func (x *AwsEnvironment) GetAccessKeyId() string { @@ -953,73 +1008,87 @@ var file_kurtosis_backend_server_api_proto_rawDesc = []byte{ 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, - 0x0d, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x22, 0x30, - 0x0a, 0x06, 0x41, 0x77, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, - 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x22, 0xd4, 0x01, 0x0a, 0x0e, 0x41, 0x77, 0x73, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, - 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x65, 0x63, 0x72, 0x65, - 0x74, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x72, 0x65, - 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x75, 0x63, 0x6b, - 0x65, 0x74, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x75, 0x63, 0x6b, - 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, - 0x75, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x62, 0x75, 0x63, - 0x6b, 0x65, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x32, 0xac, 0x05, 0x0a, 0x1a, 0x4b, 0x75, 0x72, 0x74, - 0x6f, 0x73, 0x69, 0x73, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x0b, 0x49, 0x73, 0x41, 0x76, 0x61, 0x69, - 0x6c, 0x61, 0x62, 0x6c, 0x65, 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, 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, 0x79, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x2d, + 0x0d, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x22, 0x70, + 0x0a, 0x1f, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x72, 0x67, + 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x49, 0x64, + 0x22, 0x30, 0x0a, 0x06, 0x41, 0x77, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x22, 0xd4, 0x01, 0x0a, 0x0e, 0x41, 0x77, 0x73, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, + 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, + 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x65, 0x63, + 0x72, 0x65, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x5f, + 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x75, + 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x75, + 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x62, + 0x75, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x66, 0x6f, 0x6c, 0x64, 0x65, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x32, 0x96, 0x06, 0x0a, 0x1a, 0x4b, 0x75, + 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x42, 0x61, 0x63, 0x6b, 0x65, + 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x0b, 0x49, 0x73, 0x41, 0x76, + 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 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, + 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, 0x79, 0x0a, 0x13, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x12, 0x2d, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, + 0x64, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x72, 0x67, 0x73, 0x1a, + 0x31, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x76, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2a, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x31, 0x2e, - 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, - 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x76, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, - 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2a, 0x2e, 0x6b, - 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, - 0x74, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x2e, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, - 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x6f, - 0x75, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6a, 0x0a, 0x11, 0x47, 0x65, - 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, - 0x28, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, - 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, - 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6b, 0x75, 0x72, 0x74, - 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x70, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x2a, 0x2e, - 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, - 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, - 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6b, 0x75, 0x72, 0x74, - 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7c, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4f, - 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2c, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, + 0x47, 0x65, 0x74, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x2e, 0x2e, 0x6b, 0x75, 0x72, + 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x43, + 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6a, 0x0a, 0x11, + 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, + 0x79, 0x12, 0x28, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x70, + 0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6b, 0x75, + 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, + 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x70, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4f, + 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, + 0x2a, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6b, 0x75, + 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, + 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7c, 0x0a, 0x18, 0x47, 0x65, + 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2c, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, + 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x41, 0x72, 0x67, 0x73, 0x1a, 0x30, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x72, - 0x67, 0x73, 0x1a, 0x30, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x63, 0x6c, - 0x6f, 0x75, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x5d, 0x5a, 0x5b, 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, 0x63, 0x6c, 0x6f, 0x75, - 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x6b, 0x75, 0x72, - 0x74, 0x6f, 0x73, 0x69, 0x73, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 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, + 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x68, 0x0a, 0x1b, 0x52, 0x65, 0x66, 0x72, + 0x65, 0x73, 0x68, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x2f, 0x2e, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, + 0x69, 0x73, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, + 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 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, 0x42, 0x5d, 0x5a, 0x5b, 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, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x6b, 0x75, 0x72, 0x74, 0x6f, 0x73, 0x69, + 0x73, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 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 ( @@ -1034,7 +1103,7 @@ func file_kurtosis_backend_server_api_proto_rawDescGZIP() []byte { return file_kurtosis_backend_server_api_proto_rawDescData } -var file_kurtosis_backend_server_api_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_kurtosis_backend_server_api_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_kurtosis_backend_server_api_proto_goTypes = []interface{}{ (*GetOrCreateApiKeyRequest)(nil), // 0: kurtosis_cloud.GetOrCreateApiKeyRequest (*GetOrCreateApiKeyResponse)(nil), // 1: kurtosis_cloud.GetOrCreateApiKeyResponse @@ -1048,29 +1117,32 @@ var file_kurtosis_backend_server_api_proto_goTypes = []interface{}{ (*GetOrCreatePaymentConfigArgs)(nil), // 9: kurtosis_cloud.GetOrCreatePaymentConfigArgs (*PaymentMethod)(nil), // 10: kurtosis_cloud.PaymentMethod (*GetOrCreatePaymentConfigResponse)(nil), // 11: kurtosis_cloud.GetOrCreatePaymentConfigResponse - (*AwsKey)(nil), // 12: kurtosis_cloud.AwsKey - (*AwsEnvironment)(nil), // 13: kurtosis_cloud.AwsEnvironment - (*emptypb.Empty)(nil), // 14: google.protobuf.Empty + (*RefreshDefaultPaymentMethodArgs)(nil), // 12: kurtosis_cloud.RefreshDefaultPaymentMethodArgs + (*AwsKey)(nil), // 13: kurtosis_cloud.AwsKey + (*AwsEnvironment)(nil), // 14: kurtosis_cloud.AwsEnvironment + (*emptypb.Empty)(nil), // 15: google.protobuf.Empty } var file_kurtosis_backend_server_api_proto_depIdxs = []int32{ 7, // 0: kurtosis_cloud.GetCloudInstanceConfigResponse.launch_result:type_name -> kurtosis_cloud.LaunchResult - 12, // 1: kurtosis_cloud.GetCloudInstanceConfigResponse.user_key:type_name -> kurtosis_cloud.AwsKey - 13, // 2: kurtosis_cloud.GetCloudInstanceConfigResponse.aws_environment:type_name -> kurtosis_cloud.AwsEnvironment + 13, // 1: kurtosis_cloud.GetCloudInstanceConfigResponse.user_key:type_name -> kurtosis_cloud.AwsKey + 14, // 2: kurtosis_cloud.GetCloudInstanceConfigResponse.aws_environment:type_name -> kurtosis_cloud.AwsEnvironment 10, // 3: kurtosis_cloud.GetOrCreatePaymentConfigResponse.payment_method:type_name -> kurtosis_cloud.PaymentMethod - 14, // 4: kurtosis_cloud.KurtosisCloudBackendServer.IsAvailable:input_type -> google.protobuf.Empty + 15, // 4: kurtosis_cloud.KurtosisCloudBackendServer.IsAvailable:input_type -> google.protobuf.Empty 4, // 5: kurtosis_cloud.KurtosisCloudBackendServer.CreateCloudInstance:input_type -> kurtosis_cloud.CreateCloudInstanceConfigArgs 6, // 6: kurtosis_cloud.KurtosisCloudBackendServer.GetCloudInstanceConfig:input_type -> kurtosis_cloud.GetCloudInstanceConfigArgs 0, // 7: kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreateApiKey:input_type -> kurtosis_cloud.GetOrCreateApiKeyRequest 2, // 8: kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreateInstance:input_type -> kurtosis_cloud.GetOrCreateInstanceRequest 9, // 9: kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreatePaymentConfig:input_type -> kurtosis_cloud.GetOrCreatePaymentConfigArgs - 14, // 10: kurtosis_cloud.KurtosisCloudBackendServer.IsAvailable:output_type -> google.protobuf.Empty - 5, // 11: kurtosis_cloud.KurtosisCloudBackendServer.CreateCloudInstance:output_type -> kurtosis_cloud.CreateCloudInstanceConfigResponse - 8, // 12: kurtosis_cloud.KurtosisCloudBackendServer.GetCloudInstanceConfig:output_type -> kurtosis_cloud.GetCloudInstanceConfigResponse - 1, // 13: kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreateApiKey:output_type -> kurtosis_cloud.GetOrCreateApiKeyResponse - 3, // 14: kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreateInstance:output_type -> kurtosis_cloud.GetOrCreateInstanceResponse - 11, // 15: kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreatePaymentConfig:output_type -> kurtosis_cloud.GetOrCreatePaymentConfigResponse - 10, // [10:16] is the sub-list for method output_type - 4, // [4:10] is the sub-list for method input_type + 12, // 10: kurtosis_cloud.KurtosisCloudBackendServer.RefreshDefaultPaymentMethod:input_type -> kurtosis_cloud.RefreshDefaultPaymentMethodArgs + 15, // 11: kurtosis_cloud.KurtosisCloudBackendServer.IsAvailable:output_type -> google.protobuf.Empty + 5, // 12: kurtosis_cloud.KurtosisCloudBackendServer.CreateCloudInstance:output_type -> kurtosis_cloud.CreateCloudInstanceConfigResponse + 8, // 13: kurtosis_cloud.KurtosisCloudBackendServer.GetCloudInstanceConfig:output_type -> kurtosis_cloud.GetCloudInstanceConfigResponse + 1, // 14: kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreateApiKey:output_type -> kurtosis_cloud.GetOrCreateApiKeyResponse + 3, // 15: kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreateInstance:output_type -> kurtosis_cloud.GetOrCreateInstanceResponse + 11, // 16: kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreatePaymentConfig:output_type -> kurtosis_cloud.GetOrCreatePaymentConfigResponse + 15, // 17: kurtosis_cloud.KurtosisCloudBackendServer.RefreshDefaultPaymentMethod:output_type -> google.protobuf.Empty + 11, // [11:18] is the sub-list for method output_type + 4, // [4:11] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name 4, // [4:4] is the sub-list for extension extendee 0, // [0:4] is the sub-list for field type_name @@ -1227,7 +1299,7 @@ func file_kurtosis_backend_server_api_proto_init() { } } file_kurtosis_backend_server_api_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AwsKey); i { + switch v := v.(*RefreshDefaultPaymentMethodArgs); i { case 0: return &v.state case 1: @@ -1239,6 +1311,18 @@ func file_kurtosis_backend_server_api_proto_init() { } } file_kurtosis_backend_server_api_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AwsKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kurtosis_backend_server_api_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AwsEnvironment); i { case 0: return &v.state @@ -1258,7 +1342,7 @@ func file_kurtosis_backend_server_api_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_kurtosis_backend_server_api_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 15, NumExtensions: 0, NumServices: 1, }, diff --git a/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_api_grpc.pb.go b/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_api_grpc.pb.go index eb3ceb0d18..a85adecf69 100644 --- a/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_api_grpc.pb.go +++ b/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_api_grpc.pb.go @@ -20,12 +20,13 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - KurtosisCloudBackendServer_IsAvailable_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/IsAvailable" - KurtosisCloudBackendServer_CreateCloudInstance_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/CreateCloudInstance" - KurtosisCloudBackendServer_GetCloudInstanceConfig_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/GetCloudInstanceConfig" - KurtosisCloudBackendServer_GetOrCreateApiKey_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/GetOrCreateApiKey" - KurtosisCloudBackendServer_GetOrCreateInstance_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/GetOrCreateInstance" - KurtosisCloudBackendServer_GetOrCreatePaymentConfig_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/GetOrCreatePaymentConfig" + KurtosisCloudBackendServer_IsAvailable_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/IsAvailable" + KurtosisCloudBackendServer_CreateCloudInstance_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/CreateCloudInstance" + KurtosisCloudBackendServer_GetCloudInstanceConfig_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/GetCloudInstanceConfig" + KurtosisCloudBackendServer_GetOrCreateApiKey_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/GetOrCreateApiKey" + KurtosisCloudBackendServer_GetOrCreateInstance_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/GetOrCreateInstance" + KurtosisCloudBackendServer_GetOrCreatePaymentConfig_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/GetOrCreatePaymentConfig" + KurtosisCloudBackendServer_RefreshDefaultPaymentMethod_FullMethodName = "/kurtosis_cloud.KurtosisCloudBackendServer/RefreshDefaultPaymentMethod" ) // KurtosisCloudBackendServerClient is the client API for KurtosisCloudBackendServer service. @@ -38,6 +39,7 @@ type KurtosisCloudBackendServerClient interface { GetOrCreateApiKey(ctx context.Context, in *GetOrCreateApiKeyRequest, opts ...grpc.CallOption) (*GetOrCreateApiKeyResponse, error) GetOrCreateInstance(ctx context.Context, in *GetOrCreateInstanceRequest, opts ...grpc.CallOption) (*GetOrCreateInstanceResponse, error) GetOrCreatePaymentConfig(ctx context.Context, in *GetOrCreatePaymentConfigArgs, opts ...grpc.CallOption) (*GetOrCreatePaymentConfigResponse, error) + RefreshDefaultPaymentMethod(ctx context.Context, in *RefreshDefaultPaymentMethodArgs, opts ...grpc.CallOption) (*emptypb.Empty, error) } type kurtosisCloudBackendServerClient struct { @@ -102,6 +104,15 @@ func (c *kurtosisCloudBackendServerClient) GetOrCreatePaymentConfig(ctx context. return out, nil } +func (c *kurtosisCloudBackendServerClient) RefreshDefaultPaymentMethod(ctx context.Context, in *RefreshDefaultPaymentMethodArgs, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, KurtosisCloudBackendServer_RefreshDefaultPaymentMethod_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // KurtosisCloudBackendServerServer is the server API for KurtosisCloudBackendServer service. // All implementations should embed UnimplementedKurtosisCloudBackendServerServer // for forward compatibility @@ -112,6 +123,7 @@ type KurtosisCloudBackendServerServer interface { GetOrCreateApiKey(context.Context, *GetOrCreateApiKeyRequest) (*GetOrCreateApiKeyResponse, error) GetOrCreateInstance(context.Context, *GetOrCreateInstanceRequest) (*GetOrCreateInstanceResponse, error) GetOrCreatePaymentConfig(context.Context, *GetOrCreatePaymentConfigArgs) (*GetOrCreatePaymentConfigResponse, error) + RefreshDefaultPaymentMethod(context.Context, *RefreshDefaultPaymentMethodArgs) (*emptypb.Empty, error) } // UnimplementedKurtosisCloudBackendServerServer should be embedded to have forward compatible implementations. @@ -136,6 +148,9 @@ func (UnimplementedKurtosisCloudBackendServerServer) GetOrCreateInstance(context func (UnimplementedKurtosisCloudBackendServerServer) GetOrCreatePaymentConfig(context.Context, *GetOrCreatePaymentConfigArgs) (*GetOrCreatePaymentConfigResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetOrCreatePaymentConfig not implemented") } +func (UnimplementedKurtosisCloudBackendServerServer) RefreshDefaultPaymentMethod(context.Context, *RefreshDefaultPaymentMethodArgs) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method RefreshDefaultPaymentMethod not implemented") +} // UnsafeKurtosisCloudBackendServerServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to KurtosisCloudBackendServerServer will @@ -256,6 +271,24 @@ func _KurtosisCloudBackendServer_GetOrCreatePaymentConfig_Handler(srv interface{ return interceptor(ctx, in, info, handler) } +func _KurtosisCloudBackendServer_RefreshDefaultPaymentMethod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RefreshDefaultPaymentMethodArgs) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KurtosisCloudBackendServerServer).RefreshDefaultPaymentMethod(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KurtosisCloudBackendServer_RefreshDefaultPaymentMethod_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KurtosisCloudBackendServerServer).RefreshDefaultPaymentMethod(ctx, req.(*RefreshDefaultPaymentMethodArgs)) + } + return interceptor(ctx, in, info, handler) +} + // KurtosisCloudBackendServer_ServiceDesc is the grpc.ServiceDesc for KurtosisCloudBackendServer service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -287,6 +320,10 @@ var KurtosisCloudBackendServer_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetOrCreatePaymentConfig", Handler: _KurtosisCloudBackendServer_GetOrCreatePaymentConfig_Handler, }, + { + MethodName: "RefreshDefaultPaymentMethod", + Handler: _KurtosisCloudBackendServer_RefreshDefaultPaymentMethod_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "kurtosis_backend_server_api.proto", diff --git a/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_rpc_api_bindingsconnect/kurtosis_backend_server_api.connect.go b/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_rpc_api_bindingsconnect/kurtosis_backend_server_api.connect.go index da1addc1b7..b5effcbb47 100644 --- a/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_rpc_api_bindingsconnect/kurtosis_backend_server_api.connect.go +++ b/cloud/api/golang/kurtosis_backend_server_rpc_api_bindings/kurtosis_backend_server_rpc_api_bindingsconnect/kurtosis_backend_server_api.connect.go @@ -53,6 +53,9 @@ const ( // KurtosisCloudBackendServerGetOrCreatePaymentConfigProcedure is the fully-qualified name of the // KurtosisCloudBackendServer's GetOrCreatePaymentConfig RPC. KurtosisCloudBackendServerGetOrCreatePaymentConfigProcedure = "/kurtosis_cloud.KurtosisCloudBackendServer/GetOrCreatePaymentConfig" + // KurtosisCloudBackendServerRefreshDefaultPaymentMethodProcedure is the fully-qualified name of the + // KurtosisCloudBackendServer's RefreshDefaultPaymentMethod RPC. + KurtosisCloudBackendServerRefreshDefaultPaymentMethodProcedure = "/kurtosis_cloud.KurtosisCloudBackendServer/RefreshDefaultPaymentMethod" ) // KurtosisCloudBackendServerClient is a client for the kurtosis_cloud.KurtosisCloudBackendServer @@ -64,6 +67,7 @@ type KurtosisCloudBackendServerClient interface { GetOrCreateApiKey(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.GetOrCreateApiKeyRequest]) (*connect.Response[kurtosis_backend_server_rpc_api_bindings.GetOrCreateApiKeyResponse], error) GetOrCreateInstance(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.GetOrCreateInstanceRequest]) (*connect.Response[kurtosis_backend_server_rpc_api_bindings.GetOrCreateInstanceResponse], error) GetOrCreatePaymentConfig(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigArgs]) (*connect.Response[kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigResponse], error) + RefreshDefaultPaymentMethod(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.RefreshDefaultPaymentMethodArgs]) (*connect.Response[emptypb.Empty], error) } // NewKurtosisCloudBackendServerClient constructs a client for the @@ -106,17 +110,23 @@ func NewKurtosisCloudBackendServerClient(httpClient connect.HTTPClient, baseURL baseURL+KurtosisCloudBackendServerGetOrCreatePaymentConfigProcedure, opts..., ), + refreshDefaultPaymentMethod: connect.NewClient[kurtosis_backend_server_rpc_api_bindings.RefreshDefaultPaymentMethodArgs, emptypb.Empty]( + httpClient, + baseURL+KurtosisCloudBackendServerRefreshDefaultPaymentMethodProcedure, + opts..., + ), } } // kurtosisCloudBackendServerClient implements KurtosisCloudBackendServerClient. type kurtosisCloudBackendServerClient struct { - isAvailable *connect.Client[emptypb.Empty, emptypb.Empty] - createCloudInstance *connect.Client[kurtosis_backend_server_rpc_api_bindings.CreateCloudInstanceConfigArgs, kurtosis_backend_server_rpc_api_bindings.CreateCloudInstanceConfigResponse] - getCloudInstanceConfig *connect.Client[kurtosis_backend_server_rpc_api_bindings.GetCloudInstanceConfigArgs, kurtosis_backend_server_rpc_api_bindings.GetCloudInstanceConfigResponse] - getOrCreateApiKey *connect.Client[kurtosis_backend_server_rpc_api_bindings.GetOrCreateApiKeyRequest, kurtosis_backend_server_rpc_api_bindings.GetOrCreateApiKeyResponse] - getOrCreateInstance *connect.Client[kurtosis_backend_server_rpc_api_bindings.GetOrCreateInstanceRequest, kurtosis_backend_server_rpc_api_bindings.GetOrCreateInstanceResponse] - getOrCreatePaymentConfig *connect.Client[kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigArgs, kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigResponse] + isAvailable *connect.Client[emptypb.Empty, emptypb.Empty] + createCloudInstance *connect.Client[kurtosis_backend_server_rpc_api_bindings.CreateCloudInstanceConfigArgs, kurtosis_backend_server_rpc_api_bindings.CreateCloudInstanceConfigResponse] + getCloudInstanceConfig *connect.Client[kurtosis_backend_server_rpc_api_bindings.GetCloudInstanceConfigArgs, kurtosis_backend_server_rpc_api_bindings.GetCloudInstanceConfigResponse] + getOrCreateApiKey *connect.Client[kurtosis_backend_server_rpc_api_bindings.GetOrCreateApiKeyRequest, kurtosis_backend_server_rpc_api_bindings.GetOrCreateApiKeyResponse] + getOrCreateInstance *connect.Client[kurtosis_backend_server_rpc_api_bindings.GetOrCreateInstanceRequest, kurtosis_backend_server_rpc_api_bindings.GetOrCreateInstanceResponse] + getOrCreatePaymentConfig *connect.Client[kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigArgs, kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigResponse] + refreshDefaultPaymentMethod *connect.Client[kurtosis_backend_server_rpc_api_bindings.RefreshDefaultPaymentMethodArgs, emptypb.Empty] } // IsAvailable calls kurtosis_cloud.KurtosisCloudBackendServer.IsAvailable. @@ -150,6 +160,12 @@ func (c *kurtosisCloudBackendServerClient) GetOrCreatePaymentConfig(ctx context. return c.getOrCreatePaymentConfig.CallUnary(ctx, req) } +// RefreshDefaultPaymentMethod calls +// kurtosis_cloud.KurtosisCloudBackendServer.RefreshDefaultPaymentMethod. +func (c *kurtosisCloudBackendServerClient) RefreshDefaultPaymentMethod(ctx context.Context, req *connect.Request[kurtosis_backend_server_rpc_api_bindings.RefreshDefaultPaymentMethodArgs]) (*connect.Response[emptypb.Empty], error) { + return c.refreshDefaultPaymentMethod.CallUnary(ctx, req) +} + // KurtosisCloudBackendServerHandler is an implementation of the // kurtosis_cloud.KurtosisCloudBackendServer service. type KurtosisCloudBackendServerHandler interface { @@ -159,6 +175,7 @@ type KurtosisCloudBackendServerHandler interface { GetOrCreateApiKey(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.GetOrCreateApiKeyRequest]) (*connect.Response[kurtosis_backend_server_rpc_api_bindings.GetOrCreateApiKeyResponse], error) GetOrCreateInstance(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.GetOrCreateInstanceRequest]) (*connect.Response[kurtosis_backend_server_rpc_api_bindings.GetOrCreateInstanceResponse], error) GetOrCreatePaymentConfig(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigArgs]) (*connect.Response[kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigResponse], error) + RefreshDefaultPaymentMethod(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.RefreshDefaultPaymentMethodArgs]) (*connect.Response[emptypb.Empty], error) } // NewKurtosisCloudBackendServerHandler builds an HTTP handler from the service implementation. It @@ -197,6 +214,11 @@ func NewKurtosisCloudBackendServerHandler(svc KurtosisCloudBackendServerHandler, svc.GetOrCreatePaymentConfig, opts..., ) + kurtosisCloudBackendServerRefreshDefaultPaymentMethodHandler := connect.NewUnaryHandler( + KurtosisCloudBackendServerRefreshDefaultPaymentMethodProcedure, + svc.RefreshDefaultPaymentMethod, + opts..., + ) return "/kurtosis_cloud.KurtosisCloudBackendServer/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case KurtosisCloudBackendServerIsAvailableProcedure: @@ -211,6 +233,8 @@ func NewKurtosisCloudBackendServerHandler(svc KurtosisCloudBackendServerHandler, kurtosisCloudBackendServerGetOrCreateInstanceHandler.ServeHTTP(w, r) case KurtosisCloudBackendServerGetOrCreatePaymentConfigProcedure: kurtosisCloudBackendServerGetOrCreatePaymentConfigHandler.ServeHTTP(w, r) + case KurtosisCloudBackendServerRefreshDefaultPaymentMethodProcedure: + kurtosisCloudBackendServerRefreshDefaultPaymentMethodHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } @@ -243,3 +267,7 @@ func (UnimplementedKurtosisCloudBackendServerHandler) GetOrCreateInstance(contex func (UnimplementedKurtosisCloudBackendServerHandler) GetOrCreatePaymentConfig(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigArgs]) (*connect.Response[kurtosis_backend_server_rpc_api_bindings.GetOrCreatePaymentConfigResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("kurtosis_cloud.KurtosisCloudBackendServer.GetOrCreatePaymentConfig is not implemented")) } + +func (UnimplementedKurtosisCloudBackendServerHandler) RefreshDefaultPaymentMethod(context.Context, *connect.Request[kurtosis_backend_server_rpc_api_bindings.RefreshDefaultPaymentMethodArgs]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("kurtosis_cloud.KurtosisCloudBackendServer.RefreshDefaultPaymentMethod is not implemented")) +} diff --git a/cloud/api/protobuf/kurtosis_backend_server_api.proto b/cloud/api/protobuf/kurtosis_backend_server_api.proto index 40efdd2c95..d3c1855283 100644 --- a/cloud/api/protobuf/kurtosis_backend_server_api.proto +++ b/cloud/api/protobuf/kurtosis_backend_server_api.proto @@ -13,6 +13,7 @@ service KurtosisCloudBackendServer { rpc GetOrCreateApiKey(GetOrCreateApiKeyRequest) returns (GetOrCreateApiKeyResponse) {}; rpc GetOrCreateInstance(GetOrCreateInstanceRequest) returns (GetOrCreateInstanceResponse) {}; rpc GetOrCreatePaymentConfig(GetOrCreatePaymentConfigArgs) returns (GetOrCreatePaymentConfigResponse) {}; + rpc RefreshDefaultPaymentMethod (RefreshDefaultPaymentMethodArgs) returns (google.protobuf.Empty) {}; } message GetOrCreateApiKeyRequest { @@ -85,6 +86,11 @@ message GetOrCreatePaymentConfigResponse { PaymentMethod payment_method = 3; } +message RefreshDefaultPaymentMethodArgs { + string access_token = 1; + string payment_method_id = 2; +} + message AwsKey { string id = 1; string secret = 2; From 0b36208fd69f3e69618600b0a8b23d1a7aa66ca8 Mon Sep 17 00:00:00 2001 From: Derek <103802618+leeederek@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:49:08 -0400 Subject: [PATCH 7/7] docs: update read_file docs & clarify package restrictions (#1540) ## Description: This pull request clarifies 2 things in the docs: - the returned type from `read_file` function in the Starlark reference - clarifies that resources being used in a Starlark script must themselves be a part of a Kurtosis package (i.e. a starlark script can only read or upload or import resources/starlark scripts/files that are part of other packages) ## Is this change user facing? YES ## References (if applicable): Fixes #1483 --- docs/docs/concepts-reference/locators.md | 12 ++++++------ docs/docs/starlark-reference/plan.md | 2 +- docs/docs/starlark-reference/read-file.md | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/docs/concepts-reference/locators.md b/docs/docs/concepts-reference/locators.md index f7aa3f0ad2..01705f2534 100644 --- a/docs/docs/concepts-reference/locators.md +++ b/docs/docs/concepts-reference/locators.md @@ -36,9 +36,8 @@ github.com/kurtosis-tech/kurtosis/starlark/test.star Only locators pointing to public GitHub repositories are currently allowed. ::: -### Package Restriction -Any Starlark script that wishes to use external resources must be -a part of a [Kurtosis package][packages]. +### Important Package Restriction +If your Starlark script relies on local resources, such as files or packages available on your filesystem, then those resources *must* be part of a [Kurtosis package][packages]. For example, suppose we had a [Kurtosis package][packages] like so: @@ -60,16 +59,17 @@ with a `kurtosis.yml` file like so: name: github.com/package-author/package-repo/my-package ``` -The `main.star` file would import the `random-script.star` from the `helpers` subdirectory of `my-package` like so: +In your `main.star` file, you would be able to import the `random-script.star` from the `helpers` subdirectory of `my-package` like so: ```python +# Valid helpers = import_module("github.com/package-author/package-repo/my-package/helpers/random-script.star") ``` -The import statement below will not succeed, because `main.star` cannot import from non-packages. -(see [how import works][how-do-kurtosis-imports-work-explanation] for more information) +However, if you try to import `package-repo/not-a-package/random-script.star`, then it will not work because `package-repo/not-a-package/random-script.star` is not part of a package. In essence, the import statement below will not succeed, because `main.star` cannot import from non-packages (see [how import works][how-do-kurtosis-imports-work-explanation] for more information): ```python +# Invalid helpers = import_module("github.com/package-author/package-repo/not-a-package/random-script.star") ``` diff --git a/docs/docs/starlark-reference/plan.md b/docs/docs/starlark-reference/plan.md index 514c9b253b..cf3deae6e8 100644 --- a/docs/docs/starlark-reference/plan.md +++ b/docs/docs/starlark-reference/plan.md @@ -602,7 +602,7 @@ The return value is a [future reference][future-references-reference] to the nam upload_files ------------ -`upload_files` instruction packages the files specified by the [locator][locators-reference] into a [files artifact][files-artifacts-reference] that gets stored inside the enclave. This is particularly useful when a static file needs to be loaded to a service container. +The `upload_files` instruction packages the files specified by the [locator][locators-reference] into a [files artifact][files-artifacts-reference] that gets stored inside the enclave. This is particularly useful when a static file needs to be loaded to a service container. ```python artifact_name = plan.upload_files( diff --git a/docs/docs/starlark-reference/read-file.md b/docs/docs/starlark-reference/read-file.md index fd880895fd..9999439c09 100644 --- a/docs/docs/starlark-reference/read-file.md +++ b/docs/docs/starlark-reference/read-file.md @@ -3,7 +3,7 @@ title: read_file sidebar_label: read_file --- -The `read_file` function reads the contents of a file specified by the given [locator][locators-reference], and requires that the Starlark script is part of a [package][packages-reference]. `read_file` executes [at interpretation time][multi-phase-runs-reference] so the file contents won't be displayed in the preview. +The `read_file` function reads the contents of a file specified by the given [locator][locators-reference] and executes [at interpretation time][multi-phase-runs-reference]. This instruction returns the content of the file in a string type. Please note that the files being read from must themselves be part of a Kurtosis package, as explained [here](../concepts-reference/locators.md#important-package-restriction). ```python read_file(