/
climon.go
52 lines (43 loc) · 1.12 KB
/
climon.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package workers
import (
"context"
"encoding/json"
"log"
"github.com/kube-tarian/kad/agent/pkg/temporalclient"
"go.temporal.io/sdk/client"
)
type climon struct {
client *temporalclient.Client
}
func NewClimon(client *temporalclient.Client) *climon {
return &climon{
client: client,
}
}
func (c *climon) GetWorkflowName() string {
return DeployWorkflowName
}
func (c *climon) SendEvent(ctx context.Context, deployPayload json.RawMessage) (client.WorkflowRun, error) {
options := client.StartWorkflowOptions{
ID: "helm-deploy-workflow",
TaskQueue: ClimonHelmTaskQueue,
}
/*
deployInfo := helm.DeployInfo{
Version: "1.0",
RepoUrl: "https://charts.bitnami.com/bitnami",
RepoName: "bitnami",
Namespace: "web",
ChartName: "bitnami/wordpress",
ReleaseName: "intelops",
ReferenceID: uuid.New().String(),
}
*/
we, err := c.client.ExecuteWorkflow(context.Background(), options, DeployWorkflowName, deployPayload)
if err != nil {
log.Println("error starting TransferMoney workflow", err)
return nil, err
}
//printResults(deployInfo, we.GetID(), we.GetRunID())
return we, nil
}