【发布时间】:2012-02-01 10:49:15
【问题描述】:
Zen Timestamp Plugin 在作业级别指定覆盖格式时不适用于 Windows 上的 Matrix 构建 - 默认格式在构建步骤和构建后操作中均保留。当格式在系统级别被覆盖时,它适用于常规构建和矩阵构建。
任何人都可以提出一个好的解决方法吗?
以防万一:Jenkins v1.442、Zen Plugin v3.0;这是用于测试构建的 config.xml:
<matrix-project>
<actions/>
<description/>
<logRotator>
<daysToKeep>-1</daysToKeep>
<numToKeep>2</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</logRotator>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.plugins.zentimestamp.ZenTimestampJobProperty>
<changeBUILDID>true</changeBUILDID>
<pattern>yyyyMMddHHmmss</pattern>
</hudson.plugins.zentimestamp.ZenTimestampJobProperty>
</properties>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<axes>
<hudson.matrix.LabelAxis>
<name>label</name>
<values>
<string>Master</string>
</values>
</hudson.matrix.LabelAxis>
</axes>
<builders>
<hudson.tasks.BatchFile>
<command>echo %BUILD_ID%</command>
</hudson.tasks.BatchFile>
</builders>
<publishers>
<hudson.plugins.emailext.ExtendedEmailPublisher>
<recipientList>myname@mycompany.com</recipientList>
<configuredTriggers>
<hudson.plugins.emailext.plugins.trigger.SuccessTrigger>
<email>
<recipientList/>
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
<body>$PROJECT_DEFAULT_CONTENT</body>
<sendToDevelopers>false</sendToDevelopers>
<includeCulprits>false</includeCulprits>
<sendToRecipientList>true</sendToRecipientList>
</email>
</hudson.plugins.emailext.plugins.trigger.SuccessTrigger>
</configuredTriggers>
<contentType>default</contentType>
<defaultSubject>$DEFAULT_SUBJECT</defaultSubject>
<defaultContent>BUILD_ID is ${ENV, var="BUILD_ID"}</defaultContent>
</hudson.plugins.emailext.ExtendedEmailPublisher>
</publishers>
<buildWrappers/>
<runSequentially>false</runSequentially>
</matrix-project>
这是控制台输出:
Started by upstream project "test Zen plugin matrix" build number 5
Building on master
No emails were triggered.
[Master] $ cmd /c call C:\DOCUME~1\hotbuild\LOCALS~1\Temp\hudson1252624466863059206.bat
C:\Documents and Settings\hotbuild\.jenkins\jobs\test Zen plugin matrix\workspace\label\Master>echo 2012-02-01_12-26-12
2012-02-01_12-26-12
C:\Documents and Settings\hotbuild\.jenkins\jobs\test Zen plugin matrix\workspace\label\Master>exit 0
Email was triggered for: Success
Sending email for trigger: Success
Sending email to: myname@mycompany.com
Finished: SUCCESS
输出应该是20120201122612 - 它用于类似的非矩阵构建。
【问题讨论】:
-
这是一个我不喜欢的解决方案:创建一个常规上游作业,将其格式化的 BUILD_ID 作为参数传递给矩阵作业。这是一个糟糕的解决方法的主要原因是因为这样我得到了上游构建的 BUILD_ID(而不是我的真实构建);第二个原因是因为它增加了不必要的工作——矩阵构建要解决的问题之一。