Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description: This change implements the generation of a yaml that represents the effect of a sequence of instructions on an enclave. The major changes are as follows: - Adds gRPC endpoints `GetStarlarkPackge/ScriptPlanYaml` to APIC and Enclave Manager for returning this yaml - Implements `PlanYaml` object and yaml generation logic in `startosis_engine` - Adds `UpdatePlan(plan *PlanYaml)` method to `KurtosisInstruction` interface so each instruction implements logic for updating the plan yaml - Most of the knowledge needed to generate the yaml comes from the interpretation phase and is simply passed into yaml generation logic Tests are in `startosis_interpreter_plan_yaml_tests.go` and demonstrate how the `InstructionsPlan` generates the yaml via the `PlanYaml` object. eg. starlark script turned plan yaml: ``` def run(plan, hi_files_artifact): service = plan.add_service( name="db", config=ServiceConfig( image="postgres:latest", env_vars={ "POSTGRES_DB": "kurtosis", "POSTGRES_USER": "kurtosis", "POSTGRES_PASSWORD": "kurtosis", }, files = { "/root": hi_files_artifact, } ) ) execResult = plan.exec( service_name="db", recipe=ExecRecipe( command=["echo", service.ip_address + " " + service.hostname] ), acceptable_codes=[0], ) runShResult = plan.run_sh( run="echo " + execResult["code"] + " " + execResult["output"], ) plan.run_sh( run="echo " + runShResult.code + " " + runShResult.output, ) ``` plan yaml: ``` packageId: DEFAULT_PACKAGE_ID_FOR_SCRIPT services: - uuid: "1" name: db image: name: postgres:latest envVars: - key: POSTGRES_DB value: kurtosis - key: POSTGRES_PASSWORD value: kurtosis - key: POSTGRES_USER value: kurtosis files: - mountPath: /root filesArtifacts: - uuid: "2" name: hi-file filesArtifacts: - uuid: "2" name: hi-file tasks: - uuid: "3" taskType: exec command: - echo - '{{ kurtosis.1.ip_address }} {{ kurtosis.1.hostname }}' serviceName: db acceptableCodes: - 0 - uuid: "4" taskType: sh command: - echo {{ kurtosis.3.code }} {{ kurtosis.3.output }} image: badouralix/curl-jq - uuid: "5" taskType: sh command: - echo {{ kurtosis.4.code }} {{ kurtosis.4.output }} image: badouralix/curl-jq ``` ## Is this change user facing? NO ## References: The Enclave Manager uses this plan yaml to render packages in the Enclave Builder: #2250 --------- Co-authored-by: Ben Gazzard <[email protected]>
- Loading branch information