mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 10:00:06 +00:00
Some checks failed
Webhook Upgrade Validation / webhook-upgrade-check (push) Failing after 24s
* chore: updates culenag version and syntax across all files Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * debuggin: reverts tf provider changes Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Refactor: Simplify provider configuration by removing 'providerBasic' and directly defining access keys and region for providers Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Refactor: Consolidate provider configuration by introducing 'providerBasic' for access keys and region Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * chore: reorganize import statements in deepcopy files for consistency Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * chore: reorder import statements for consistency across deepcopy files Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Refactor: Safely handle pattern parameter selectors to avoid panics in GetParameters and getStatusMap Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * chore: add comment to clarify test context in definition_revision_test.go Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * chore: remove redundant comment from test context initialization in definition_revision_test.go Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Refactor: Introduce GetSelectorLabel function to safely extract labels from CUE selectors Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * chore: add newline at end of file in utils.go Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * chore: increase timeout for multi-cluster e2e Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> --------- Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Co-authored-by: Amit Singh <singhamitch@outlook.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
390 lines
13 KiB
YAML
390 lines
13 KiB
YAML
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
|
# Definition source cue file: vela-templates/definitions/internal/notification.cue
|
|
apiVersion: core.oam.dev/v1beta1
|
|
kind: WorkflowStepDefinition
|
|
metadata:
|
|
annotations:
|
|
custom.definition.oam.dev/category: External Integration
|
|
definition.oam.dev/description: Send notifications to Email, DingTalk, Slack, Lark or webhook in your workflow.
|
|
name: notification
|
|
namespace: {{ include "systemDefinitionNamespace" . }}
|
|
spec:
|
|
schematic:
|
|
cue:
|
|
template: |
|
|
import "vela/http"
|
|
import "vela/email"
|
|
import "vela/kube"
|
|
import "vela/util"
|
|
import "encoding/base64"
|
|
import "encoding/json"
|
|
|
|
parameter: {
|
|
// +usage=Please fulfill its url and message if you want to send Lark messages
|
|
lark?: {
|
|
// +usage=Specify the the lark url, you can either sepcify it in value or use secretRef
|
|
url: close({
|
|
// +usage=the url address content in string
|
|
value: string
|
|
}) | close({
|
|
secretRef: {
|
|
// +usage=name is the name of the secret
|
|
name: string
|
|
// +usage=key is the key in the secret
|
|
key: string
|
|
}
|
|
})
|
|
// +usage=Specify the message that you want to sent, refer to [Lark messaging](https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN#8b0f2a1b).
|
|
message: {
|
|
// +usage=msg_type can be text, post, image, interactive, share_chat, share_user, audio, media, file, sticker
|
|
msg_type: string
|
|
// +usage=content should be json encode string
|
|
content: string
|
|
}
|
|
}
|
|
// +usage=Please fulfill its url and message if you want to send DingTalk messages
|
|
dingding?: {
|
|
// +usage=Specify the the dingding url, you can either sepcify it in value or use secretRef
|
|
url: close({
|
|
// +usage=the url address content in string
|
|
value: string
|
|
}) | close({
|
|
secretRef: {
|
|
// +usage=name is the name of the secret
|
|
name: string
|
|
// +usage=key is the key in the secret
|
|
key: string
|
|
}
|
|
})
|
|
// +usage=Specify the message that you want to sent, refer to [dingtalk messaging](https://developers.dingtalk.com/document/robots/custom-robot-access/title-72m-8ag-pqw)
|
|
message: {
|
|
// +usage=Specify the message content of dingtalk notification
|
|
text?: close({
|
|
content: string
|
|
})
|
|
// +usage=msgType can be text, link, mardown, actionCard, feedCard
|
|
msgtype: *"text" | "link" | "markdown" | "actionCard" | "feedCard"
|
|
#link: {
|
|
text?: string
|
|
title?: string
|
|
messageUrl?: string
|
|
picUrl?: string
|
|
}
|
|
|
|
link?: #link
|
|
markdown?: close({
|
|
text: string
|
|
title: string
|
|
})
|
|
at?: close({
|
|
atMobiles?: [...string]
|
|
isAtAll?: bool
|
|
})
|
|
actionCard?: close({
|
|
text: string
|
|
title: string
|
|
hideAvatar: string
|
|
btnOrientation: string
|
|
singleTitle: string
|
|
singleURL: string
|
|
btns?: [...close({
|
|
title: string
|
|
actionURL: string
|
|
})]
|
|
})
|
|
feedCard?: close({
|
|
links: [...#link]
|
|
})
|
|
}
|
|
}
|
|
// +usage=Please fulfill its url and message if you want to send Slack messages
|
|
slack?: {
|
|
// +usage=Specify the the slack url, you can either sepcify it in value or use secretRef
|
|
url: close({
|
|
// +usage=the url address content in string
|
|
value: string
|
|
}) | close({
|
|
secretRef: {
|
|
// +usage=name is the name of the secret
|
|
name: string
|
|
// +usage=key is the key in the secret
|
|
key: string
|
|
}
|
|
})
|
|
// +usage=Specify the message that you want to sent, refer to [slack messaging](https://api.slack.com/reference/messaging/payload)
|
|
message: {
|
|
// +usage=Specify the message text for slack notification
|
|
text: string
|
|
blocks?: [...block]
|
|
attachments?: close({
|
|
blocks?: [...block]
|
|
color?: string
|
|
})
|
|
thread_ts?: string
|
|
// +usage=Specify the message text format in markdown for slack notification
|
|
mrkdwn?: *true | bool
|
|
}
|
|
}
|
|
// +usage=Please fulfill its from, to and content if you want to send email
|
|
email?: {
|
|
// +usage=Specify the email info that you want to send from
|
|
from: {
|
|
// +usage=Specify the email address that you want to send from
|
|
address: string
|
|
// +usage=The alias is the email alias to show after sending the email
|
|
alias?: string
|
|
// +usage=Specify the password of the email, you can either sepcify it in value or use secretRef
|
|
password: close({
|
|
// +usage=the password content in string
|
|
value: string
|
|
}) | close({
|
|
secretRef: {
|
|
// +usage=name is the name of the secret
|
|
name: string
|
|
// +usage=key is the key in the secret
|
|
key: string
|
|
}
|
|
})
|
|
// +usage=Specify the host of your email
|
|
host: string
|
|
// +usage=Specify the port of the email host, default to 587
|
|
port: *587 | int
|
|
}
|
|
// +usage=Specify the email address that you want to send to
|
|
to: [...string]
|
|
// +usage=Specify the content of the email
|
|
content: {
|
|
// +usage=Specify the subject of the email
|
|
subject: string
|
|
// +usage=Specify the context body of the email
|
|
body: string
|
|
}
|
|
}
|
|
}
|
|
|
|
block: {
|
|
type: string
|
|
block_id?: string
|
|
elements?: [...{
|
|
type: string
|
|
action_id?: string
|
|
url?: string
|
|
value?: string
|
|
style?: string
|
|
text?: textType
|
|
confirm?: {
|
|
title: textType
|
|
text: textType
|
|
confirm: textType
|
|
deny: textType
|
|
style?: string
|
|
}
|
|
options?: [...option]
|
|
initial_options?: [...option]
|
|
placeholder?: textType
|
|
initial_date?: string
|
|
image_url?: string
|
|
alt_text?: string
|
|
option_groups?: [...option]
|
|
max_selected_items?: int
|
|
initial_value?: string
|
|
multiline?: bool
|
|
min_length?: int
|
|
max_length?: int
|
|
dispatch_action_config?: trigger_actions_on?: [...string]
|
|
initial_time?: string
|
|
}]
|
|
}
|
|
|
|
textType: {
|
|
type: string
|
|
text: string
|
|
emoji?: bool
|
|
verbatim?: bool
|
|
}
|
|
|
|
option: {
|
|
text: textType
|
|
value: string
|
|
description?: textType
|
|
url?: string
|
|
}
|
|
|
|
// send webhook notification
|
|
ding: {
|
|
if parameter.dingding != _|_ {
|
|
if parameter.dingding.url.value != _|_ {
|
|
ding1: http.#Do & {
|
|
$params: {
|
|
method: "POST"
|
|
url: parameter.dingding.url.value
|
|
request: {
|
|
body: json.Marshal(parameter.dingding.message)
|
|
header: "Content-Type": "application/json"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if parameter.dingding.url.secretRef != _|_ && parameter.dingding.url.value == _|_ {
|
|
read: kube.#Read & {
|
|
$params: value: {
|
|
apiVersion: "v1"
|
|
kind: "Secret"
|
|
metadata: {
|
|
name: parameter.dingding.url.secretRef.name
|
|
namespace: context.namespace
|
|
}
|
|
}
|
|
}
|
|
|
|
stringValue: util.#ConvertString & {$params: bt: base64.Decode(null, read.$returns.value.data[parameter.dingding.url.secretRef.key])}
|
|
ding2: http.#Do & {
|
|
$params: {
|
|
method: "POST"
|
|
url: stringValue.$returns.str
|
|
request: {
|
|
body: json.Marshal(parameter.dingding.message)
|
|
header: "Content-Type": "application/json"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
lark: {
|
|
if parameter.lark != _|_ {
|
|
if parameter.lark.url.value != _|_ {
|
|
lark1: http.#Do & {
|
|
$params: {
|
|
method: "POST"
|
|
url: parameter.lark.message
|
|
request: {
|
|
body: json.Marshal(parameter.lark.message)
|
|
header: "Content-Type": "application/json"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if parameter.lark.url.secretRef != _|_ && parameter.lark.url.value == _|_ {
|
|
read: kube.#Read & {
|
|
$params: value: {
|
|
apiVersion: "v1"
|
|
kind: "Secret"
|
|
metadata: {
|
|
name: parameter.lark.url.secretRef.name
|
|
namespace: context.namespace
|
|
}
|
|
}
|
|
}
|
|
|
|
stringValue: util.#ConvertString & {$params: bt: base64.Decode(null, read.$returns.value.data[parameter.lark.url.secretRef.key])}
|
|
lark2: http.#Do & {
|
|
$params: {
|
|
method: "POST"
|
|
url: stringValue.$returns.str
|
|
request: {
|
|
body: json.Marshal(parameter.lark.message)
|
|
header: "Content-Type": "application/json"
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
slack: {
|
|
if parameter.slack != _|_ {
|
|
if parameter.slack.url.value != _|_ {
|
|
slack1: http.#Do & {
|
|
$params: {
|
|
method: "POST"
|
|
url: parameter.slack.url.value
|
|
request: {
|
|
body: json.Marshal(parameter.slack.message)
|
|
header: "Content-Type": "application/json"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if parameter.slack.url.secretRef != _|_ && parameter.slack.url.value == _|_ {
|
|
read: kube.#Read & {
|
|
$params: value: {
|
|
kind: "Secret"
|
|
apiVersion: "v1"
|
|
metadata: {
|
|
name: parameter.slack.url.secretRef.name
|
|
namespace: context.namespace
|
|
}
|
|
}
|
|
}
|
|
|
|
stringValue: util.#ConvertString & {$params: bt: base64.Decode(null, read.$returns.value.data[parameter.slack.url.secretRef.key])}
|
|
slack2: http.#Do & {
|
|
$params: {
|
|
method: "POST"
|
|
url: stringValue.$returns.str
|
|
request: {
|
|
body: json.Marshal(parameter.slack.message)
|
|
header: "Content-Type": "application/json"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
email0: {
|
|
if parameter.email != _|_ {
|
|
if parameter.email.from.password.value != _|_ {
|
|
email1: email.#SendEmail & {
|
|
$params: {
|
|
from: {
|
|
address: parameter.email.from.address
|
|
if parameter.email.from.alias != _|_ {
|
|
alias: parameter.email.from.alias
|
|
}
|
|
password: parameter.email.from.password.value
|
|
host: parameter.email.from.host
|
|
port: parameter.email.from.port
|
|
}
|
|
to: parameter.email.to
|
|
content: parameter.email.content
|
|
}
|
|
}
|
|
}
|
|
|
|
if parameter.email.from.password.secretRef != _|_ && parameter.email.from.password.value == _|_ {
|
|
read: kube.#Read & {
|
|
$params: value: {
|
|
kind: "Secret"
|
|
apiVersion: "v1"
|
|
metadata: {
|
|
name: parameter.email.from.password.secretRef.name
|
|
namespace: context.namespace
|
|
}
|
|
}
|
|
}
|
|
|
|
stringValue: util.#ConvertString & {$params: bt: base64.Decode(null, read.$returns.value.data[parameter.email.from.password.secretRef.key])}
|
|
email2: email.#SendEmail & {
|
|
$params: {
|
|
from: {
|
|
address: parameter.email.from.address
|
|
if parameter.email.from.alias != _|_ {
|
|
alias: parameter.email.from.alias
|
|
}
|
|
password: stringValue.str
|
|
host: parameter.email.from.host
|
|
port: parameter.email.from.port
|
|
}
|
|
to: parameter.email.to
|
|
content: parameter.email.content
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|