Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmd/workflow/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ var (
flagPurgeOlderThan string
flagPurgeAll bool
flagPurgeConn *connFlag
flagPurgeForce bool
schedulerNamespace string
)

var PurgeCmd = &cobra.Command{
Use: "purge",
Short: "Purge one or more workflow instances with a terminal state. Accepts a workflow instance ID argument or flags to purge multiple/all terminal instances. Also deletes all associated scheduler jobs.",
Short: "Purge workflow instances with a terminal state.",
Long: "Purge one or more workflow instances with a terminal state. Accepts a workflow instance ID argument or flags to purge multiple/all terminal instances. Also deletes all associated scheduler jobs.",
Args: func(cmd *cobra.Command, args []string) error {
switch {
case cmd.Flags().Changed("all-older-than"),
Expand Down Expand Up @@ -63,6 +65,7 @@ var PurgeCmd = &cobra.Command{
All: flagPurgeAll,
ConnectionString: flagPurgeConn.connectionString,
TableName: flagPurgeConn.tableName,
Force: flagPurgeForce,
}

if cmd.Flags().Changed("all-older-than") {
Expand All @@ -80,6 +83,7 @@ func init() {
PurgeCmd.Flags().StringVar(&flagPurgeOlderThan, "all-older-than", "", "Purge workflow instances older than the specified Go duration or timestamp, e.g., '24h' or '2023-01-02T15:04:05Z'.")
PurgeCmd.Flags().BoolVar(&flagPurgeAll, "all", false, "Purge all workflow instances in a terminal state. Use with caution.")
PurgeCmd.MarkFlagsMutuallyExclusive("all-older-than", "all")
PurgeCmd.Flags().BoolVar(&flagPurgeForce, "force", false, "force will force a purge of a workflow, regardless of its current runtime state, or whether an active worker can process it, the backend will attempt to delete it anyway. This necessarily means the purging is executed out side of the workflow state machine, and therefore, can lead to corrupt state or broken workflow execution. Usage of this should _only_ be used when you know the workflow is not being currently processed. It is highly recommended to avoid using this flag unless absolutely necessary.")

PurgeCmd.Flags().StringVar(&schedulerNamespace, "scheduler-namespace", "dapr-system", "Kubernetes namespace where the scheduler is deployed, only relevant if --kubernetes is set")

Expand Down
3 changes: 2 additions & 1 deletion cmd/workflow/raiseevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ var (

var RaiseEventCmd = &cobra.Command{
Use: "raise-event",
Short: "Raise an event for a workflow waiting for an external event. Expects a single argument '<instance-id>/<event-name>'.",
Short: "Raise an event for a workflow waiting for an external event.",
Long: "Raise an event for a workflow waiting for an external event. Expects a single argument '<instance-id>/<event-name>'.",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
ctx := signals.Context()
Expand Down
3 changes: 2 additions & 1 deletion cmd/workflow/rerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ var (

var ReRunCmd = &cobra.Command{
Use: "rerun [instance ID]",
Short: "ReRun a workflow instance from the beginning or a specific event. Optionally, a new instance ID and input to the starting event can be provided.",
Short: "Re-run a workflow instance.",
Long: "ReRun a workflow instance from the beginning or a specific event. Optionally, a new instance ID and input to the starting event can be provided.",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
ctx := signals.Context()
Expand Down
3 changes: 2 additions & 1 deletion cmd/workflow/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ var (

var RunCmd = &cobra.Command{
Use: "run",
Short: "Run a workflow instance based on a given workflow name. Accepts a single argument, the workflow name.",
Short: "Run a workflow instance.",
Long: "Run a workflow instance based on a given workflow name. Accepts a single argument, the workflow name.",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
ctx := signals.Context()
Expand Down
2 changes: 1 addition & 1 deletion cmd/workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func connectionCmd(cmd *cobra.Command) *connFlag {
flagTableName string
)

cmd.Flags().StringVarP(&flagConnectionString, "connection-string", "c", "", "The connection string used to connect and authenticate to the actor state store")
cmd.Flags().StringVarP(&flagConnectionString, "connection-string", "c", "", "Only used for Dapr runtime versions 1.16. The connection string used to connect and authenticate to the actor state store")
cmd.Flags().StringVarP(&flagTableName, "table-name", "t", "", "The name of the table or collection which is used as the actor state store")

var cflag connFlag
Expand Down
18 changes: 11 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
module github.com/dapr/cli

go 1.24.7
go 1.24.9

toolchain go1.24.10

require (
github.com/Masterminds/semver v1.5.0
github.com/Masterminds/semver/v3 v3.3.0
github.com/Pallinder/sillyname-go v0.0.0-20130730142914-97aeae9e6ba1
github.com/briandowns/spinner v1.19.0
github.com/dapr/dapr v1.16.0
github.com/dapr/durabletask-go v0.10.0
github.com/dapr/dapr v1.16.1-rc.3.0.20251118161632-84fbd05c585c
github.com/dapr/durabletask-go v0.10.2-0.20251113171253-87ecdf8f0547
github.com/dapr/go-sdk v1.13.0
github.com/dapr/kit v0.16.1
github.com/diagridio/go-etcd-cron v0.9.1
github.com/dapr/kit v0.16.2-0.20251117143824-2fd5d0c93524
github.com/diagridio/go-etcd-cron v0.10.0
github.com/docker/docker v25.0.6+incompatible
github.com/evanphx/json-patch/v5 v5.9.0
github.com/fatih/color v1.17.0
github.com/go-sql-driver/mysql v1.8.1
github.com/gocarina/gocsv v0.0.0-20220927221512-ad3251f9fa25
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/hashicorp/go-version v1.6.0
Expand All @@ -38,6 +41,7 @@ require (
go.mongodb.org/mongo-driver v1.14.0
golang.org/x/mod v0.25.0
golang.org/x/sys v0.33.0
google.golang.org/grpc v1.73.0
google.golang.org/protobuf v1.36.6
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.17.1
Expand All @@ -54,6 +58,7 @@ require (
cel.dev/expr v0.23.0 // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
dario.cat/mergo v1.0.1 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
Expand Down Expand Up @@ -85,7 +90,7 @@ require (
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
github.com/dapr/components-contrib v1.16.0 // indirect
github.com/dapr/components-contrib v1.16.2-0.20251113171451-b78f056c8491 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
Expand Down Expand Up @@ -250,7 +255,6 @@ require (
golang.org/x/time v0.11.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250512202823-5a2f75b736a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
google.golang.org/grpc v1.73.0 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,16 @@ github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/cyphar/filepath-securejoin v0.3.6 h1:4d9N5ykBnSp5Xn2JkhocYDkOpURL/18CYMpo6xB9uWM=
github.com/cyphar/filepath-securejoin v0.3.6/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
github.com/dapr/components-contrib v1.16.0 h1:kUif6UyxtRz6tXnkuIjbx6z+VLMfc6y+SIYa9T7J3eA=
github.com/dapr/components-contrib v1.16.0/go.mod h1:1AufCWqZwBj//UkyS7FesOEmp5/E6Xgy1tyCn8peiR4=
github.com/dapr/dapr v1.16.0 h1:la2WLZM8Myr2Pq3cyrFjHKWDSPYLzGZCs3p502TwBjI=
github.com/dapr/dapr v1.16.0/go.mod h1:ln/mxvNOeqklaDmic4ppsxmnjl2D/oZGKaJy24IwaEY=
github.com/dapr/durabletask-go v0.10.0 h1:vfIivPl4JYd55xZTslDwhA6p6F8ipcNxBtMaupxArr8=
github.com/dapr/durabletask-go v0.10.0/go.mod h1:0Ts4rXp74JyG19gDWPcwNo5V6NBZzhARzHF5XynmA7Q=
github.com/dapr/components-contrib v1.16.2-0.20251113171451-b78f056c8491 h1:ms0IhiGK6Mow+e1DZgIxD3qo7xqOPjpxeFkhahBo+Tg=
github.com/dapr/components-contrib v1.16.2-0.20251113171451-b78f056c8491/go.mod h1:1AufCWqZwBj//UkyS7FesOEmp5/E6Xgy1tyCn8peiR4=
github.com/dapr/dapr v1.16.1-rc.3.0.20251118161632-84fbd05c585c h1:JIIlb/Qe01bv13lTGwBt9DMdY/hcguBYtQOo+1pquvk=
github.com/dapr/dapr v1.16.1-rc.3.0.20251118161632-84fbd05c585c/go.mod h1:xgEItLT6gtIv/OP8KVb31DhLIZddLZbp0LTAczR8buQ=
github.com/dapr/durabletask-go v0.10.2-0.20251113171253-87ecdf8f0547 h1:bD4JBlXDHURsgvhIB1HQ1q0k8kYfVo/iNSBi0guSoe0=
github.com/dapr/durabletask-go v0.10.2-0.20251113171253-87ecdf8f0547/go.mod h1:0Ts4rXp74JyG19gDWPcwNo5V6NBZzhARzHF5XynmA7Q=
github.com/dapr/go-sdk v1.13.0 h1:Qw2BmUonClQ9yK/rrEEaFL1PyDgq616RrvYj0CT67Lk=
github.com/dapr/go-sdk v1.13.0/go.mod h1:RsffVNZitDApmQqoS68tNKGMXDZUjTviAbKZupJSzts=
github.com/dapr/kit v0.16.1 h1:MqLAhHVg8trPy2WJChMZFU7ToeondvxcNHYVvMDiVf4=
github.com/dapr/kit v0.16.1/go.mod h1:40ZWs5P6xfYf7O59XgwqZkIyDldTIXlhTQhGop8QoSM=
github.com/dapr/kit v0.16.2-0.20251117143824-2fd5d0c93524 h1:SQ7VeWGnypENpGjsL94wN2IgH+oYHx9ULpYrpFoRExQ=
github.com/dapr/kit v0.16.2-0.20251117143824-2fd5d0c93524/go.mod h1:40ZWs5P6xfYf7O59XgwqZkIyDldTIXlhTQhGop8QoSM=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
Expand All @@ -187,8 +187,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etly
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/diagridio/go-etcd-cron v0.9.1 h1:KUfcceDtypL8s3hL0jD2ZoiIzjjXY6xDQ4kT1DJF4Ws=
github.com/diagridio/go-etcd-cron v0.9.1/go.mod h1:CSzuxoCDFu+Gbds0RO73GE8CnmL5t85axiPLptsej3I=
github.com/diagridio/go-etcd-cron v0.10.0 h1:PG1ptpdToeyBjhlINR1Ark5Ne3uAGnBRsGK8hRu+J70=
github.com/diagridio/go-etcd-cron v0.10.0/go.mod h1:CSzuxoCDFu+Gbds0RO73GE8CnmL5t85axiPLptsej3I=
github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2 h1:aBfCb7iqHmDEIp6fBvC/hQUddQfg+3qdYjwzaiP9Hnc=
github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2/go.mod h1:WHNsWjnIn2V1LYOrME7e8KxSeKunYHsxEm4am0BUtcI=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
Expand Down
5 changes: 3 additions & 2 deletions pkg/workflow/db/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"database/sql"
"fmt"

_ "github.com/go-sql-driver/mysql"
_ "github.com/jackc/pgx/v5/stdlib"
_ "github.com/mattn/go-sqlite3"
_ "github.com/microsoft/go-mssqldb"
Expand All @@ -35,8 +36,8 @@ func SQL(ctx context.Context, driver, connString string) (*sql.DB, error) {
return db, nil
}

func ListSQL(ctx context.Context, db *sql.DB, table string, opts ListOptions) ([]string, error) {
query := fmt.Sprintf(`SELECT key FROM "%s" WHERE key LIKE ?;`, table)
func ListSQL(ctx context.Context, db *sql.DB, table, key string, opts ListOptions) ([]string, error) {
query := fmt.Sprintf(`SELECT "%s" FROM "%s" WHERE key LIKE ?;`, key, table)
like := opts.AppID + "||dapr.internal." + opts.Namespace + "." + opts.AppID + ".workflow||%||metadata"

rows, err := db.QueryContext(ctx, query, like)
Expand Down
Loading
Loading