Skip to content

Commit

Permalink
Merge branch 'main' into edgar/image-download-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
lostbean authored Oct 27, 2023
2 parents 82e18e0 + 53efca3 commit 70d5ce7
Show file tree
Hide file tree
Showing 86 changed files with 3,448 additions and 1,126 deletions.
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ parameters:
starlark-test-args-file-test-args-json-relative-path:
type: string
default: "internal_testsuites/starlark/ci_tests/simple_arg_test/args.json"
starlark-test-args-file-url:
type: string
default: "https://raw.githubusercontent.com/kurtosis-tech/sample-startosis-load/main/args.json"
rendertemplate-cli-test-template-relative-path:
type: string
default: "internal_testsuites/resources/render_template_cli_test/template.txt"
Expand Down Expand Up @@ -323,6 +326,7 @@ jobs:
- "<< pipeline.parameters.file-artifacts-expander-image-filename >>"
- "<< pipeline.parameters.starlark-test-args-file-test-main-star-relative-path >>"
- "<< pipeline.parameters.starlark-test-args-file-test-args-json-relative-path >>"
- "<< pipeline.parameters.starlark-test-args-file-url >>"

build_core_launcher:
docker:
Expand Down Expand Up @@ -768,6 +772,9 @@ jobs:
# Execute Simple Starlark Script to test --args-file
- run: "${KURTOSIS_BINPATH} run --enclave args-file-test << pipeline.parameters.workspace-with-cli-binary-and-images-mountpoint >>/<< pipeline.parameters.starlark-test-args-file-test-main-star-relative-path >> --args-file << pipeline.parameters.workspace-with-cli-binary-and-images-mountpoint >>/<< pipeline.parameters.starlark-test-args-file-test-args-json-relative-path >>"

# Execute Simple Starlark Script to test --args-file from URL
- run: "${KURTOSIS_BINPATH} run --enclave args-file-from-url-test << pipeline.parameters.workspace-with-cli-binary-and-images-mountpoint >>/<< pipeline.parameters.starlark-test-args-file-test-main-star-relative-path >> --args-file << pipeline.parameters.starlark-test-args-file-url >>"

# Execute github starlark module
- run: "${KURTOSIS_BINPATH} run --enclave test-datastore github.com/kurtosis-tech/datastore-army-package '{\"num_datastores\": 2}'"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.RELEASER_TOKEN}
GITHUB_TOKEN: ${{ secrets.RELEASER_TOKEN }}
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## [0.84.13](https://github.com/kurtosis-tech/kurtosis/compare/0.84.12...0.84.13) (2023-10-25)


### Features

* user-configurable labels (in ServiceConfig type) for Docker containers and k8s pods ([#1604](https://github.com/kurtosis-tech/kurtosis/issues/1604)) ([e98cdf6](https://github.com/kurtosis-tech/kurtosis/commit/e98cdf6874b610f158a0ff798a01cf9a1b70d183))


### Bug Fixes

* name temporary python script for run_python with suitable name ([#1616](https://github.com/kurtosis-tech/kurtosis/issues/1616)) ([88edb39](https://github.com/kurtosis-tech/kurtosis/commit/88edb39c8f424d5f6b2126739948206ce5829e98))

## [0.84.12](https://github.com/kurtosis-tech/kurtosis/compare/0.84.11...0.84.12) (2023-10-25)


### Features

* kurtosis run command now accepts URLs with the 'args-file' argument ([#1607](https://github.com/kurtosis-tech/kurtosis/issues/1607)) ([ec32d0f](https://github.com/kurtosis-tech/kurtosis/commit/ec32d0f48f0a1cd76e26e4fdeecc75e7c1a31929)), closes [#1596](https://github.com/kurtosis-tech/kurtosis/issues/1596)
* Product and subscription added to the get payment config response ([#1606](https://github.com/kurtosis-tech/kurtosis/issues/1606)) ([0d10726](https://github.com/kurtosis-tech/kurtosis/commit/0d107261422ad918b4a5dbc5dbbb35c8d555d4c5))


### Bug Fixes

* add a debug line for the exact command run by lint ([#1615](https://github.com/kurtosis-tech/kurtosis/issues/1615)) ([3fa6d2f](https://github.com/kurtosis-tech/kurtosis/commit/3fa6d2f62b301f97e7ae7ef50b9abe460e7cc283))
* handle error and fix rendering bug ([#1617](https://github.com/kurtosis-tech/kurtosis/issues/1617)) ([825fd22](https://github.com/kurtosis-tech/kurtosis/commit/825fd2238601f7a95c97f3a695773d3a9c234c49))

## [0.84.11](https://github.com/kurtosis-tech/kurtosis/compare/0.84.10...0.84.11) (2023-10-24)


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.11
Licensed Work: Kurtosis 0.84.13
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-24
Change Date: 2027-10-25

Change License: AGPLv3 (GNU Affero General Public License Version 3)

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.11"
KurtosisVersion = "0.84.13"
// !!!!!!!!!!! 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.11"
version = "0.84.13"
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.11",
"version": "0.84.13",
"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
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.11"
export const KURTOSIS_VERSION: string = "0.84.13"
// !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!!
52 changes: 45 additions & 7 deletions cli/cli/commands/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"os/signal"
"path"
Expand Down Expand Up @@ -308,15 +311,10 @@ func run(

if packageArgs == inputArgsAreEmptyBracesByDefault && packageArgsFile != packageArgsFileDefaultValue {
logrus.Debugf("'%v' is empty but '%v' is provided so we will go with the '%v' value", inputArgsArgKey, packageArgsFileFlagKey, packageArgsFileFlagKey)
packageArgsFileBytes, err := os.ReadFile(packageArgsFile)
packageArgs, err = getArgsFromFilepathOrURL(packageArgsFile)
if err != nil {
return stacktrace.Propagate(err, "attempted to read file provided by flag '%v' with path '%v' but failed", packageArgsFileFlagKey, packageArgsFile)
return stacktrace.Propagate(err, "An error occurred while getting the package args from filepath or URL '%s'", packageArgsFile)
}
packageArgsFileStr := string(packageArgsFileBytes)
if packageArgParsingErr := validateSerializedArgs(packageArgsFileStr); packageArgParsingErr != nil {
return stacktrace.Propagate(err, "attempted to validate '%v' but failed", packageArgsFileFlagKey)
}
packageArgs = packageArgsFileStr
} else if packageArgs != inputArgsAreEmptyBracesByDefault && packageArgsFile != packageArgsFileDefaultValue {
logrus.Debugf("'%v' arg is not empty; ignoring value of '%v' flag as '%v' arg takes precedence", inputArgsArgKey, packageArgsFileFlagKey, inputArgsArgKey)
}
Expand Down Expand Up @@ -705,3 +703,43 @@ func validateSerializedArgs(serializedArgs string) error {
fmt.Errorf("JSON parsing error '%v', YAML parsing error '%v'", jsonError, yamlError),
"Error validating args, because it is not a valid JSON or YAML.")
}

func getArgsFromFilepathOrURL(packageArgsFile string) (string, error) {
var packageArgsFileBytes []byte
isFileURL := true
_, err := os.Stat(packageArgsFile)
if err == nil {
isFileURL = false
packageArgsFileBytes, err = os.ReadFile(packageArgsFile)
if err != nil {
return "", stacktrace.Propagate(err, "attempted to read file provided by flag '%v' with path '%v' but failed", packageArgsFileFlagKey, packageArgsFile)
}
}
if err != nil && !os.IsNotExist(err) {
return "", stacktrace.Propagate(err, "An error occurred checking for argument's file existence on '%s'", packageArgsFile)
}

if isFileURL {
argsFileURL, parseErr := url.Parse(packageArgsFile)
if parseErr != nil {
return "", stacktrace.Propagate(parseErr, "An error occurred while parsing file args URL '%s'", argsFileURL)
}
response, getErr := http.Get(argsFileURL.String())
if getErr != nil {
return "", stacktrace.Propagate(getErr, "An error occurred getting the args file content from URL '%s'", argsFileURL.String())
}
defer response.Body.Close()
responseBodyBytes, readAllErr := io.ReadAll(response.Body)
if readAllErr != nil {
return "", stacktrace.Propagate(readAllErr, "An error occurred reading the args file content")
}
packageArgsFileBytes = responseBodyBytes
}

packageArgsFileStr := string(packageArgsFileBytes)
if packageArgParsingErr := validateSerializedArgs(packageArgsFileStr); packageArgParsingErr != nil {
return "", stacktrace.Propagate(err, "attempted to validate '%v' but failed", packageArgsFileFlagKey)
}

return packageArgsFileStr, nil
}
18 changes: 9 additions & 9 deletions cli/cli/kurtosis_gateway/connection/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package connection

import (
"context"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/kubernetes_label_key"
"net/url"

"github.com/kurtosis-tech/kurtosis/api/golang/engine/kurtosis_engine_rpc_api_bindings"
"github.com/kurtosis-tech/kurtosis/api/golang/engine/lib/kurtosis_context"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/kubernetes/kubernetes_manager"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/label_key_consts"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/kubernetes/object_attributes_provider/label_value_consts"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/engine"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/port_spec"
Expand Down Expand Up @@ -111,9 +111,9 @@ func (provider *GatewayConnectionProvider) ForUserServiceIfRunning(enclaveId str

func (provider *GatewayConnectionProvider) getEnginePodPortforwardEndpoint(engineGuid engine.EngineGUID) (*url.URL, error) {
engineLabels := map[string]string{
label_key_consts.IDKubernetesLabelKey.GetString(): string(engineGuid),
label_key_consts.KurtosisResourceTypeKubernetesLabelKey.GetString(): label_value_consts.EngineKurtosisResourceTypeKubernetesLabelValue.GetString(),
label_key_consts.AppIDKubernetesLabelKey.GetString(): label_value_consts.AppIDKubernetesLabelValue.GetString(),
kubernetes_label_key.IDKubernetesLabelKey.GetString(): string(engineGuid),
kubernetes_label_key.KurtosisResourceTypeKubernetesLabelKey.GetString(): label_value_consts.EngineKurtosisResourceTypeKubernetesLabelValue.GetString(),
kubernetes_label_key.AppIDKubernetesLabelKey.GetString(): label_value_consts.AppIDKubernetesLabelValue.GetString(),
}
// Call k8s to find our engine namespace
engineNamespaceList, err := provider.kubernetesManager.GetNamespacesByLabels(provider.providerContext, engineLabels)
Expand Down Expand Up @@ -146,8 +146,8 @@ func (provider *GatewayConnectionProvider) getApiContainerPodPortforwardEndpoint

// Get running API Container pods from Kubernetes
apiContainerPodLabels := map[string]string{
label_key_consts.KurtosisResourceTypeKubernetesLabelKey.GetString(): label_value_consts.APIContainerKurtosisResourceTypeKubernetesLabelValue.GetString(),
label_key_consts.AppIDKubernetesLabelKey.GetString(): label_value_consts.AppIDKubernetesLabelValue.GetString(),
kubernetes_label_key.KurtosisResourceTypeKubernetesLabelKey.GetString(): label_value_consts.APIContainerKurtosisResourceTypeKubernetesLabelValue.GetString(),
kubernetes_label_key.AppIDKubernetesLabelKey.GetString(): label_value_consts.AppIDKubernetesLabelValue.GetString(),
}
runningApiContainerPodNames, err := provider.getRunningPodNamesByLabels(enclaveNamespaceName, apiContainerPodLabels)
if err != nil {
Expand Down Expand Up @@ -191,9 +191,9 @@ func (provider *GatewayConnectionProvider) getEnclaveNamespaceNameForEnclaveId(e
}

enclaveLabels := map[string]string{
label_key_consts.EnclaveUUIDKubernetesLabelKey.GetString(): enclaveId,
label_key_consts.KurtosisResourceTypeKubernetesLabelKey.GetString(): label_value_consts.EnclaveKurtosisResourceTypeKubernetesLabelValue.GetString(),
label_key_consts.AppIDKubernetesLabelKey.GetString(): label_value_consts.AppIDKubernetesLabelValue.GetString(),
kubernetes_label_key.EnclaveUUIDKubernetesLabelKey.GetString(): enclaveId,
kubernetes_label_key.KurtosisResourceTypeKubernetesLabelKey.GetString(): label_value_consts.EnclaveKurtosisResourceTypeKubernetesLabelValue.GetString(),
kubernetes_label_key.AppIDKubernetesLabelKey.GetString(): label_value_consts.AppIDKubernetesLabelValue.GetString(),
}
enclaveNamespaceList, err := provider.kubernetesManager.GetNamespacesByLabels(provider.providerContext, enclaveLabels)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/logs_collector_functions"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_manager"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/label_key_consts"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/docker_label_key"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/label_value_consts"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/metrics_reporting"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface"
Expand Down Expand Up @@ -211,8 +211,8 @@ func getDockerKurtosisBackend(
enclaveUuid := optionalApiContainerModeArgs.EnclaveID

enclaveNetworkSearchLabels := map[string]string{
label_key_consts.AppIDDockerLabelKey.GetString(): label_value_consts.AppIDDockerLabelValue.GetString(),
label_key_consts.IDDockerLabelKey.GetString(): string(enclaveUuid),
docker_label_key.AppIDDockerLabelKey.GetString(): label_value_consts.AppIDDockerLabelValue.GetString(),
docker_label_key.IDDockerLabelKey.GetString(): string(enclaveUuid),
}
matchingNetworks, err := dockerManager.GetNetworksByLabels(ctx, enclaveNetworkSearchLabels)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_manager/types"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_network_allocator"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/label_key_consts"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/docker_label_key"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/object_attributes_provider/label_value_consts"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/compute_resources"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/container"
Expand Down Expand Up @@ -486,8 +486,8 @@ func (backend *DockerKurtosisBackend) GetAvailableCPUAndMemory(ctx context.Conte
// ====================================================================================================
func (backend *DockerKurtosisBackend) getEnclaveNetworkByEnclaveUuid(ctx context.Context, enclaveUuid enclave.EnclaveUUID) (*types.Network, error) {
networkSearchLabels := map[string]string{
label_key_consts.AppIDDockerLabelKey.GetString(): label_value_consts.AppIDDockerLabelValue.GetString(),
label_key_consts.EnclaveUUIDDockerLabelKey.GetString(): string(enclaveUuid),
docker_label_key.AppIDDockerLabelKey.GetString(): label_value_consts.AppIDDockerLabelValue.GetString(),
docker_label_key.EnclaveUUIDDockerLabelKey.GetString(): string(enclaveUuid),
}

enclaveNetworksFound, err := backend.dockerManager.GetNetworksByLabels(ctx, networkSearchLabels)
Expand All @@ -511,9 +511,9 @@ func (backend *DockerKurtosisBackend) getEnclaveNetworkByEnclaveUuid(ctx context
// Guaranteed to either return an enclave data volume name or throw an error
func (backend *DockerKurtosisBackend) getEnclaveDataVolumeByEnclaveUuid(ctx context.Context, enclaveUuid enclave.EnclaveUUID) (string, error) {
volumeSearchLabels := map[string]string{
label_key_consts.AppIDDockerLabelKey.GetString(): label_value_consts.AppIDDockerLabelValue.GetString(),
label_key_consts.EnclaveUUIDDockerLabelKey.GetString(): string(enclaveUuid),
label_key_consts.VolumeTypeDockerLabelKey.GetString(): label_value_consts.EnclaveDataVolumeTypeDockerLabelValue.GetString(),
docker_label_key.AppIDDockerLabelKey.GetString(): label_value_consts.AppIDDockerLabelValue.GetString(),
docker_label_key.EnclaveUUIDDockerLabelKey.GetString(): string(enclaveUuid),
docker_label_key.VolumeTypeDockerLabelKey.GetString(): label_value_consts.EnclaveDataVolumeTypeDockerLabelValue.GetString(),
}
foundVolumes, err := backend.dockerManager.GetVolumesByLabels(ctx, volumeSearchLabels)
if err != nil {
Expand Down
Loading

0 comments on commit 70d5ce7

Please sign in to comment.