Skip to content

Commit

Permalink
Merge pull request #73 from FogDong/stable-version
Browse files Browse the repository at this point in the history
Chore: stable the cue version and deprecate message for terminate
  • Loading branch information
FogDong authored Oct 31, 2022
2 parents 6dd48bb + 9bb0705 commit 2c130ce
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 40 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/kubevela/workflow
go 1.19

require (
cuelang.org/go v0.4.4-0.20220915174651-ad253ed099e9
cuelang.org/go v0.5.0-alpha.1
github.com/agiledragon/gomonkey/v2 v2.4.0
github.com/aliyun/aliyun-log-go-sdk v0.1.38
github.com/crossplane/crossplane-runtime v0.14.1-0.20210722005935-0b469fcc77cd
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc=
cuelang.org/go v0.4.4-0.20220915174651-ad253ed099e9 h1:4mfDNgtdb398g0bekqiW8J8tw+JN3/U/3wh+Jw/I4Yk=
cuelang.org/go v0.4.4-0.20220915174651-ad253ed099e9/go.mod h1:nxWFAPWKYvZJ+eYayxArWqKKjdBTeU1N52vJpML/c6w=
cuelang.org/go v0.5.0-alpha.1 h1:uftOYkiScCHPCQMF2dIwoyCIJsTAEONkFSA2GCm5xIc=
cuelang.org/go v0.5.0-alpha.1/go.mod h1:nxWFAPWKYvZJ+eYayxArWqKKjdBTeU1N52vJpML/c6w=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/AlecAivazis/survey/v2 v2.1.1 h1:LEMbHE0pLj75faaVEKClEX1TM4AJmmnOh9eimREzLWI=
github.com/AlecAivazis/survey/v2 v2.1.1/go.mod h1:9FJRdMdDm8rnT+zHVbvQT2RTSTLq0Ttd6q3Vl2fahjk=
Expand Down
2 changes: 0 additions & 2 deletions pkg/executor/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,6 @@ func (e *engine) checkWorkflowStatusMessage(wfStatus *v1alpha1.WorkflowRunStatus
switch {
case !e.waiting && e.failedAfterRetries && feature.DefaultMutableFeatureGate.Enabled(features.EnableSuspendOnFailure):
e.status.Message = types.MessageSuspendFailedAfterRetries
case wfStatus.Terminated && !feature.DefaultMutableFeatureGate.Enabled(features.EnableSuspendOnFailure):
e.status.Message = types.MessageTerminated
default:
e.status.Message = ""
}
Expand Down
11 changes: 0 additions & 11 deletions pkg/executor/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ var _ = Describe("Test Workflow", func() {
cleanStepTimeStamp(&workflowStatus)
Expect(cmp.Diff(workflowStatus, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Message: types.MessageTerminated,
Terminated: true,
Steps: []v1alpha1.WorkflowStepStatus{
{
Expand Down Expand Up @@ -371,7 +370,6 @@ var _ = Describe("Test Workflow", func() {
cleanStepTimeStamp(&workflowStatus)
Expect(cmp.Diff(workflowStatus, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Message: types.MessageTerminated,
Terminated: true,
Steps: []v1alpha1.WorkflowStepStatus{
{
Expand Down Expand Up @@ -464,7 +462,6 @@ var _ = Describe("Test Workflow", func() {
cleanStepTimeStamp(&workflowStatus)
Expect(cmp.Diff(workflowStatus, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Message: types.MessageTerminated,
Terminated: true,
Steps: []v1alpha1.WorkflowStepStatus{{
StepStatus: v1alpha1.StepStatus{
Expand Down Expand Up @@ -556,7 +553,6 @@ var _ = Describe("Test Workflow", func() {
cleanStepTimeStamp(&workflowStatus)
Expect(cmp.Diff(workflowStatus, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Message: types.MessageTerminated,
Terminated: true,
Steps: []v1alpha1.WorkflowStepStatus{{
StepStatus: v1alpha1.StepStatus{
Expand Down Expand Up @@ -641,7 +637,6 @@ var _ = Describe("Test Workflow", func() {
Expect(cmp.Diff(instance.Status, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Terminated: true,
Message: string(types.MessageTerminated),
Steps: []v1alpha1.WorkflowStepStatus{{
StepStatus: v1alpha1.StepStatus{
Name: "s1",
Expand Down Expand Up @@ -729,7 +724,6 @@ var _ = Describe("Test Workflow", func() {
Expect(cmp.Diff(instance.Status, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Terminated: true,
Message: types.MessageTerminated,
Steps: []v1alpha1.WorkflowStepStatus{{
StepStatus: v1alpha1.StepStatus{
Name: "s1",
Expand Down Expand Up @@ -1057,7 +1051,6 @@ var _ = Describe("Test Workflow", func() {
cleanStepTimeStamp(&workflowStatus)
Expect(cmp.Diff(workflowStatus, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Message: types.MessageTerminated,
Suspend: false,
Terminated: true,
Steps: []v1alpha1.WorkflowStepStatus{{
Expand Down Expand Up @@ -1154,7 +1147,6 @@ var _ = Describe("Test Workflow", func() {
cleanStepTimeStamp(&workflowStatus)
Expect(cmp.Diff(workflowStatus, v1alpha1.WorkflowRunStatus{
Mode: dagMode,
Message: types.MessageTerminated,
Terminated: true,
Steps: []v1alpha1.WorkflowStepStatus{{
StepStatus: v1alpha1.StepStatus{
Expand Down Expand Up @@ -1425,7 +1417,6 @@ var _ = Describe("Test Workflow", func() {
Expect(cmp.Diff(instance.Status, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Terminated: true,
Message: types.MessageTerminated,
Steps: []v1alpha1.WorkflowStepStatus{{
StepStatus: v1alpha1.StepStatus{
Name: "s1",
Expand Down Expand Up @@ -1924,7 +1915,6 @@ var _ = Describe("Test Workflow", func() {
Expect(cmp.Diff(instance.Status, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Terminated: true,
Message: types.MessageTerminated,
Steps: []v1alpha1.WorkflowStepStatus{{
StepStatus: v1alpha1.StepStatus{
Name: "s1",
Expand Down Expand Up @@ -1983,7 +1973,6 @@ var _ = Describe("Test Workflow", func() {
Expect(cmp.Diff(instance.Status, v1alpha1.WorkflowRunStatus{
Mode: defaultMode,
Terminated: true,
Message: types.MessageTerminated,
Steps: []v1alpha1.WorkflowStepStatus{{
StepStatus: v1alpha1.StepStatus{
Name: "s1",
Expand Down
17 changes: 13 additions & 4 deletions pkg/stdlib/actions/v1/op.cue
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,32 @@ import (
)

#ConditionalWait: {
#do: "wait"
#do: "wait"

// +usage=If continue is false, the step will wait for continue to be true.
continue: bool
// +usage=Optional message that will be shown in workflow step status, note that the message might be override by other actions.
message?: string
}

#Break: {
#do: "break"
#do: "break"

// +usage=Optional message that will be shown in workflow step status, note that the message might be override by other actions.
message?: string
}

#Fail: {
#do: "fail"
#do: "fail"

// +usage=Optional message that will be shown in workflow step status, note that the message might be override by other actions.
message?: string
}

#Message: {
#do: "message"
#do: "message"

// +usage=Optional message that will be shown in workflow step status, note that the message might be override by other actions.
message?: string
}

Expand Down
20 changes: 15 additions & 5 deletions pkg/stdlib/actions/v1/pkgs/email.cue
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,27 @@
#do: "send"
#provider: "email"

// +usage=The info of the sender
from: {
address: string
alias?: string
// +usage=The address of the sender
address: string
// +usage=The alias of the sender
alias?: string
// +usage=The password of the sender
password: string
host: string
port: int
// +usage=The host of the sender server
host: string
// +usage=The port of the sender server
port: int
}
// +usgae=The email address list of the recievers
to: [...string]
// +usage=The content of the email
content: {
// +usage=The subject of the email
subject: string
body: string
// +usage=The body of the email
body: string
}
stepID: context.stepSessionID
...
Expand Down
20 changes: 17 additions & 3 deletions pkg/stdlib/actions/v1/pkgs/http.cue
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,38 @@
#do: "do"
#provider: "http"

// +usage=The method of HTTP request
method: *"GET" | "POST" | "PUT" | "DELETE"
url: string
// +usage=The url to request
url: string
// +usage=The request config
request?: {
// +usage=The timeout of this request
timeout?: string
body?: string
header?: [string]: string
// +usage=The request body
body?: string
// +usage=The header of the request
header?: [string]: string
// +usage=The trailer of the request
trailer?: [string]: string
// +usage=The rate limiter of the request
ratelimiter?: {
limit: int
period: string
}
...
}
// +usgae=The tls config of the request
tls_config?: secret: string
// +usage=The response of the request will be filled in this field after the action is executed
response: {
// +usage=The body of the response
body: string
// +usage=The header of the response
header?: [string]: [...string]
// +usage=The trailer of the response
trailer?: [string]: [...string]
// +usage=The status code of the response
statusCode: int
...
}
Expand Down
45 changes: 37 additions & 8 deletions pkg/stdlib/actions/v1/pkgs/kube.cue
Original file line number Diff line number Diff line change
@@ -1,57 +1,86 @@
#Apply: {
#do: "apply"
#provider: "kube"
cluster: *"" | string

// +usage=The cluster to use
cluster: *"" | string
// +usage=The resource to apply
value: {...}
...
}

#ApplyInParallel: {
#do: "apply-in-parallel"
#provider: "kube"
cluster: *"" | string

// +usage=The cluster to use
cluster: *"" | string
// +usage=The resources to apply in parallel
value: [...{...}]
...
}

#Read: {
#do: "read"
#provider: "kube"
cluster: *"" | string

// +usage=The cluster to use
cluster: *"" | string
// +usage=The resource to read, this field will be filled with the resource read from the cluster after the action is executed
value?: {...}
...
}

#List: {
#do: "list"
#provider: "kube"
cluster: *"" | string

// +usage=The cluster to use
cluster: *"" | string
// +usage=The resource to list
resource: {
// +usage=The api version of the resource
apiVersion: string
kind: string
// +usage=The kind of the resource
kind: string
}
// +usage=The filter to list the resources
filter?: {
// +usage=The namespace to list the resources
namespace?: *"" | string
// +usage=The label selector to filter the resources
matchingLabels?: {...}
}
// +usage=The listed resources will be filled in this field after the action is executed
list?: {...}
...
}

#Delete: {
#do: "delete"
#provider: "kube"
cluster: *"" | string

// +usage=The cluster to use
cluster: *"" | string
// +usage=The resource to delete
value: {
// +usage=The api version of the resource
apiVersion: string
kind: string
// +usage=The kind of the resource
kind: string
// +usage=The metadata of the resource
metadata: {
name?: string
// +usage=The name of the resource
name?: string
// +usage=The namespace of the resource
namespace: *"default" | string
}
}
// +usage=The filter to delete the resources
filter?: {
// +usage=The namespace to list the resources
namespace?: string
// +usage=The label selector to filter the resources
matchingLabels?: {...}
}
...
Expand Down
8 changes: 6 additions & 2 deletions pkg/stdlib/actions/v1/pkgs/ws.cue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
}

#DoVar: {
#do: "var"
#do: "var"

// +usage=The method to call on the variable
method: *"Get" | "Put"
path: string
// +usage=The path to the variable
path: string
// +usage=The value of the variable
value?: _
}
2 changes: 0 additions & 2 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,6 @@ const (
)

const (
// MessageTerminated is the message of failed workflow
MessageTerminated = "The workflow terminates because of the failed steps"
// MessageSuspendFailedAfterRetries is the message of failed after retries
MessageSuspendFailedAfterRetries = "The workflow suspends automatically because the failed times of steps have reached the limit"
)
Expand Down

0 comments on commit 2c130ce

Please sign in to comment.