From a9a8a185293d1a9ddd974c3ac024ecba7d4aead8 Mon Sep 17 00:00:00 2001 From: Qiaozp Date: Wed, 8 Feb 2023 11:46:20 +0800 Subject: [PATCH] Fix: simplify notification parameters Signed-off-by: Qiaozp --- .../defwithtemplate/notification.yaml | 39 +++++++++---------- .../defwithtemplate/notification.yaml | 39 +++++++++---------- .../internal/workflowstep/notification.cue | 33 +++++++--------- 3 files changed, 51 insertions(+), 60 deletions(-) diff --git a/charts/vela-core/templates/defwithtemplate/notification.yaml b/charts/vela-core/templates/defwithtemplate/notification.yaml index b4b65fba1..233358d20 100644 --- a/charts/vela-core/templates/defwithtemplate/notification.yaml +++ b/charts/vela-core/templates/defwithtemplate/notification.yaml @@ -56,44 +56,41 @@ spec: // +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?: *null | close({ + text?: close({ content: string }) // +usage=msgType can be text, link, mardown, actionCard, feedCard msgtype: *"text" | "link" | "markdown" | "actionCard" | "feedCard" - link?: *null | close({ + #link: close({ text?: string title?: string messageUrl?: string picUrl?: string }) - markdown?: *null | close({ + + link?: #link + markdown?: close({ text: string title: string }) - at?: *null | close({ - atMobiles?: *null | [...string] - isAtAll?: bool + at?: close({ + atMobiles?: [...string] + isAtAll?: bool }) - actionCard?: *null | close({ + actionCard?: close({ text: string title: string hideAvatar: string btnOrientation: string singleTitle: string singleURL: string - btns: *null | close([...*null | close({ + btns?: [...close({ title: string actionURL: string - })]) + })] }) - feedCard?: *null | close({ - links: *null | close([...*null | close({ - text?: string - title?: string - messageUrl?: string - picUrl?: string - })]) + feedCard?: close({ + links: [...#link] }) } } @@ -114,11 +111,11 @@ spec: // +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?: *null | close([...block]) - attachments?: *null | close({ - blocks?: *null | close([...block]) - color?: string + text: string + blocks?: [...block] + attachments?: close({ + blocks?: [...block] + color?: string }) thread_ts?: string // +usage=Specify the message text format in markdown for slack notification diff --git a/charts/vela-minimal/templates/defwithtemplate/notification.yaml b/charts/vela-minimal/templates/defwithtemplate/notification.yaml index b4b65fba1..233358d20 100644 --- a/charts/vela-minimal/templates/defwithtemplate/notification.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/notification.yaml @@ -56,44 +56,41 @@ spec: // +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?: *null | close({ + text?: close({ content: string }) // +usage=msgType can be text, link, mardown, actionCard, feedCard msgtype: *"text" | "link" | "markdown" | "actionCard" | "feedCard" - link?: *null | close({ + #link: close({ text?: string title?: string messageUrl?: string picUrl?: string }) - markdown?: *null | close({ + + link?: #link + markdown?: close({ text: string title: string }) - at?: *null | close({ - atMobiles?: *null | [...string] - isAtAll?: bool + at?: close({ + atMobiles?: [...string] + isAtAll?: bool }) - actionCard?: *null | close({ + actionCard?: close({ text: string title: string hideAvatar: string btnOrientation: string singleTitle: string singleURL: string - btns: *null | close([...*null | close({ + btns?: [...close({ title: string actionURL: string - })]) + })] }) - feedCard?: *null | close({ - links: *null | close([...*null | close({ - text?: string - title?: string - messageUrl?: string - picUrl?: string - })]) + feedCard?: close({ + links: [...#link] }) } } @@ -114,11 +111,11 @@ spec: // +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?: *null | close([...block]) - attachments?: *null | close({ - blocks?: *null | close([...block]) - color?: string + text: string + blocks?: [...block] + attachments?: close({ + blocks?: [...block] + color?: string }) thread_ts?: string // +usage=Specify the message text format in markdown for slack notification diff --git a/vela-templates/definitions/internal/workflowstep/notification.cue b/vela-templates/definitions/internal/workflowstep/notification.cue index c190e96dc..0bbaeb3c0 100644 --- a/vela-templates/definitions/internal/workflowstep/notification.cue +++ b/vela-templates/definitions/internal/workflowstep/notification.cue @@ -51,44 +51,41 @@ template: { // +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?: *null | close({ + text?: close({ content: string }) // +usage=msgType can be text, link, mardown, actionCard, feedCard msgtype: *"text" | "link" | "markdown" | "actionCard" | "feedCard" - link?: *null | close({ + #link: close({ text?: string title?: string messageUrl?: string picUrl?: string }) - markdown?: *null | close({ + + link?: #link + markdown?: close({ text: string title: string }) - at?: *null | close({ - atMobiles?: *null | [...string] + at?: close({ + atMobiles?: [...string] isAtAll?: bool }) - actionCard?: *null | close({ + actionCard?: close({ text: string title: string hideAvatar: string btnOrientation: string singleTitle: string singleURL: string - btns: *null | close([...*null | close({ + btns?: [...close({ title: string actionURL: string - })]) + })] }) - feedCard?: *null | close({ - links: *null | close([...*null | close({ - text?: string - title?: string - messageUrl?: string - picUrl?: string - })]) + feedCard?: close({ + links: [...#link] }) } } @@ -110,9 +107,9 @@ template: { message: { // +usage=Specify the message text for slack notification text: string - blocks?: *null | close([...block]) - attachments?: *null | close({ - blocks?: *null | close([...block]) + blocks?: [...block] + attachments?: close({ + blocks?: [...block] color?: string }) thread_ts?: string