Skip to content

Commit

Permalink
Merge branch 'main' into lporoli/em-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
leoporoli authored Nov 16, 2023
2 parents 438cce0 + 7c34582 commit f07238a
Show file tree
Hide file tree
Showing 30 changed files with 316 additions and 155 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ parameters:
file-artifacts-expander-image-filename:
type: string
default: "file-artifacts-expander-image.tgz"
enclave-manager-yarn-cache-key-prefix:
type: string
default: "enclave-manager_yarn"
engine-server-image-filename:
type: string
default: "engine-server-image.tgz"
Expand Down Expand Up @@ -394,6 +397,33 @@ jobs:
paths:
- "<< pipeline.parameters.core-server-image-filename >>"

build_enclave_manager_webapp:
executor: ubuntu_vm
steps:
- checkout

- <<: *abort_job_if_only_docs_changes

# Cache our dependencies
- restore_cache:
keys:
- << pipeline.parameters.enclave-manager-yarn-cache-key-prefix>>-{{ checksum "enclave-manager/api/typescript/yarn.lock" }}-{{ checksum "enclave-manager/web/yarn.lock" }}

- run: npm install -g yarn

- run: |
enclave-manager/scripts/build.sh
- save_cache:
key: << pipeline.parameters.enclave-manager-yarn-cache-key-prefix>>-{{ checksum "enclave-manager/api/typescript/yarn.lock" }}-{{ checksum "enclave-manager/web/yarn.lock" }}
paths:
- "/home/circleci/.cache/yarn"

- persist_to_workspace:
root: engine/server
paths:
- webapp

build_engine_launcher:
docker:
- image: "cimg/go:<< pipeline.parameters.go-version >>"
Expand All @@ -416,6 +446,11 @@ jobs:

- <<: *abort_job_if_only_docs_changes

- attach_workspace:
at: "<< pipeline.parameters.workspace-with-cli-binary-and-images-mountpoint >>"

- run: cp -R << pipeline.parameters.workspace-with-cli-binary-and-images-mountpoint >>/webapp engine/server/webapp

# Generate Kurtosis Version
- run: "<<pipeline.parameters.generate-kurtosis-version-script-path>>"

Expand Down Expand Up @@ -1068,6 +1103,10 @@ jobs:
version="$(cat version.txt)"
"<<pipeline.parameters.generate-kurtosis-version-script-path>>" $version
- attach_workspace:
at: "<< pipeline.parameters.workspace-with-cli-binary-and-images-mountpoint >>"

- run: cp -R << pipeline.parameters.workspace-with-cli-binary-and-images-mountpoint >>/webapp engine/server/webapp

- setup_remote_docker:
version: "<< pipeline.parameters.docker-engine-version>>"
Expand Down Expand Up @@ -1235,6 +1274,11 @@ workflows:
ignore:
- main

- build_enclave_manager_webapp:
filters:
branches:
ignore:
- main
- build_engine_launcher:
filters:
branches:
Expand All @@ -1243,6 +1287,8 @@ workflows:
- build_engine_server:
context:
- docker-user
requires:
- build_enclave_manager_webapp
filters:
branches:
ignore:
Expand Down Expand Up @@ -1387,6 +1433,8 @@ workflows:
context:
- docker-user
- slack-secrets
requires:
- build_enclave_manager_webapp
filters:
branches:
ignore: /.*/
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## [0.85.25](https://github.com/kurtosis-tech/kurtosis/compare/0.85.24...0.85.25) (2023-11-16)


### Bug Fixes

* display create enclave error in scrollable box ([#1802](https://github.com/kurtosis-tech/kurtosis/issues/1802)) ([21adc5d](https://github.com/kurtosis-tech/kurtosis/commit/21adc5d70575b0d59980367146a528d1cfe137dc))

## [0.85.24](https://github.com/kurtosis-tech/kurtosis/compare/0.85.23...0.85.24) (2023-11-16)


### Features

* generate enclave manager ui in build process and check prettier ([#1717](https://github.com/kurtosis-tech/kurtosis/issues/1717)) ([d6be248](https://github.com/kurtosis-tech/kurtosis/commit/d6be2482cc1af81830e909b8fdbaca104a7b73c3))

## [0.85.23](https://github.com/kurtosis-tech/kurtosis/compare/0.85.22...0.85.23) (2023-11-15)


### Bug Fixes

* args were positioned incorrectly ([#1799](https://github.com/kurtosis-tech/kurtosis/issues/1799)) ([18c8b53](https://github.com/kurtosis-tech/kurtosis/commit/18c8b53e3a4d1a58be57105f5a3dfbc28c86c2b3))

## [0.85.22](https://github.com/kurtosis-tech/kurtosis/compare/0.85.21...0.85.22) (2023-11-15)


### Features

* configured CORS logs in the enclave manager server inside the Kurtosis engine ([#1797](https://github.com/kurtosis-tech/kurtosis/issues/1797)) ([1eaf469](https://github.com/kurtosis-tech/kurtosis/commit/1eaf469ba0d8d1a742c8bdf544c42e4ff1b17b67))

## [0.85.21](https://github.com/kurtosis-tech/kurtosis/compare/0.85.20...0.85.21) (2023-11-14)


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.85.21
Licensed Work: Kurtosis 0.85.25
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-11-14
Change Date: 2027-11-16

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.85.21"
KurtosisVersion = "0.85.25"
// !!!!!!!!!!! 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.85.21"
version = "0.85.25"
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.85.21",
"version": "0.85.25",
"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.85.21"
export const KURTOSIS_VERSION: string = "0.85.25"
// !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!!
140 changes: 140 additions & 0 deletions docs/docs/api-reference/starlark-reference/docstring-syntax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
title: Docstring Syntax
sidebar_label: Docstring Syntax
---

If you add a docstring in a specific format to the `run` function inside your package's `main.star` file, you will be able to run your package in [Kurtosis Cloud](https://cloud.kurtosis.com) using a user-friendly form interface.

For example, this is the form produced by Kurtosis for running the Postgres package:

<img src="../../../static/img/api-reference/starlark-reference/postgres-package-configuration-form.png" />

which Kurtosis autogenerates based on [the docstring comment on the package's `main.star` function](https://github.com/kurtosis-tech/postgres-package/blob/main/main.star#L27):

~~~python
def run(
plan,
image="postgres:alpine",
service_name="postgres",
user="postgres",
password="MyPassword1!",
database="postgres",
config_file_artifact_name="",
seed_file_artifact_name="",
extra_configs=[],
persistent=True,
launch_adminer=False,
):
"""Launches a Postgresql database instance, optionally seeding it with a SQL file script
Args:
image (string): The container image that the Postgres service will be started with
service_name (string): The name to give the Postgres service
user (string): The user to create the Postgres database with
password (string): The password to give to the created user
database (string): The name of the database to create
config_file_artifact_name (string): The name of a files artifact that contains a Postgres config file in it
If not empty, this will be used to configure the Postgres server
seed_file_artifact_name (string): The name of a files artifact containing seed data
If not empty, the Postgres server will be populated with the data upon start
extra_configs (list[string]): Each argument gets passed as a '-c' argument to the Postgres server
persistent (bool): Whether the data should be persisted. Defaults to True; Note that this isn't supported on multi node k8s cluster as of 2023-10-16
launch_adminer (bool): Whether to launch adminer which launches a website to inspect postgres database entries. Defaults to False.
Returns:
An object containing useful information about the Postgres database running inside the enclave:
```
{
"database": "postgres",
"password": "MyPassword1!",
"port": {
"application_protocol": "postgresql",
"number": 5432,
"transport_protocol": "TCP",
"wait": "2m0s"
},
"service": {
"hostname": "postgres",
"ip_address": "172.16.0.4",
"name": "postgres",
"ports": {
"postgresql": {
"application_protocol": "postgresql",
"number": 5432,
"transport_protocol": "TCP",
"wait": "2m0s"
}
}
},
"url": "postgresql://postgres:MyPassword1!@postgres/postgres",
"user": "postgres"
}
```
"""
~~~

The syntax for this docstring is [the Google function docstring syntax](https://google.github.io/styleguide/pyguide.html#383-functions-and-methods), with optional PEP-484 type annotations in parentheses:

```python
def run(plan, required_arg, optional_arg=True, untyped_arg=None):
"""
This is the `run` function description. It can even spill
over into multiple lines.
Args:
required_arg (string): This is the first argument description. It is required, and is of string type.
Note that argument descriptions can spill into the second line, so long as they're indented.
optional_arg (bool): This is the second argument description. It is optional, and it is a boolean-type argument.
untyped_arg: This argument doesn't have a PEP-484 type annotation.
""""
```

Several things to note about this docstring syntax:

- Every function MUST have a description before the `Args` block (until [this issue](https://github.com/kurtosis-tech/kurtosis-package-indexer/issues/58) is resolved)
- The description after the `:` (including continuation lines) is rendered in the form using Markdown. For example, entering the following:
```
some_arg (string): Some description about this argument.
See [this link](https://some-location.com) for more information.
```
would render a link in the description of the argument in the generated form.
- The names of the arguments in the docstring must exactly correspond to the names of the function arguments
- The `plan` argument does not need to be documented; it corresponds to the [`Plan` object](./plan.md) and Kurtosis will inject it automatically
- If an argument has no default value, it will be marked as required in the Kurtosis-generated form
- If an argument has a default value, it will be marked as optional in the Kurtosis-generated form
- The type of an argument (specified within `()`) is optional
### Types
The values available for use within the `()` to document the type of a function argument are as follows:
Primitives:
- `string`
- `int`
- `bool`
Complex types:
- `list[X]` where `X` is a primitive type
- `dict[X, X]` where `X` is a primitive type
If a type argument is not specified, Kurtosis will instead generate a JSON field for inputting arbitrary values into the field. The JSON value that the user enters will be transliterated to a Starlark `dict` object.
For example, if the user enters the following JSON in the form field of an argument without a type specified:
```json
{
"some_key": {
"inner_key": "Inner key value"
},
"some_bool": true
}
```

then the equivalent Starlark that will be passed in for the function parameter will be:

```python
{
"some_key": {
"inner_key": "Inner key value",
},
"some_bool": True,
}
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions enclave-manager/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# 2021-07-08 WATERMARK, DO NOT REMOVE - This script was generated from the Kurtosis Bash script template

set -euo pipefail # Bash "strict mode"
script_dirpath="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
root_dirpath="$(dirname "${script_dirpath}")"



# ==================================================================================================
# Constants
# ==================================================================================================
BUILD_SCRIPT_RELATIVE_FILEPATHS=(
"api/scripts/build.sh"
"web/scripts/build.sh"
)


# ==================================================================================================
# Main Logic
# ==================================================================================================
for build_script_rel_filepath in "${BUILD_SCRIPT_RELATIVE_FILEPATHS[@]}"; do
build_script_abs_filepath="${root_dirpath}/${build_script_rel_filepath}"
if ! bash "${build_script_abs_filepath}"; then
echo "Error: Build script '${build_script_abs_filepath}' failed" >&2
exit 1
fi
done
12 changes: 12 additions & 0 deletions enclave-manager/web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn prettier`

Runs `prettier --check` to check that the code matches the formatting that [`prettier`](https://prettier.io/) would apply.

### `yarn prettier:fix`

Applies any formatting changes prettier wants to apply to this application. For ease of use you can use IDE integrations
to auto apply prettier changes on file save, see instructions:

- [Here](https://plugins.jetbrains.com/plugin/10456-prettier) for Intellij
- [Here](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for vscode

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
Expand Down
2 changes: 1 addition & 1 deletion enclave-manager/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
},
"scripts": {
"analyze": "source-map-explorer 'build/static/js/*.js'",
"prebuild": "rm -rf ../../engine/server/webapp",
"clean": "rm -rf build",
"cleanInstall": "rm -rf node_modules; yarn install",
"start": "react-scripts start",
"start:prod": "serve -s build",
"prebuild": "rm -rf ../../engine/server/webapp",
"build": "react-scripts build",
"postbuild": "cp -r build/ ../../engine/server/webapp",
"prettier": "prettier . --check",
Expand Down
1 change: 1 addition & 0 deletions enclave-manager/web/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ lang_root_dirpath="$(dirname "${script_dirpath}")"
# ==================================================================================================
cd "${lang_root_dirpath}"
yarn install --frozen-lockfile
yarn prettier
# There are no unit tests currently
# CGO_ENABLED=0 yarn test
yarn clean
Expand Down
Loading

0 comments on commit f07238a

Please sign in to comment.