Skip to content

Commit

Permalink
Merge branch 'main' into tedi/uistatus
Browse files Browse the repository at this point in the history
  • Loading branch information
tedim52 authored Oct 18, 2023
2 parents a90d7ee + 0b36208 commit 3dd2bf6
Show file tree
Hide file tree
Showing 35 changed files with 888 additions and 233 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<video width="630" height="300" src="https://github.com/kurtosis-tech/kurtosis/assets/11703004/f908aa4a-b340-44c8-b948-46993dcdb96e"></video>

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._
Expand Down
4 changes: 4 additions & 0 deletions api/golang/core/lib/enclaves/kurtosis_yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = ""
Expand Down Expand Up @@ -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...)
}

Expand All @@ -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 != "" {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package git_package_content_provider
package shared_utils

import (
"fmt"
Expand All @@ -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(
Expand All @@ -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"
Expand All @@ -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)
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion api/golang/engine/lib/kurtosis_context/kurtosis_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion api/golang/kurtosis_version/kurtosis_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 !!!!!!!!!!!!!!!!!!!!!!
)
2 changes: 1 addition & 1 deletion api/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion api/typescript/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
));
Expand Down
2 changes: 1 addition & 1 deletion api/typescript/src/kurtosis_version/kurtosis_version.ts
Original file line number Diff line number Diff line change
@@ -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 !!!!!!!!!!!!!!!!!!!!!!
Loading

0 comments on commit 3dd2bf6

Please sign in to comment.