Skip to content

Commit dbf9958

Browse files
authored
Workflow: no longer require DB connection string (#1570)
* Workflow: no longer require DB connection string PR updates the workflow clients to use the Dapr RPCs to list Workflow instance IDs instead of connecting directly to the database. This removes the requirement that the Dapr CLI need both connectivity to the database and a connection string, greatly improving the user experience. `$ dapr workflow list` now works out-of-the-box without any additional configuration. Connection strings are still supported via the `--connection-string` flag for users using Dapr pre v1.17. Also exposes the `--force` flag on `$ dapr workflow purge` to allow purging without a worker connected. Signed-off-by: joshvanl <me@joshvanl.dev> * Cleanup workflow history output Signed-off-by: joshvanl <me@joshvanl.dev> * Improve parent details Signed-off-by: joshvanl <me@joshvanl.dev> * result -> output Signed-off-by: joshvanl <me@joshvanl.dev> * Adds input/output to child workflow history Signed-off-by: joshvanl <me@joshvanl.dev> * Adds eventId to SubOrchestrationCompleted details ouput Signed-off-by: joshvanl <me@joshvanl.dev> --------- Signed-off-by: joshvanl <me@joshvanl.dev>
1 parent 807ca78 commit dbf9958

26 files changed

Lines changed: 628 additions & 479 deletions

File tree

.github/workflows/kind_e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
name: E2E tests for K8s (KinD)
5151
runs-on: ubuntu-latest
5252
env:
53-
DAPR_RUNTIME_PINNED_VERSION: 1.16.1
53+
DAPR_RUNTIME_PINNED_VERSION: 1.17.0-rc.1
5454
DAPR_DASHBOARD_PINNED_VERSION: 0.15.0
5555
DAPR_RUNTIME_LATEST_STABLE_VERSION:
5656
DAPR_DASHBOARD_LATEST_STABLE_VERSION:

.github/workflows/self_hosted_e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
GOARCH: ${{ matrix.target_arch }}
3939
GOPROXY: https://proxy.golang.org
4040
ARCHIVE_OUTDIR: dist/archives
41-
DAPR_RUNTIME_PINNED_VERSION: "1.16.1"
41+
DAPR_RUNTIME_PINNED_VERSION: "1.17.0-rc.1"
4242
DAPR_DASHBOARD_PINNED_VERSION: 0.15.0
4343
DAPR_RUNTIME_LATEST_STABLE_VERSION: ""
4444
DAPR_DASHBOARD_LATEST_STABLE_VERSION: ""

cmd/workflow/purge.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ var (
2525
flagPurgeOlderThan string
2626
flagPurgeAll bool
2727
flagPurgeConn *connFlag
28+
flagPurgeForce bool
2829
schedulerNamespace string
2930
)
3031

3132
var PurgeCmd = &cobra.Command{
3233
Use: "purge",
33-
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.",
34+
Short: "Purge workflow instances with a terminal state.",
35+
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.",
3436
Args: func(cmd *cobra.Command, args []string) error {
3537
switch {
3638
case cmd.Flags().Changed("all-older-than"),
@@ -63,6 +65,7 @@ var PurgeCmd = &cobra.Command{
6365
All: flagPurgeAll,
6466
ConnectionString: flagPurgeConn.connectionString,
6567
TableName: flagPurgeConn.tableName,
68+
Force: flagPurgeForce,
6669
}
6770

6871
if cmd.Flags().Changed("all-older-than") {
@@ -80,6 +83,7 @@ func init() {
8083
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'.")
8184
PurgeCmd.Flags().BoolVar(&flagPurgeAll, "all", false, "Purge all workflow instances in a terminal state. Use with caution.")
8285
PurgeCmd.MarkFlagsMutuallyExclusive("all-older-than", "all")
86+
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.")
8387

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

cmd/workflow/raiseevent.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ var (
3030

3131
var RaiseEventCmd = &cobra.Command{
3232
Use: "raise-event",
33-
Short: "Raise an event for a workflow waiting for an external event. Expects a single argument '<instance-id>/<event-name>'.",
33+
Short: "Raise an event for a workflow waiting for an external event.",
34+
Long: "Raise an event for a workflow waiting for an external event. Expects a single argument '<instance-id>/<event-name>'.",
3435
Args: cobra.ExactArgs(1),
3536
RunE: func(cmd *cobra.Command, args []string) error {
3637
ctx := signals.Context()

cmd/workflow/rerun.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ var (
3232

3333
var ReRunCmd = &cobra.Command{
3434
Use: "rerun [instance ID]",
35-
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.",
35+
Short: "Re-run a workflow instance.",
36+
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.",
3637
Args: cobra.ExactArgs(1),
3738
RunE: func(cmd *cobra.Command, args []string) error {
3839
ctx := signals.Context()

cmd/workflow/run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ var (
3131

3232
var RunCmd = &cobra.Command{
3333
Use: "run",
34-
Short: "Run a workflow instance based on a given workflow name. Accepts a single argument, the workflow name.",
34+
Short: "Run a workflow instance.",
35+
Long: "Run a workflow instance based on a given workflow name. Accepts a single argument, the workflow name.",
3536
Args: cobra.ExactArgs(1),
3637
RunE: func(cmd *cobra.Command, args []string) error {
3738
ctx := signals.Context()

cmd/workflow/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func connectionCmd(cmd *cobra.Command) *connFlag {
205205
flagTableName string
206206
)
207207

208-
cmd.Flags().StringVarP(&flagConnectionString, "connection-string", "c", "", "The connection string used to connect and authenticate to the actor state store")
208+
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")
209209
cmd.Flags().StringVarP(&flagTableName, "table-name", "t", "", "The name of the table or collection which is used as the actor state store")
210210

211211
var cflag connFlag

go.mod

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
module github.com/dapr/cli
22

3-
go 1.24.7
3+
go 1.24.11
44

55
require (
66
github.com/Masterminds/semver v1.5.0
77
github.com/Masterminds/semver/v3 v3.3.0
88
github.com/Pallinder/sillyname-go v0.0.0-20130730142914-97aeae9e6ba1
99
github.com/briandowns/spinner v1.19.0
10-
github.com/dapr/dapr v1.16.0
11-
github.com/dapr/durabletask-go v0.10.0
10+
github.com/dapr/dapr v1.16.1-rc.3.0.20260109125959-3e6d229306c2
11+
github.com/dapr/durabletask-go v0.10.2-0.20260109105925-0094a750e8b7
1212
github.com/dapr/go-sdk v1.13.0
13-
github.com/dapr/kit v0.16.1
14-
github.com/diagridio/go-etcd-cron v0.9.1
13+
github.com/dapr/kit v0.16.2-0.20251124175541-3ac186dff64d
14+
github.com/diagridio/go-etcd-cron v0.10.1-0.20260105221246-ee8c118dd834
1515
github.com/docker/docker v25.0.6+incompatible
1616
github.com/evanphx/json-patch/v5 v5.9.0
1717
github.com/fatih/color v1.17.0
18+
github.com/go-sql-driver/mysql v1.8.1
1819
github.com/gocarina/gocsv v0.0.0-20220927221512-ad3251f9fa25
1920
github.com/hashicorp/go-retryablehttp v0.7.7
2021
github.com/hashicorp/go-version v1.6.0
@@ -36,16 +37,17 @@ require (
3637
github.com/stretchr/testify v1.10.0
3738
go.etcd.io/etcd/client/v3 v3.5.21
3839
go.mongodb.org/mongo-driver v1.14.0
39-
golang.org/x/mod v0.25.0
40-
golang.org/x/sys v0.33.0
41-
google.golang.org/protobuf v1.36.6
40+
golang.org/x/mod v0.29.0
41+
golang.org/x/sys v0.38.0
42+
google.golang.org/grpc v1.73.0
43+
google.golang.org/protobuf v1.36.9
4244
gopkg.in/yaml.v2 v2.4.0
4345
helm.sh/helm/v3 v3.17.1
44-
k8s.io/api v0.32.1
46+
k8s.io/api v0.32.3
4547
k8s.io/apiextensions-apiserver v0.32.1
4648
k8s.io/apimachinery v0.33.0
4749
k8s.io/cli-runtime v0.32.1
48-
k8s.io/client-go v0.32.1
50+
k8s.io/client-go v0.32.3
4951
k8s.io/helm v2.16.10+incompatible
5052
sigs.k8s.io/yaml v1.4.0
5153
)
@@ -54,6 +56,7 @@ require (
5456
cel.dev/expr v0.23.0 // indirect
5557
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
5658
dario.cat/mergo v1.0.1 // indirect
59+
filippo.io/edwards25519 v1.1.0 // indirect
5760
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
5861
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
5962
github.com/BurntSushi/toml v1.4.0 // indirect
@@ -76,7 +79,7 @@ require (
7679
github.com/cespare/xxhash/v2 v2.3.0 // indirect
7780
github.com/chai2010/gettext-go v1.0.2 // indirect
7881
github.com/chebyrash/promise v0.0.0-20230709133807-42ec49ba1459 // indirect
79-
github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.14.0 // indirect
82+
github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.15.2 // indirect
8083
github.com/cloudevents/sdk-go/v2 v2.15.2 // indirect
8184
github.com/containerd/containerd v1.7.24 // indirect
8285
github.com/containerd/errdefs v0.3.0 // indirect
@@ -85,7 +88,7 @@ require (
8588
github.com/coreos/go-semver v0.3.1 // indirect
8689
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
8790
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
88-
github.com/dapr/components-contrib v1.16.0 // indirect
91+
github.com/dapr/components-contrib v1.16.2-0.20260105164851-3e22d45d5cae // indirect
8992
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
9093
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
9194
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
@@ -240,17 +243,16 @@ require (
240243
go.opentelemetry.io/proto/otlp v1.6.0 // indirect
241244
go.uber.org/multierr v1.11.0 // indirect
242245
go.uber.org/zap v1.27.0 // indirect
243-
golang.org/x/crypto v0.39.0 // indirect
246+
golang.org/x/crypto v0.45.0 // indirect
244247
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
245-
golang.org/x/net v0.41.0 // indirect
248+
golang.org/x/net v0.47.0 // indirect
246249
golang.org/x/oauth2 v0.30.0 // indirect
247-
golang.org/x/sync v0.15.0 // indirect
248-
golang.org/x/term v0.32.0 // indirect
249-
golang.org/x/text v0.26.0 // indirect
250+
golang.org/x/sync v0.18.0 // indirect
251+
golang.org/x/term v0.37.0 // indirect
252+
golang.org/x/text v0.31.0 // indirect
250253
golang.org/x/time v0.11.0 // indirect
251254
google.golang.org/genproto/googleapis/api v0.0.0-20250512202823-5a2f75b736a9 // indirect
252255
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
253-
google.golang.org/grpc v1.73.0 // indirect
254256
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
255257
gopkg.in/inf.v0 v0.9.1 // indirect
256258
gopkg.in/ini.v1 v1.67.0 // indirect

0 commit comments

Comments
 (0)