收件人提供者的Jenkins Pipeline emailext $ class参数 [英] Jenkins Pipeline emailext $class parameter for recipientProviders

查看:672
本文介绍了收件人提供者的Jenkins Pipeline emailext $ class参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力理解下面的管道常规代码:

I have been trying to get my head around the pipeline groovy code below:

emailext (
        subject: "STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
        body: """<p>STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
          <p>Check console output at &QUOT;<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>&QUOT;</p>""",
        recipientProviders: [[$class: 'DevelopersRecipientProvider']]
      )

1)类($ class)之前的美元符号是否有特殊含义?我知道它指的是类类型DevelopersRecipientProvider,但是$class在groovy中是某种特殊的保留字来表示类类型吗?

1) Does the dollar sign before the class (which is $class) have some special meaning? I know it refers to the class type DevelopersRecipientProvider but is $class some sort of special reserved word in groovy to indicate class type?

2)在源代码中,recipientProviders是一个List,但是在上面的代码中到底给它分配了什么?是地图列表吗?

2) In the source code, recipientProviders is a List but what exactly is being assigned to it in the code above? Is it a list of maps?

3)emailext插件源代码在哪里定义了emailext?我在插件源代码中的所有.groovy文件中搜索了emailext,但似乎找不到类似于上面的emailext调用的内容.

3) Where is emailext defined in the email ext plugin source code? I searched for emailext in all the .groovy files in the plugin source code but can't seem to find something that looks like the emailext call above.

如果有人能对上述内容有所了解,我将不胜感激.

I would appreciate if someone could shed some light on the above, thanks.

推荐答案

1)2)大致相同:

[$class: 'DevelopersRecipientProvider']是具有键'$class'的映射文字(请注意它是字符串文字)和值'DevelopersRecipientProvider'.没什么特别的.

[$class: 'DevelopersRecipientProvider'] is a map literal with key '$class'(note it is a string literal) and value 'DevelopersRecipientProvider'. Nothing special.

关于recipientProviders: [[$class: 'DevelopersRecipientProvider']]

[[$class: 'DevelopersRecipientProvider']]是地图列表,'recipientProviders'是与'subject''body'相同的键.

[[$class: 'DevelopersRecipientProvider']]is a list of map, 'recipientProviders' is the key same as 'subject' or 'body'.

您可能会认为emailext是带有签名的方法:void emailext(Map<String, Object> map)

You may think the emailext is a method with signature: void emailext(Map<String, Object> map)

3)emailext是用Java实现的方法.您可以找到源代码

3) emailext is a method implemented in Java. You can find source code here and here.

这篇关于收件人提供者的Jenkins Pipeline emailext $ class参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆