Skip to content

Commit 228f406

Browse files
authored
[ACTP-1047] sync temporal bundle (#44669)
### What does this PR do? Add temporal actions to the agent par ### Motivation ### Describe how you validated your changes ### Additional Notes Agent PAR is not released yet Co-authored-by: gabriel.plassard <[email protected]>
1 parent 2829d38 commit 228f406

File tree

9 files changed

+418
-0
lines changed

9 files changed

+418
-0
lines changed

LICENSE-3rdparty.csv

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,7 @@ core,github.com/expr-lang/expr/patcher,MIT,Copyright (c) 2018 Anton Medvedev
916916
core,github.com/expr-lang/expr/types,MIT,Copyright (c) 2018 Anton Medvedev
917917
core,github.com/expr-lang/expr/vm,MIT,Copyright (c) 2018 Anton Medvedev
918918
core,github.com/expr-lang/expr/vm/runtime,MIT,Copyright (c) 2018 Anton Medvedev
919+
core,github.com/facebookgo/clock,MIT,Copyright (c) 2014 Ben Johnson
919920
core,github.com/facette/natsort,BSD-3-Clause,"Copyright (c) 2015, Vincent Batoufflet and Marc Falzon"
920921
core,github.com/fatih/color,MIT,Copyright (c) 2013 Fatih Arslan
921922
core,github.com/fatih/structtag,BSD-3-Clause,"Copyright (c) 2012 The Go Authors. All rights reserved | Copyright (c) 2017, Fatih Arslan"
@@ -1191,6 +1192,9 @@ core,github.com/grafana/regexp/syntax,BSD-3-Clause,Copyright (c) 2009 The Go Aut
11911192
core,github.com/grpc-ecosystem/go-grpc-middleware,Apache-2.0,Copyright (c) The go-grpc-middleware Authors.
11921193
core,github.com/grpc-ecosystem/go-grpc-middleware/auth,Apache-2.0,Copyright (c) The go-grpc-middleware Authors.
11931194
core,github.com/grpc-ecosystem/go-grpc-middleware/util/metautils,Apache-2.0,Copyright (c) The go-grpc-middleware Authors.
1195+
core,github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/retry,Apache-2.0,Copyright (c) The go-grpc-middleware Authors | Copyright (c) The go-grpc-middleware Authors.
1196+
core,github.com/grpc-ecosystem/go-grpc-middleware/v2/metadata,Apache-2.0,Copyright (c) The go-grpc-middleware Authors | Copyright (c) The go-grpc-middleware Authors.
1197+
core,github.com/grpc-ecosystem/go-grpc-middleware/v2/util/backoffutils,Apache-2.0,Copyright (c) The go-grpc-middleware Authors | Copyright (c) The go-grpc-middleware Authors.
11941198
core,github.com/grpc-ecosystem/go-grpc-prometheus,Apache-2.0,Copyright 2016 Michal Witkowski. All Rights Reserved.
11951199
core,github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule,BSD-3-Clause,"Copyright (c) 2015, Gengo, Inc | Copyright (c) 2015, Gengo, Inc."
11961200
core,github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options,BSD-3-Clause,"Copyright (c) 2015, Gengo, Inc | Copyright (c) 2015, Gengo, Inc."
@@ -1405,6 +1409,7 @@ core,github.com/netsampler/goflow2/pb,BSD-3-Clause,"Copyright (c) 2021, NetSampl
14051409
core,github.com/netsampler/goflow2/producer,BSD-3-Clause,"Copyright (c) 2021, NetSampler"
14061410
core,github.com/netsampler/goflow2/transport,BSD-3-Clause,"Copyright (c) 2021, NetSampler"
14071411
core,github.com/netsampler/goflow2/utils,BSD-3-Clause,"Copyright (c) 2021, NetSampler"
1412+
core,github.com/nexus-rpc/sdk-go/nexus,MIT,Copyright (c) 2023 Temporal Technologies Inc. All Rights Reserved
14081413
core,github.com/oklog/ulid,Apache-2.0,- Peter Bourgon (@peterbourgon) | - Tomás Senart (@tsenart)
14091414
core,github.com/oklog/ulid/v2,Apache-2.0,- Peter Bourgon (@peterbourgon) | - Tomás Senart (@tsenart)
14101415
core,github.com/olekukonko/tablewriter,MIT,Copyright (C) 2014 by Oleku Konko
@@ -1990,6 +1995,7 @@ core,github.com/richardartoul/molecule/src/codec,Apache-2.0,Copyright (c) 2020 R
19901995
core,github.com/richardartoul/molecule/src/protowire,BSD-3-Clause,Copyright (c) 2018 The Go Authors. All rights reserved | Copyright (c) 2020 Richard Artoul
19911996
core,github.com/rickar/props,BSD-3-Clause,Copyright (c) 2013 Rick Arnold. All rights reserved
19921997
core,github.com/rivo/uniseg,MIT,Copyright (c) 2019 Oliver Kuederle
1998+
core,github.com/robfig/cron,MIT,Copyright (C) 2012 Rob Figueiredo
19931999
core,github.com/robfig/cron/v3,MIT,Copyright (C) 2012 Rob Figueiredo
19942000
core,github.com/rogpeppe/go-internal/fmtsort,BSD-3-Clause,Copyright (c) 2018 The Go Authors. All rights reserved
19952001
core,github.com/rs/cors,MIT,Copyright (c) 2014 Olivier Poitrey <[email protected]>
@@ -2634,6 +2640,56 @@ core,go.opentelemetry.io/proto/otlp/logs/v1,Apache-2.0,Copyright The OpenTelemet
26342640
core,go.opentelemetry.io/proto/otlp/metrics/v1,Apache-2.0,Copyright The OpenTelemetry Authors
26352641
core,go.opentelemetry.io/proto/otlp/resource/v1,Apache-2.0,Copyright The OpenTelemetry Authors
26362642
core,go.opentelemetry.io/proto/otlp/trace/v1,Apache-2.0,Copyright The OpenTelemetry Authors
2643+
core,go.temporal.io/api/activity/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2644+
core,go.temporal.io/api/batch/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2645+
core,go.temporal.io/api/command/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2646+
core,go.temporal.io/api/common/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2647+
core,go.temporal.io/api/deployment/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2648+
core,go.temporal.io/api/enums/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2649+
core,go.temporal.io/api/errordetails/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2650+
core,go.temporal.io/api/export/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2651+
core,go.temporal.io/api/failure/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2652+
core,go.temporal.io/api/filter/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2653+
core,go.temporal.io/api/history/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2654+
core,go.temporal.io/api/internal/protojson,BSD-3-Clause,Copyright (c) 2018 The Go Authors. All rights reserved | Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2655+
core,go.temporal.io/api/internal/protojson/errors,BSD-3-Clause,Copyright (c) 2018 The Go Authors. All rights reserved | Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2656+
core,go.temporal.io/api/internal/protojson/genid,BSD-3-Clause,Copyright (c) 2018 The Go Authors. All rights reserved | Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2657+
core,go.temporal.io/api/internal/protojson/json,BSD-3-Clause,Copyright (c) 2018 The Go Authors. All rights reserved | Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2658+
core,go.temporal.io/api/internal/protojson/order,BSD-3-Clause,Copyright (c) 2018 The Go Authors. All rights reserved | Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2659+
core,go.temporal.io/api/internal/protojson/set,BSD-3-Clause,Copyright (c) 2018 The Go Authors. All rights reserved | Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2660+
core,go.temporal.io/api/internal/protojson/strs,BSD-3-Clause,Copyright (c) 2018 The Go Authors. All rights reserved | Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2661+
core,go.temporal.io/api/internal/strcase,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2662+
core,go.temporal.io/api/namespace/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2663+
core,go.temporal.io/api/nexus/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2664+
core,go.temporal.io/api/operatorservice/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2665+
core,go.temporal.io/api/protocol/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2666+
core,go.temporal.io/api/proxy,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2667+
core,go.temporal.io/api/query/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2668+
core,go.temporal.io/api/replication/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2669+
core,go.temporal.io/api/rules/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2670+
core,go.temporal.io/api/schedule/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2671+
core,go.temporal.io/api/sdk/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2672+
core,go.temporal.io/api/serviceerror,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2673+
core,go.temporal.io/api/taskqueue/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2674+
core,go.temporal.io/api/temporalproto,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2675+
core,go.temporal.io/api/update/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2676+
core,go.temporal.io/api/version/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2677+
core,go.temporal.io/api/worker/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2678+
core,go.temporal.io/api/workflow/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2679+
core,go.temporal.io/api/workflowservice/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2680+
core,go.temporal.io/api/workflowservicemock/v1,MIT,Copyright (c) 2025 Temporal Technologies Inc. All rights reserved
2681+
core,go.temporal.io/sdk/client,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2682+
core,go.temporal.io/sdk/converter,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2683+
core,go.temporal.io/sdk/internal,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2684+
core,go.temporal.io/sdk/internal/common/backoff,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2685+
core,go.temporal.io/sdk/internal/common/cache,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2686+
core,go.temporal.io/sdk/internal/common/metrics,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2687+
core,go.temporal.io/sdk/internal/common/retry,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2688+
core,go.temporal.io/sdk/internal/common/serializer,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2689+
core,go.temporal.io/sdk/internal/common/util,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2690+
core,go.temporal.io/sdk/internal/log,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2691+
core,go.temporal.io/sdk/internal/protocol,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
2692+
core,go.temporal.io/sdk/log,MIT,"Copyright (c) 2020 Temporal Technologies Inc. All rights reserved | Copyright (c) 2020 Uber Technologies, Inc"
26372693
core,go.uber.org/atomic,MIT,"Copyright (c) 2016 Uber Technologies, Inc"
26382694
core,go.uber.org/automaxprocs/internal/cgroups,MIT,"Copyright (c) 2017 Uber Technologies, Inc"
26392695
core,go.uber.org/automaxprocs/internal/runtime,MIT,"Copyright (c) 2017 Uber Technologies, Inc"

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,8 @@ require (
982982
github.com/modelcontextprotocol/go-sdk v1.1.0
983983
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
984984
gitlab.com/gitlab-org/api/client-go v1.8.0
985+
go.temporal.io/api v1.59.0
986+
go.temporal.io/sdk v1.38.0
985987
)
986988

987989
require (
@@ -992,11 +994,14 @@ require (
992994
require (
993995
github.com/VictoriaMetrics/easyproto v0.1.4 // indirect
994996
github.com/aws/aws-sdk-go-v2/service/signin v1.0.4 // indirect
997+
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
995998
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect
996999
github.com/montanaflynn/stats v0.7.1 // indirect
1000+
github.com/nexus-rpc/sdk-go v0.5.1 // indirect
9971001
github.com/open-telemetry/opentelemetry-collector-contrib/internal/healthcheck v0.142.0 // indirect
9981002
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status v0.142.0 // indirect
9991003
github.com/prometheus/client_golang/exp v0.0.0-20250914183048-a974e0d45e0a // indirect
1004+
github.com/robfig/cron v1.2.0 // indirect
10001005
)
10011006

10021007
// github.com/aws/karpenter-provider-aws requires alpha versions of K8s libraries. We are only using some constants from these packages.

go.sum

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/privateactionrunner/bundles/registry.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
com_datadoghq_kubernetes_customresources "github.com/DataDog/datadog-agent/pkg/privateactionrunner/bundles/kubernetes/customresources"
3636
com_datadoghq_mongodb "github.com/DataDog/datadog-agent/pkg/privateactionrunner/bundles/mongodb"
3737
com_datadoghq_script "github.com/DataDog/datadog-agent/pkg/privateactionrunner/bundles/script"
38+
com_datadoghq_temporal "github.com/DataDog/datadog-agent/pkg/privateactionrunner/bundles/temporal"
3839
"github.com/DataDog/datadog-agent/pkg/privateactionrunner/types"
3940
)
4041

@@ -73,6 +74,7 @@ func NewRegistry(configuration *config.Config) *Registry {
7374
"com.datadoghq.kubernetes.customresources": com_datadoghq_kubernetes_customresources.NewKubernetesCustomResources(),
7475
"com.datadoghq.mongodb": com_datadoghq_mongodb.NewMongoDB(),
7576
"com.datadoghq.script": com_datadoghq_script.NewScript(),
77+
"com.datadoghq.temporal": com_datadoghq_temporal.NewTemporal(),
7678
},
7779
}
7880
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed
2+
// under the Apache License Version 2.0.
3+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
// Copyright 2025-present Datadog, Inc.
5+
6+
package com_datadoghq_temporal
7+
8+
import (
9+
"github.com/DataDog/datadog-agent/pkg/privateactionrunner/types"
10+
)
11+
12+
type Temporal struct {
13+
actions map[string]types.Action
14+
}
15+
16+
func NewTemporal() *Temporal {
17+
return &Temporal{
18+
actions: map[string]types.Action{
19+
"runWorkflow": NewRunWorkflowHandler(),
20+
"listWorkflows": NewListWorkflowsHandler(),
21+
"getWorkflowResult": NewGetWorkflowResultHandler(),
22+
},
23+
}
24+
}
25+
26+
func (h *Temporal) GetAction(actionName string) types.Action {
27+
return h.actions[actionName]
28+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed
2+
// under the Apache License Version 2.0.
3+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
// Copyright 2025-present Datadog, Inc.
5+
6+
package com_datadoghq_temporal
7+
8+
import (
9+
"context"
10+
"errors"
11+
12+
log "github.com/DataDog/datadog-agent/pkg/privateactionrunner/adapters/logging"
13+
"github.com/DataDog/datadog-agent/pkg/privateactionrunner/libs/privateconnection"
14+
"github.com/DataDog/datadog-agent/pkg/privateactionrunner/types"
15+
)
16+
17+
type GetWorkflowResultHandler struct{}
18+
19+
func NewGetWorkflowResultHandler() *GetWorkflowResultHandler {
20+
return &GetWorkflowResultHandler{}
21+
}
22+
23+
type GetWorkflowResultInputs struct {
24+
RunId string `json:"runId,omitempty"`
25+
WorkflowId string `json:"workflowId,omitempty"`
26+
Namespace string `json:"namespace,omitempty"`
27+
}
28+
29+
type GetWorkflowResultOutputs struct {
30+
ExecutionResult string `json:"executionResult"`
31+
}
32+
33+
func (h *GetWorkflowResultHandler) Run(
34+
ctx context.Context,
35+
task *types.Task,
36+
credentials *privateconnection.PrivateCredentials,
37+
) (interface{}, error) {
38+
inputs, err := types.ExtractInputs[GetWorkflowResultInputs](task)
39+
if err != nil {
40+
return nil, err
41+
}
42+
43+
namespace := inputs.Namespace
44+
if inputs.Namespace == "" {
45+
namespace = "default"
46+
}
47+
temporalClient, err := newTemporalClient(ctx, credentials, namespace)
48+
if err != nil {
49+
return nil, err
50+
}
51+
defer temporalClient.Close()
52+
53+
workflowRun := temporalClient.GetWorkflow(ctx, inputs.WorkflowId, inputs.RunId)
54+
if workflowRun == nil {
55+
log.FromContext(ctx).Warn("Unable to get workflow run.")
56+
return nil, errors.New("unable to get workflow run")
57+
}
58+
var workflowResult string
59+
err = workflowRun.Get(ctx, &workflowResult)
60+
if err != nil {
61+
return nil, err
62+
}
63+
return &GetWorkflowResultOutputs{
64+
ExecutionResult: workflowResult,
65+
}, nil
66+
}

0 commit comments

Comments
 (0)