Jenkins Pipeline emailext $class 参数用于recipientProviders [英] Jenkins Pipeline emailext $class parameter for recipientProviders

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

问题描述

我一直在尝试了解下面的管道常规代码:

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 在 email ext 插件源代码中定义在哪里?我在插件源代码的所有 .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) 大致相同:

1) 2) is about the same things:

[$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 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 参数用于recipientProviders的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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