【发布时间】:2017-02-23 16:16:27
【问题描述】:
我在 Windows Server 2012 上运行 Jenkins 2.25 服务器。目前我们正在使用 Maven 集成插件 2.12.1 和 Job DSL 插件 1.57。
我已经为我们服务器上大约 200 个现有作业编写了 DSL 脚本。
对于任何使用 Maven 的工作,无论是作为构建步骤还是作为实际的 Maven,我都遇到了一个非常令人沮丧的问题。当我运行生成的作业时,它们会失败并显示以下输出。
12:17:12 [ERROR] Failed to execute goal com.googlecode.maven-download- plugin:download-maven-plugin:1.3.0:wget (default) on project myprojecy: The parameters 'url' for goal com.googlecode.maven-download-plugin:download-maven-plugin:1.3.0:wget are missing or invalid -> [Help 1]
12:17:12 [ERROR]
12:17:12 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
12:17:12 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
12:17:12 [ERROR]
12:17:12 [ERROR] For more information about the errors and possible solutions, please read the following articles:
12:17:12 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException
最初我们认为我们发现问题在于我们缺少 XML sn-p,甚至认为这些设置看起来应该在 UI 中。
<settings class="jenkins.mvn.DefaultSettingsProvider"/>
<globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
<injectBuildVariables>false</injectBuildVariables>
所以将这个添加到脚本中:
configure { node ->
node / settings (class: 'jenkins.mvn.DefaultSettingsProvider') {
}
node / globalSettings (class: 'jenkins.mvn.DefaultGlobalSettingsProvider') {
}
node / injectBuildVariables ('false') {
}
}
但是当我尝试运行这些作业时,它们仍然失败,即使 XML 现在按预期包含这个 sn-p。
现在有两个我无法解决的非常奇怪的事情,它们显然是相关的。首先,在作业失败后,如果我手动为作业选择“配置”,然后保存它(即不进行任何实际更改),作业将永远运行良好(直到我们运行种子作业然后它再次失败)。
其次,在我运行种子作业后的作业配置历史记录中,我看到了在系统用户下运行种子作业时所做的更改。然而,在几秒钟内,每次,我的用户名下都会记录另一个配置更改,尽管事实上我没有对作业配置进行任何更改 - 顺便说一下,这与我保存作业而不进行更改无关,它立即发生。
我应该补充一点,进一步的检查表明,Maven 的一些默认设置并未应用于我的 DSL 生成的作业。将 -X 开关添加到 Maven 目标时,我可以看到有关这些作业在哪里失败的更多信息。输出是:
15:06:31 [DEBUG] Goal: com.googlecode.maven-download-plugin:download-maven-plugin:1.3.0:wget (default)
15:06:31 [DEBUG] Style: Regular
15:06:31 [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
15:06:31 <configuration>
15:06:31 <cacheDirectory>${download.cache.directory}</cacheDirectory>
15:06:31 <checkSignature default-value="false">${checkSignature}</checkSignature>
15:06:31 <failOnError default-value="true"/>
15:06:31 <outputDirectory default-value="${project.build.directory}">D:\data\jenkins\workspace\project\target</outputDirectory>
15:06:31 <outputFileName>${jarsigner.keystore.filename}</outputFileName>
15:06:31 <overwrite>${download.overwrite}</overwrite>
15:06:31 <readTimeOut default-value="0"/>
15:06:31 <retries default-value="2"/>
15:06:31 <session>${session}</session>
15:06:31 <skip default-value="false">${download.plugin.skip}</skip>
15:06:31 <skipCache default-value="false"/>
15:06:31 <unpack default-value="false">false</unpack>
15:06:31 <url>${jarsigner.keystore.url}</url>
15:06:31 </configuration>
在成功运行作业(发布虚假配置更改)时,其中一些字段已满,例如密钥库的 URL。这显然是问题所在,但我不知道该怎么办。据我所知,这应该通过在 groovy 中包含上面的配置块来解决,但不知何故我的工作缺少这个(但他们在再次保存工作后没有任何更改)。
谁能看到我在这里做错了什么?
【问题讨论】:
标签: jenkins maven-3 jenkins-job-dsl