diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/exec/exec.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/exec/exec.go index 4959d1162e..14f9ef0821 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/exec/exec.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/exec/exec.go @@ -215,7 +215,7 @@ func (builtin *ExecCapabilities) FillPersistableAttributes(builder *enclave_plan } func (builtin *ExecCapabilities) UpdatePlan(planYaml *plan_yaml.PlanYaml) error { - err := planYaml.AddExec(string(builtin.serviceName), builtin.returnValue, builtin.cmdList, builtin.acceptableCodes) + err := planYaml.AddExec(string(builtin.serviceName), builtin.description, builtin.returnValue, builtin.cmdList, builtin.acceptableCodes) if err != nil { return stacktrace.Propagate(err, "An error occurred updating plan with exec.") } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_python.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_python.go index 82ca291240..229b95c4d3 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_python.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_python.go @@ -367,7 +367,7 @@ func (builtin *RunPythonCapabilities) FillPersistableAttributes(builder *enclave } func (builtin *RunPythonCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { - err := plan.AddRunPython(builtin.run, builtin.returnValue, builtin.serviceConfig, builtin.storeSpecList, builtin.pythonArguments, builtin.packages) + err := plan.AddRunPython(builtin.run, builtin.description, builtin.returnValue, builtin.serviceConfig, builtin.storeSpecList, builtin.pythonArguments, builtin.packages) if err != nil { return stacktrace.Propagate(err, "An error occurred updating plan with run python") } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_sh.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_sh.go index aa77080905..3fd2fa9e96 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_sh.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/tasks/run_sh.go @@ -322,7 +322,7 @@ func (builtin *RunShCapabilities) FillPersistableAttributes(builder *enclave_pla } func (builtin *RunShCapabilities) UpdatePlan(plan *plan_yaml.PlanYaml) error { - err := plan.AddRunSh(builtin.run, builtin.returnValue, builtin.serviceConfig, builtin.storeSpecList) + err := plan.AddRunSh(builtin.run, builtin.description, builtin.returnValue, builtin.serviceConfig, builtin.storeSpecList) if err != nil { return stacktrace.Propagate(err, "An error occurred adding run sh task to the plan") } diff --git a/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml.go b/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml.go index 2ea9bcfd03..3677b2004c 100644 --- a/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml.go +++ b/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml.go @@ -88,16 +88,16 @@ type FileMount struct { // Task represents a task to be executed. type Task struct { - Uuid string `yaml:"uuid,omitempty"` // done - Name string `yaml:"name,omitempty"` // done - TaskType TaskType `yaml:"taskType,omitempty"` // done - RunCmd []string `yaml:"command,omitempty"` // done - Image string `yaml:"image,omitempty"` // done + Uuid string `yaml:"uuid,omitempty"` + Name string `yaml:"name,omitempty"` + TaskType TaskType `yaml:"taskType,omitempty"` + RunCmd []string `yaml:"command,omitempty"` + Image string `yaml:"image,omitempty"` Files []*FileMount `yaml:"files,omitempty"` Store []*FilesArtifact `yaml:"store,omitempty"` // only exists on shell tasks - EnvVars []*EnvironmentVariable `yaml:"envVar,omitempty"` // done + EnvVars []*EnvironmentVariable `yaml:"envVar,omitempty"` // only exists on python tasks PythonPackages []string `yaml:"pythonPackages,omitempty"` diff --git a/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml_generator.go b/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml_generator.go index 01b544dec5..36fa1ea211 100644 --- a/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml_generator.go +++ b/core/server/api_container/server/startosis_engine/plan_yaml/plan_yaml_generator.go @@ -133,6 +133,7 @@ func (planYaml *PlanYaml) AddService( func (planYaml *PlanYaml) AddRunSh( runCommand string, + description string, returnValue *starlarkstruct.Struct, serviceConfig *service.ServiceConfig, storeSpecList []*store_spec2.StoreSpec, @@ -161,6 +162,7 @@ func (planYaml *PlanYaml) AddRunSh( // create task yaml object taskYaml := &Task{} //nolint exhaustruct + taskYaml.Name = description taskYaml.Uuid = uuid taskYaml.TaskType = shell @@ -179,7 +181,7 @@ func (planYaml *PlanYaml) AddRunSh( taskYaml.Files = planYaml.getFileMountsFromFilesArtifacts(serviceConfig.GetFilesArtifactsExpansion()) // for store - // - all files artifacts product from store are new files artifact that are added to the plan + // - all files artifacts produced from store are new files artifact that are added to the plan // - add them to files artifacts list // - add them to the store section of run sh var store []*FilesArtifact @@ -205,6 +207,7 @@ func (planYaml *PlanYaml) AddRunSh( func (planYaml *PlanYaml) AddRunPython( runCommand string, + description string, returnValue *starlarkstruct.Struct, serviceConfig *service.ServiceConfig, storeSpecList []*store_spec2.StoreSpec, @@ -234,6 +237,7 @@ func (planYaml *PlanYaml) AddRunPython( // create task yaml object taskYaml := &Task{} //nolint exhaustruct + taskYaml.Name = description taskYaml.Uuid = uuid taskYaml.TaskType = python @@ -282,6 +286,7 @@ func (planYaml *PlanYaml) AddRunPython( func (planYaml *PlanYaml) AddExec( serviceName string, + description string, returnValue *starlark.Dict, cmdList []string, acceptableCodes []int64) error { @@ -315,6 +320,7 @@ func (planYaml *PlanYaml) AddExec( // create task yaml taskYaml := &Task{} //nolint exhaustruct + taskYaml.Name = description taskYaml.Uuid = uuid taskYaml.TaskType = exec taskYaml.ServiceName = serviceName diff --git a/core/server/api_container/server/startosis_engine/startosis_interpreter_plan_yaml_test.go b/core/server/api_container/server/startosis_engine/startosis_interpreter_plan_yaml_test.go index 0efb441b75..73838db876 100644 --- a/core/server/api_container/server/startosis_engine/startosis_interpreter_plan_yaml_test.go +++ b/core/server/api_container/server/startosis_engine/startosis_interpreter_plan_yaml_test.go @@ -163,7 +163,8 @@ func (suite *StartosisIntepreterPlanYamlTestSuite) TestRunShWithFilesArtifacts() }, store=[ StoreSpec(src="/bye.txt", name="bye-file") - ] + ], + description = "Store bye", ) ` inputArgs := `{"hi_files_artifact": "hi-file"}` @@ -195,6 +196,7 @@ filesArtifacts: - /bye.txt tasks: - uuid: "1" + name: Store bye taskType: sh command: - echo bye > /bye.txt @@ -235,6 +237,7 @@ func (suite *StartosisIntepreterPlanYamlTestSuite) TestRunPython() { store = [ StoreSpec(src = "bye.txt", name = "bye-file"), ], + description = "Request docs" ) ` inputArgs := `{"hi_files_artifact": "hi-file"}` @@ -266,6 +269,7 @@ filesArtifacts: - bye.txt tasks: - uuid: "1" + name: Request docs taskType: python command: - "\n import requests\n response = requests.get(\"docs.kurtosis.com\")\n print(response.status_code) @@ -301,12 +305,13 @@ func (suite *StartosisIntepreterPlanYamlTestSuite) TestExec() { files = { "/root": hi_files_artifact, } - ) + ), ) result = plan.exec( service_name="db", recipe=ExecRecipe(command=["echo", "Hello, world"]), acceptable_codes=[0], + description = "Say Hello" ) ` inputArgs := `{"hi_files_artifact": "hi-file"}` @@ -349,6 +354,7 @@ filesArtifacts: name: hi-file tasks: - uuid: "3" + name: Say Hello taskType: exec command: - echo @@ -381,6 +387,7 @@ func (suite *StartosisIntepreterPlanYamlTestSuite) TestRenderTemplate() { files = { "/root": bye_files_artifact, }, + description = "Say bye", ) ` inputArgs := `{"hi_files_artifact": "hi-file"}` @@ -411,6 +418,7 @@ filesArtifacts: - fairwell.txt tasks: - uuid: "2" + name: Say bye taskType: sh command: - cat /root/bye.txt @@ -563,6 +571,7 @@ func (suite *StartosisIntepreterPlanYamlTestSuite) TestUploadFiles() { files = { "/root": dockerfile_artifact, }, + description = "Say dockerfile contents" ) ` _, instructionsPlan, interpretationError := suite.interpreter.Interpret( @@ -591,6 +600,7 @@ filesArtifacts: - ./server/Dockerfile tasks: - uuid: "2" + name: Say dockerfile contents taskType: sh command: - cat /root/Dockerfile @@ -732,12 +742,15 @@ func (suite *StartosisIntepreterPlanYamlTestSuite) TestFutureReferencesAreSwappe command=["echo", service.ip_address + " " + service.hostname] ), acceptable_codes=[0], + description = "Get db ip" ) runShResult = plan.run_sh( run="echo " + execResult["code"] + " " + execResult["output"], + description = "Say db ip" ) plan.run_sh( run="echo " + runShResult.code + " " + runShResult.output, + description = "Say db ip again" ) ` inputArgs := `{"hi_files_artifact": "hi-file"}` @@ -780,6 +793,7 @@ filesArtifacts: name: hi-file tasks: - uuid: "3" + name: Get db ip taskType: exec command: - echo @@ -788,11 +802,13 @@ tasks: acceptableCodes: - 0 - uuid: "4" + name: Say db ip taskType: sh command: - echo {{ kurtosis.3.code }} {{ kurtosis.3.output }} image: badouralix/curl-jq - uuid: "5" + name: Say db ip again taskType: sh command: - echo {{ kurtosis.4.code }} {{ kurtosis.4.output }} diff --git a/enclave-manager/web/packages/app/src/emui/enclaves/components/enclaveBuilder/nodes/KurtosisPackageNode.tsx b/enclave-manager/web/packages/app/src/emui/enclaves/components/enclaveBuilder/nodes/KurtosisPackageNode.tsx index 0e6d39ca74..ba2991e7ce 100644 --- a/enclave-manager/web/packages/app/src/emui/enclaves/components/enclaveBuilder/nodes/KurtosisPackageNode.tsx +++ b/enclave-manager/web/packages/app/src/emui/enclaves/components/enclaveBuilder/nodes/KurtosisPackageNode.tsx @@ -184,7 +184,7 @@ export const KurtosisPackageNode = memo( const serviceVariable = `{{service.${serviceNamesToId[task.serviceName]}.name}}`; updateData(`${id}:${task.uuid}`, { type: "exec", - name: "", + name: task.name, isValid: true, isFromPackage: true, service: serviceVariable, @@ -195,7 +195,7 @@ export const KurtosisPackageNode = memo( if (task.taskType === "python") { updateData(`${id}:${task.uuid}`, { type: "python", - name: `Python ${task.uuid}`, + name: task.name, isValid: true, isFromPackage: true, command: (task.command || []).join(" "), @@ -231,7 +231,7 @@ export const KurtosisPackageNode = memo( if (task.taskType === "sh") { updateData(`${id}:${task.uuid}`, { type: "shell", - name: `Shell ${task.uuid}`, + name: task.name, isValid: true, isFromPackage: true, command: (task.command || []).join(" "), diff --git a/enclave-manager/web/packages/app/src/emui/enclaves/components/enclaveBuilder/types.ts b/enclave-manager/web/packages/app/src/emui/enclaves/components/enclaveBuilder/types.ts index 7af5302381..a680f745fd 100644 --- a/enclave-manager/web/packages/app/src/emui/enclaves/components/enclaveBuilder/types.ts +++ b/enclave-manager/web/packages/app/src/emui/enclaves/components/enclaveBuilder/types.ts @@ -153,6 +153,7 @@ export type PlanService = { type PlanExecTask = { taskType: "exec"; uuid: string; + name: string; command: string[]; serviceName: string; acceptableCodes?: number[]; @@ -161,6 +162,7 @@ type PlanExecTask = { type PlanPythonTask = { taskType: "python"; uuid: string; + name: string; command?: string[]; image: string; files?: PlanFile[]; @@ -171,6 +173,7 @@ type PlanPythonTask = { type PlanShTask = { taskType: "sh"; uuid: string; + name: string; command?: string[]; image: string; files?: PlanFile[];