jenkins-plugins - 有没有办法使用 DSL groovy 脚本勾选“使用全局 Veracode 用户凭据”复选框?
问题描述
我正在使用 DSL Groovy 脚本创建 Jenkins 作业以添加 Veracode 插件。我正在寻找一种方法来勾选“使用全局 Veracode 用户凭据”复选框。
它适用于我拥有的代码并添加了复选框,但没有为我检查它并正在寻找凭据。我想使用全局凭据。我已将其添加到发布者块下。正如您在我的代码中看到的那样,在凭据部分下,我将凭据留空,因为我不想指定其中任何一个。单击“使用全局 Veracode 用户凭据”复选框,省略这些参数并使用管理 jenkins 下指定的全局参数。
我的问题是如何使用脚本勾选此复选框。
publishers {
//extendedEmail Utilities.getExtendedEmail("Scan_Services", false, false)
extendedEmail Utilities.getExtendedEmailRequester("Scan_Services", false, false)
veracodeNotifier {
// Enter the name of the application.
appname("xDistributor")
// Enter the business criticality for the application.
criticality("Very High")
// Enter a name for the static scan you want to submit to the Veracode Platform for this application.
version("$BUILD_TIMESTAMP" + " Services_Scan")
// Enter the filepaths of the files to upload for scanning, represented as a comma-separated list of ant-style include patterns relative to the job's workspace root directory.
uploadincludespattern("**/Services/webapps/services.war")
createprofile(false)
sandboxname("")
createsandbox(false)
filenamepattern("")
replacementpattern("")
uploadexcludespattern("")
scanincludespattern("")
scanexcludespattern("")
waitForScan(false)
timeout("")
credentials {
vapicredential("")
vuser("")
vpassword("")
}
}
}
解决方案
我无法从 Veracode 找到任何关于此的文档,所以我最终不得不反编译插件来解决这个问题。这可以通过将凭证对象设置为空值来实现。
job('job-name') {
publishers {
veracodeNotifier {
credentials(null)
}
}
}
其工作方式是 Veracode 插件的配置设置不检查字段的值,而是检查凭证对象是否为空,以及是否设置了全局凭证。
推荐阅读
- javascript - 在特定索引处合并两个数组
- azure-data-factory - 将 Azure 数据工厂连接到 SAP BW
- go - 为什么不能在赋值中使用 (type func(string)) 作为类型 func(interface{})
- jenkins - Jenkins hudson.TcpSlaveAgentListener$ConnectionHandler 运行连接失败
- apache-flink - Flink 中 KeyedBroadcastProcessFunction 的键控状态如何管理?
- javascript - 如何正确让我的按钮执行我的 javascript?
- firebase - 使用动态名称创建新的 Firebase 存储桶
- excel - 将超链接(Web)添加到 Outlook 电子邮件
- linux - LFS CoreUtils-8.30 失败,缺少 aclocal-1.15
- excel - Excel VBA - 集合 = 没有什么比创建集合要长 100 倍