Do you know of a way / a plug-in to better separate different build steps in Jenkins projects?
I used to work with Quickbuild and there I can give a name to each step and in the log I can see which step is currently running.
I have a project that invokes several ant scripts and on failures, I want to catch the exact execution that caused it (so I want to somehow see the step name in the logger).
Thanks,
Or.
you can add echo " ---- step N ---- " at the start of each step :)
If you use the ant builder, instead of "exec a shell script"/"exec a batch file", it records each ant task as it is run.
Related
I have two Bamboo plans, the first one produces a shared artifact (a library) and the second one attempts to download it. The first plan puts the build number into the artifact name, the copy pattern is defined this way:
release-x64-b${bamboo.buildNumber}-runtime.zip
So I get a number of artifacts in the plan directory:
release-x64-b671-runtime.zip
....
release-x64-b678-runtime.zip
The dependent plan is instructed to simply download the artifact. I think it's using the copy pattern from the parent plan because I'm running into an issue where the dependent plan is substituting its own build number when downloading the artifact, here's a log excerpt:
Preparing to download plan result PROJECT-WVN-678 artifact: Shared artifact: [x64 Nightly Runtime], pattern: [release-x64-b207-runtime.zip]
(The dependent build number is 207 while the parent build number is 678). Is there a way for me to work around this 'feature'?
I hope if you have a dependent plan, then it is a subsequent stage. So, in the parent build you can save the build number in mvn_version using powershell script.
$buildnum=$env:bamboo_buildNumber
Then put the value into a text file
echo "`nmvn_version=$buildnum" | out-file -encoding utf8 mvn_version.txt
Then add a task, inject bamboo variables, where you can set the path of file ./mvn_version.txt and namespace as inject. Choose the radio button as result, so the value will be subsequently accessible in following stages/dependent plans and release plan also.
Usually certain Grunt tasks have the option to "fail on warning", making it possible to put it as a step in your build process.
I am looking at JSBeautifier but it seems like there is no option.
Any suggestions on how we can make our build fail, if a JavaScript file gets formatted by JSBeautifier a build step?
If mode is "VERIFY_ONLY", then task will fail if at least one file can
be beautified. This is useful for pre-commit check.
https://www.npmjs.com/package/grunt-jsbeautifier#options-mode-optional
I am using Jenkins (v1.592) with Git Client Plugin (v1.12.0) and Git Plugin (v2.3).
I have a build-job that has to be triggered if there have been changes in my git-repository if the changes are made NOT in origin/master or origin/name branches, while N is a decimal number.
I was very happy to see, that Jenkins allowes regular expressions as a branch-specifier at the "Branches to build" option.
But unfortunately I do not get my expression to work correctly:
My expression is:
:master|name(\d+)
I also activated "Strategy for choosing what to build" with option "Inverse".
When I am now pushing something onto my master-build it will be selected and the build starts.
I am using "Poll SCM" with no schedule and trigger a build with a call to the Jenkins notifyCommit URL.
I also tried to use: (?!(origin/master|origin/name\d+)) as regex without inverse option but get an error here.
Okay, I found an answer, but not by finding a solution for the regex.
I recently saw, that I am able to specify more than one branch with the "Add Branch" function - until few minutes ago I was blind to see the "Add Branch" button.
By specifiying two branches and activating the inverse function it works.
My two branch names are: master and name* (* for the Wildcard operator).
Thanks for your help!
I'd like to shelve old builds in all of my jobs for example
build numbers 1-10
I'm wondering if there is way to do that from the jenkins UI using a single command.
First of all in order to make changes to a bulk of jobs of I would use something called configuration slicer.
you can get to that from here: https://wiki.jenkins-ci.org/display/JENKINS/Configuration+Slicing+Plugin
Also you want to delete your build? or archive them?! in case of deleting I would use the Log rotation eaither by date or number of builds. In the configure section of the job click on Discard old build and you will see the options.
and finally you can always use Artifact deployer and somether examples from that plug in.
Link Here: https://wiki.jenkins-ci.org/display/JENKINS/ArtifactDeployer+Plugin
Link on how to use the CLI in Jenkins : https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
EDIT 1
In regards to the comments below where you are asking about "Shelving Jobs" .
I think the phrase you are looking for here is "archive" and not shelving - that is a very Visual Studio/TFS concept - so I am not personally aware of any anything that does SHELVING per say.
In terms of Groovy script I believe that you are now asking a different question and so this should be raised specifically as different question - but as far as groovy script go you can use the following link as an intro :
http://groovy.codehaus.org/
We have managed to have Jenkins correctly parse our XML output from our tests and also included the error information, when there is one. So that it is possible to see, directly in the TestCase in Jenkins the error that occurred.
What we would like to do is to have Jenkins keep a log output, which is basically the console output, associated with each case. This would enable anyone to see the actual console output of each test case, failed or not.
I haven't seen a way to do this.
* EDIT *
Clarification - I want to be able to see the actual test output directly in the Jenkins interface, the same way it does when there is an error, but for the whole output. I don't want only Jenkins to keep the file as artifact.
* END OF EDIT *
Anyone can help us on this?
In the Publish JUnit test result report (Post-build Actions) tick the Retain long standard output/error checkbox.
If checked, any standard output or error from a test suite will be
retained in the test results after the build completes. (This refers
only to additional messages printed to console, not to a failure stack
trace.) Such output is always kept if the test failed, but by default
lengthy output from passing tests is truncated to save space. Check
this option if you need to see every log message from even passing
tests, but beware that Jenkins's memory consumption can substantially
increase as a result, even if you never look at the test results!
This is simple to do - just ensure that the output file is included in the list of artifacts for that job and it will be archived according to the configuration for that job.
Not sure if you have solve it yet, but I just did something similar using Android and Jenkins.
What I did was using the http://code.google.com/p/the-missing-android-xml-junit-test-runner/ to run the tests in the Android emulator. This will create the necessary JUnit formatted XML files, on the emulator file system.
Afterwards, simply use 'adb pull' to copy the file over, and configure the Jenkin to parse the results. You can also artifact the XML files if necessary.
If you simply want to display the content of the result in the log, you can use 'Execute Shell' command to print it out to the console, where it will be captured in the log file.
Since Jenkins 1.386 there was a change mentioned to Retain long standard output/error in each build configuration. So you just have to check the checkbox in the post-build actions.
http://hudson-ci.org/changelog.html#v1.386
When using a declarative pipeline, you can do it like so:
junit testResults: '**/build/test-results/*/*.xml', keepLongStdio: true
See the documentation:
If checked, the default behavior of failing a build on missing test result files or empty test results is changed to not affect the status of the build. Please note that this setting make it harder to spot misconfigured jobs or build failures where the test tool does not exit with an error code when not producing test report files.