feishu_plugin

package
v1.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2023 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const (
	NamePluginDebug   = "config.debug"
	EnvPluginTimeOut  = "PLUGIN_TIMEOUT_SECOND"
	NamePluginTimeOut = "config.timeout_second"

	RenderStatusShow = "success"
	RenderStatusHide = "failure"

	MsgTypeText        = "text"
	MsgTypePost        = "post"
	MsgTypeInteractive = "interactive"
)
View Source
const (
	EnvDroneSystemAdminToken = "PLUGIN_DRONE_SYSTEM_ADMIN_TOKEN"

	EnvPluginFeishuIgnoreLastSuccessByAdminTokenDistance = "PLUGIN_FEISHU_IGNORE_LAST_SUCCESS_BY_ADMIN_TOKEN_DISTANCE"
	EnvPluginFeishuIgnoreLastSuccessByBadges             = "PLUGIN_FEISHU_IGNORE_LAST_SUCCESS_BY_BADGES"
	EnvPluginFeishuIgnoreLastSuccessBranch               = "PLUGIN_FEISHU_IGNORE_LAST_SUCCESS_BRANCH"
	EnvPluginFeishuWebhook                               = "PLUGIN_FEISHU_WEBHOOK"
	EnvPluginFeishuSecret                                = "PLUGIN_FEISHU_SECRET"
	EnvPluginFeishuMsgTitle                              = "PLUGIN_FEISHU_MSG_TITLE"
	EnvPluginFeishuEnableForward                         = "PLUGIN_FEISHU_ENABLE_FORWARD"
	EnvPluginFeishuMsgType                               = "PLUGIN_FEISHU_MSG_TYPE"
	EnvPluginFeishuMsgPoweredByImageKey                  = "PLUGIN_FEISHU_MSG_POWERED_BY_IMAGE_KEY"
	EnvPluginFeishuMsgPoweredByImageAlt                  = "PLUGIN_FEISHU_MSG_POWERED_BY_IMAGE_ALT"

	EnvPluginFeishuOssHost           = "PLUGIN_FEISHU_OSS_HOST"
	EnvPluginFeishuOssInfoSendResult = "PLUGIN_FEISHU_OSS_INFO_SEND_RESULT"
	EnvPluginFeishuOssInfoUser       = "PLUGIN_FEISHU_OSS_INFO_USER"
	EnvPluginFeishuOssInfoPath       = "PLUGIN_FEISHU_OSS_INFO_PATH"
	EnvPluginFeishuOssResourceUrl    = "PLUGIN_FEISHU_OSS_RESOURCE_URL"
	EnvPluginFeishuOssPageUrl        = "PLUGIN_FEISHU_OSS_PAGE_URL"
	EnvPluginFeishuOssPagePasswd     = "PLUGIN_FEISHU_OSS_PAGE_PASSWD"
)
View Source
const DefaultCardTemplate string = `` /* 4140-byte string literal not displayed */

DefaultCardTemplate use FeishuPlugin and feishu_message.FeishuRobotMsgTemplate

Variables

This section is empty.

Functions

func CommonFlag added in v1.5.0

func CommonFlag() []cli.Flag

CommonFlag Other modules also have flags

func Flag added in v1.5.0

func Flag() []cli.Flag

Flag set plugin flag at here

func HideFlag added in v1.5.0

func HideFlag() []cli.Flag

HideFlag hide flags

func IsBuildDebugOpen added in v1.12.0

func IsBuildDebugOpen(c *cli.Context) bool

IsBuildDebugOpen when config or drone build open debug will open debug

func RenderFeishuCard

func RenderFeishuCard(tpl string, p *FeishuPlugin) (string, error)

Types

type CardOss added in v1.2.0

type CardOss struct {
	Host string

	// HeadTemplateStyle
	// @doc https://open.feishu.cn/document/common-capabilities/message-card/message-cards-content/card-header
	HeadTemplateStyle string

	// InfoTagResult
	// tag result [ success or failure]
	InfoTagResult string
	// InfoSendResult
	// send result [ success or failure]
	InfoSendResult string

	// pull request [ success or failure]
	InfoPullRequestResult string

	InfoUser string
	InfoPath string

	RenderResourceUrl string
	ResourceUrl       string
	PageUrl           string
	PagePasswd        string
}

type Config

type Config struct {
	Debug                 bool
	DroneSystemAdminToken string
	NtpTarget             string
	Webhook               string
	Secret                string
	FeishuEnableForward   bool
	TimeoutSecond         int
	MsgType               string
	Title                 string
	PoweredByImageKey     string
	PoweredByImageAlt     string

	IgnoreLastSuccessByAdminTokenDistance uint

	IgnoreLastSuccessByBadges     bool
	IgnoreLastSuccessBadgesBranch string

	RenderOssCard string
	CardOss       CardOss
}

Config plugin private config

type FeishuPlugin added in v1.2.0

type FeishuPlugin struct {
	Name                   string
	Version                string
	Drone                  drone_info.Drone
	Config                 Config
	SendTarget             SendTarget
	FeishuRobotMsgTemplate feishu_message.FeishuRobotMsgTemplate
	// contains filtered or unexported fields
}

FeishuPlugin plugin all config

func BindFlag added in v1.5.0

func BindFlag(c *cli.Context, cliVersion, cliName string, drone drone_info.Drone) FeishuPlugin

func (*FeishuPlugin) Exec added in v1.2.0

func (p *FeishuPlugin) Exec() error

type SendTarget

type SendTarget struct {
	Webhook        string
	Secret         string
	FeishuRobotMeg []byte
}

SendTarget send feishu target

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL