Zen Timestamp Plugin does not work for me with Matrix builds on Windows when the overriding format is specified at the job level - the default format is retained both in build steps and post build actions. It works fine with regular builds and with matrix builds when the format is overridden at the system level.
Anybody can suggest a good workaround?
Just in case: Jenkins v1.442, Zen Plugin v3.0; here is config.xml for a test build:
<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>
And here's the console output:
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
The output should be 20120201122612 - which it is for the similar non-matrix build.
Was a bug in the plugin. Fixed in Release 3.2 (March 10, 2012). I've tested it and it works fine.
Related
I'm experiencing problems while building my Codename One project for Windows Phone.
I've had 3 attempts: 2 failed and 1 was stuck on a build phase for more than an hour and I decided to cancel it.
I've downloaded error logs for both failed attempts (files were more than 60M and I've noticed it too late, so sorry for using your server's bandwidth). Here is the extract (files sizes are more than 60M) from the last error log (2f361a99-589d-4e29-9e6d-14d22b1cacc3-1453240937030-error.txt/Tue Jan 19 2016 23:46:42 GMT+0200 (FLE Standard Time)):
Executing: java -Xmx1024m -jar win_xmlvm.jar --in=C:\Users\Shai\AppData\Local\Temp\build6825805865501307423xxx\classes --resource=C:\Users\Shai\AppData\Local\Temp\build6825805865501307423xxx\ApplicationCN1\ApplicationCN1\res/ --out=C:\Users\Shai\AppData\Local\Temp\build6825805865501307423xxx\ApplicationCN1\ApplicationCN1\src --target=csharp --app-name=ApplicationCN1 [01/19/16 23:47:19.038] ERROR: Couldn't create node for com.codename1.impl.ImplementationFactory
[01/19/16 23:47:19.038] ERROR: Couldn't create node for com.codename1.impl.ImplementationFactory
...classes...
...lots of warnings about hidden inherited members...
"C:\Users\Shai\AppData\Local\Temp\build6825805865501307423xxx\ApplicationCN1\ApplicationCN1.sln" (default target) (1) ->
"C:\Users\Shai\AppData\Local\Temp\build6825805865501307423xxx\ApplicationCN1\ApplicationCN1\ApplicationCN1.csproj" (default target) (2) ->
(CoreCompile target) ->
src\com\yyy\yyy\DialogForm.cs(1133,5): error CS1511: Keyword 'base' is not available in a static method [C:\Users\Shai\AppData\Local\Temp\build6825805865501307423xxx\ApplicationCN1\ApplicationCN1\ApplicationCN1.csproj]
130875 Warning(s)
1 Error(s)
Time Elapsed 00:07:44.77
My configuration:
Windows 7 SP1 x64;
Java SE Development Kit 7 Update 45 (64-bit);
Eclipse IDE for Java Developers, Version: Luna Service Release 2 (4.4.2), Build id: 20150219-0600;
Plugin: CodenameOneFeature 1.0.0.201511241324;
Contents of my codenameone_settings.properties:
#
#Mon Jan 18 16:05:13 EET 2016
codename1.vendor=yyy
codename1.displayName=yyy
codename1.icon=icon.png
codename1.languageLevel=5
codename1.secondaryTitle=yyy
codename1.version=0.4
codename1.mainName=ApplicationCN1
codename1.ios.certificatePassword=
codename1.rim.signtoolDb=
libVersion=97
codename1.ios.certificate=
codename1.arg.j2me.nativeThemeConst=3
codename1.arg.ios.add_libs=CFNetwork.framework
codename1.arg.android.debug=false
codename1.arg.android.release=true
codename1.j2me.nativeTheme=
codename1.rim.signtoolCsk=
codename1.rim.certificatePassword=
codename1.ios.provision=
codename1.packageName=com.yyy.yyy
What am I doing wrong?
You probably have a field or method named base and our old XMLVM based backend isn't smart enough to deal with that (reserved word in C#).
Just rename that for now and also look at the project size.
We are currently working on a rewrite of the Windows Phone VM/port so this and many other issues won't exist when we are done. Since its almost a complete rewrite (we will probably base it in part on the community port) this might take a while to deliver.
What do I need to add to the default html_gmail.jelly script to have it show the classes that were tested including how many tests were ran within each class?
When a Jenkins job is complete you can drill down to the Junit Test Results in an address that looks like:
http://somecompany.jenkins.com/view/App_Automation/job/Application_Under_Test/129/testReport/com.AUT.testing.mobile/
The test results are generated by the build.xml so is it just a matter of pointing to that xml file?
The email-ext page shows a clean example but not the tokens that are used to achieve that: http://wiki.hudson-ci.org/download/attachments/3604514/html.jpg
Currently using the ${FAILED_TESTS} token generates a nice Tested; Failed; Skipped number, but nothing that points to which tests passed/failed/skipped. I would like to show the total number of tests including which tests were actually ran.
Thanks ahead of time
OK I figured out how to display the pass and failed methods by adding var=pass or var=fail to the token of those assignments.
First go to the Jelly script in the this path:
~/.hudson/plugins/email-ext/WEB-INF/classes/hudson/plugins/emailext/templates/automation.jelly
$DEFAULT_SUBJECT (${build.testResultAction?.failCount} ${build.testResultAction?.failureDiffString})
SETTING UP THE CONFIG IN JENKINS
DEFAULT SUBJECT:
$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
DEFAULT CONTENT:
$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
Check console output at $BUILD_URL to view the results.
Changes:
${CHANGES}
Changes Since Last Success
${CHANGES_SINCE_LAST_SUCCESS}
Failed Tests:
${FAILED_TESTS}
Build Log:
${BUILD_LOG}
Total Amount of Tests:
${TEST_COUNTS, var}
Total = $TEST_COUNTS
Failed = ${TEST_COUNTS,var="fail"}
Total = $TEST_COUNTS
Passed = ${TEST_COUNTS,var="pass"}
Job Description:
${JOB_DESCRIPTION}
Place this in the email job
${JELLY_SCRIPT,template="html-with-health-and-console"}
Note the templates available are noted in the path ~/.hudson/plugins/email-ext/WEB-INF/classes/hudson/plugins/emailext/templates/automation.jelly or create your own.
I have recently upgraded PrimeFaces from 3.4 to 3.4.2 because of performance bug in PickList component. After this upgrade my Wizard components have stopped to function.
I'm using custom buttons for navigations, using widgetVar, next() and prev() as defined by users guide 3.4.
<p:wizard widgetVar="wiz" flowListener="#{wizard.onFlowProcess}"
showStepStatus="false" showNavBar="false">
<p:commandButton value="Weiter" onclick="wiz.next()" update="dialogRespHeader">
This was working in version 3.4. After update after clicking on the button, the waitprogress animation is displayed and nothing more happens, no matter how long I wait. There is no hanging request to server: the request is sent immediately after clicking the button and the response comes also after the moment. It looks correct:
<partial-response>
<changes>
<update id="mainForm:j_id1831660928_7d431f69"> [some content]
<extension ln="primefaces" type="args">{"currentStep":"internUserTab"}</extension>
<extension ln="primefaces" type="args">{"currentStep":"internUserTab"}</extension>
</changes>
</partial-response>
So the question is: What have changed between this versions? Is this a bug, or maybe the API change (I can't find any info about api changes for this component).
update
FireBug console shows error:
SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data
Can it be an error in jQuery 1.8.2? This is the greatest and the most dangerous change between those versions.
It's a bug in PrimeFaces with caching resources by browser.
The version of jQuery has changed, but the name of the resource was left unchanged, therefore browser will load old version of jQuery from cache, until you clear your cache.
Replicated multiple time with migration from 3.4 to 3.5. Happened in all cases with various components, the only way to get rid of it is to send info to all users with instructions to clean the browser cache.
How to include pom version number into Jenkins e-mail notification?
This is to notify test team about a sucessful build and the build version. For now, we can only send a generic e-mail without any useful content in it.
I have tried the following but none of those sucess.
grep and export in a post build step but I can't pass that into the e-mail notification plugin
(.*) annotation but it dosen't work for the plugin.
Anyone have any idea?
You may use Extended Email Notification plugin that can parse your build log using regular expressions.
When you install the plugin you first configure its default behavior on the main Jenkins configuration page. Then you customize it per job: go to Post-Build Actions and check 'Editable Email Notification' box. Use 'Content Token Reference' help button to get the tokens you may use. Among them will be BUILD_LOG_REGEX token with the explanation on its usage.
So what you may do is to output your POM via the build log in some easily parseable form and then parse it out using BUILD_LOG_REGEX into your e-mail.
Here's an actual test build (for Windows) that echoes boo_$BUILD_ID_foo line to the output, the plugin parses out that line and sends an email that looks like this:
Here we go, Joe:
boo_2012-01-30_23-04-29_foo
config.xml for the job:
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.BatchFile>
<command>echo boo_%BUILD_ID%_foo
</command>
</hudson.tasks.BatchFile>
</builders>
<publishers>
<hudson.plugins.emailext.ExtendedEmailPublisher>
<recipientList>youemail#company.com</recipientList>
<configuredTriggers>
<hudson.plugins.emailext.plugins.trigger.FailureTrigger>
<email>
<recipientList></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.FailureTrigger>
<hudson.plugins.emailext.plugins.trigger.SuccessTrigger>
<email>
<recipientList></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>text/plain</contentType>
<defaultSubject>$DEFAULT_SUBJECT</defaultSubject>
<defaultContent>Here we go, Joe:
${BUILD_LOG_REGEX, regex="^boo.*?foo.*?$",showTruncatedLines=false}
</defaultContent>
</hudson.plugins.emailext.ExtendedEmailPublisher>
</publishers>
<buildWrappers/>
</project>
Just use the following property:
${POM_VERSION}
Is there an API to determine whether a given job is currently running or not?
Ideally, I'd also like to be able to determine its estimated % complete and get the details of the SVN revision number and commit comment too!
EDIT:
I found the answer. http://host/job/project/lastBuild/api/ has almost all of what I need in it somewhere! If you kick off a manual build, it won't tell you the SCM changesets, but that makes sense. It does still tell you the latest SCM revision though, so that's good. All in all, good enough for my purposes right now.
As gareth_bowles and Sagar said, using the Jenkins API is the way to know.
If you put the depth to 1, you will see what you're looking for:
http://host/job/project/lastBuild/api/xml?depth=1
You will see there's a <building> tag to tell if that build is running
...
<build>
<action>
<cause>
<shortDescription>Started by user Zageyiff</shortDescription>
<userId>Zageyiff</userId>
<userName>Zageyiff</userName>
</cause>
</action>
<building>true</building>
<duration>0</duration>
<estimatedDuration>-1</estimatedDuration>
<fullDisplayName>Project #12</fullDisplayName>
<id>2012-08-24_08-58-45</id>
<keepLog>false</keepLog>
<number>12</number>
<timestamp>123456789</timestamp>
<url>
http://host/job/project/12
</url>
<builtOn>master</builtOn>
<changeSet/>
<mavenVersionUsed>3.0.3</mavenVersionUsed>
</build>
...
I'm using the Groovy plug-in, and run the following snippet as system:
import hudson.model.*
def version = build.buildVariableResolver.resolve("VERSION")
println "VERSION=$version"
def nextJobName = 'MY_NEXT_JOB'
def nextJob = Hudson.instance.getItem(nextJobName)
def running = nextJob.lastBuild.building
if (running) {
println "${nextJobName} is already running. Not launching"
} else {
println "${nextJobName} is not running. Launching..."
def params = [
new StringParameterValue('VERSION', version)
]
nextJob.scheduleBuild2(0, new Cause.UpstreamCause(build), new ParametersAction(params))
}
It works like a charm.
If you go to your job's page, and add "api" to the end of the URL, you'll get information on using the API.
http://yourjenkins/job/job_name/api
More information on using the Jenkins API:
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
If you're comfortable with digging through the Jenkins Java API, you could write a system Groovy script to get this data. The Job class is the place to start.
As stated on the /api page of your build (chapter "Accessing Progressive Console Output"), you can poll the console output with a GET request by calling <url-to-job>/lastBuild/logText/progressiveText. To quote the API doc:
If the response also contains the X-More-Data: true header, the server is indicating that the build is in progress
And there you go. You can test this behaviour by simply calling the respective URL in your browser and then inspecting the response headers with your browser's developer tools (usually accessed by pressing F12). In Firefox, the respective tab is called "network analysis" (assuming my translation is correct, my browser is not set to English). In Chrome, navigate to the "Network" tab.
This answer is based on Jenkins version 2.176.3.
It is also possible to look at the color attribute. I know it is not the wanted way. But maybe someone can make use of it.
get the overview xml via "/job/api/xml" and then check the color attribute for "anim".