temporalio / cli

Command-line interface for running Temporal Server and interacting with Workflows, Activities, Namespaces, and other parts of Temporal
https://docs.temporal.io/cli
MIT License
247 stars 34 forks source link

[Bug] Schedule update unexpected behavior #481

Closed sytranvn closed 6 months ago

sytranvn commented 6 months ago

What are you really trying to do?

When I update schedule cron value without specifying input, the old workflow input is removed.

Describe the bug

Minimal Reproduction

temporal schedule create        --schedule-id MyScheduleId \
       --cron '3 11 * * Fri' \
       --workflow-id MyWorkflowId \
       --task-queue MyTaskQueue \
       --workflow-type MyWorkflowType \
       --input '{"Input": "As-JSON"}'

temporal schedule trigger        --schedule-id MyScheduleId

Triggered workflow has input {"Input": "As-JSON"} Terminate the workflow.

temporal schedule update --schedule-id MyScheduleId --cron '3 12 * * Fri' --workflow-id MyWorkflowId  --task-queue MyTaskQueue --workflow-type MyWorkflowType 

Schedule is updated to new cron value, but when trigger, new workflow doesn't have input.

Environment/Versions

Additional context

dnr commented 6 months ago

You need to pass --input to update also. An update replaces the entire schedule configuration, including any input. The various SDKs provide a nicer wrapper around update that lets you change only the fields you want.

sytranvn commented 6 months ago

You need to pass --input to update also.

Getting existing input of a schedule using cli is also a complex task.

The various SDKs provide a nicer wrapper around update that lets you change only the fields you want.

The solution you give me is ok. And I should not use CLI in this case. But the point is inconsistent behavior between UI/SDK and CLI. Some one might use cli to quickly update cron only then realize they messed up.