这是我的配置块,用于生成动态参数。但它没有用。有人可以帮忙吗?
private Microsoft.Office.Interop.Excel._Application excel;//excel application that is used for creating excel workbooks(files)
private Microsoft.Office.Interop.Excel._Workbook workbook;//excel workbook(file)
private Microsoft.Office.Interop.Excel._Worksheet worksheet;
excel = new Microsoft.Office.Interop.Excel.Application();
workbook = excel.Workbooks.Add();
worksheet = workbook.ActiveSheet;
workbook.Close();
excel.Quit();
GC.Collect();
GC.WaitForPendingFinalizers();
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(worksheet);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(workbook);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excel);
worksheet = null;
workbook = null;
excel = null;
答案 0 :(得分:0)
简答:不要再使用插件了,只需使用普通的groovy代码和默认的jenkins参数
完整答案:请查看此答案https://stackoverflow.com/a/42230455/4486169
答案 1 :(得分:0)
这个问题的答案没有用,所以这里有一个StringParameterDefinition示例(如果您使用的是Scriptler替换,只需用sriptler.ScriptlerStringParameterDefinition替换),您可以通过打开已配置的作业xml找到节点名称:
configure { root ->
def paramDefs = root / 'properties' / 'hudson.model.ParametersDefinitionProperty' / 'parameterDefinitions'
paramDefs << 'com.seitenbau.jenkins.plugins.dynamicparameter.StringParameterDefinition' {
delegate.createNode('name', 'FirstParam')
delegate.createNode('__script', 'someScriptString')
__localBaseDirectory(serialization: 'custom') {
'hudson.FilePath' {
'default' {
delegate.createNode('remote', "${JENKINS_HOME}/dynamic_parameter/classpath")
}
delegate.createNode('boolean', true)
}
}
delegate.createNode('__remoteBaseDirectory', 'dynamic_parameter_classpath')
delegate.createNode('__classPath', '')
}
paramDefs << 'com.seitenbau.jenkins.plugins.dynamicparameter.StringParameterDefinition' {
delegate.createNode('name', 'SecondParam')
delegate.createNode('__script', 'someScriptString')
__localBaseDirectory(serialization: 'custom') {
'hudson.FilePath' {
'default' {
delegate.createNode('remote', "${JENKINS_HOME}/dynamic_parameter/classpath")
}
delegate.createNode('boolean', true)
}
}
delegate.createNode('__remoteBaseDirectory', 'dynamic_parameter_classpath')
delegate.createNode('__classPath', '')
}
...
}