delegate xml file to detect the latest source from snapshot cm - ant

i am about to automate nightly build using Cruisecontrol. I just need a step in which writing an xml script to help find out the latest version of snapshot found in snapshotCM. Anybody has any idea how to go about writing such a script?

If you just want to have the snapshot that was most recently created you could parse the output of
sslist -C -H -h server /path/to/project
and sort the "Create Dates:".

Related

how to email html report of Jmeter execution via Jenkins the one which we get using -e -o in command line?

I want to integrate Jmeter with Jenkins for Functional and Performance testing. (Hope Jmeter is good for Functional testing and Performance both). Have created a Freestyle project with Necessary plugins, Performance, and Editable Email ones.
I am able to generate reports in Jenkins workspace using:
sh ./jmeter.sh -n -t jmx_path -l /workspace_path/result.csv -e -o /workspace_path/htmlReport
Also, able to attach index.html file in email. But the problem is it's not accessible as css and other related files are not there.
Please help me on this. Let me know if any other info is required from my end.
Thanks in advance.
Because sending index.html only is not sufficient, you need to send content and sbadmin2-1.0.7 folders as well so instead of sending index.html file you need to send the whole htmlReport folder
You can pack it like
sh 'zip -r /path/to/htmlReport.zip /workspace_path/htmlReport'
and then send the .zip file to the recipients of your choice
An easier option would be using Taurus tool a a wrapper for your JMeter test, it has online reports feature so you will only need to share the link

Automate NewRelic dSYM upload outside Xcode?

My iOS project uses New Relic for tracking. NewRelic requires uploading a dSYM file.
https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-ios/configuration/upload-dsyms-bitcode-apps
I'd like to automate the process through Fastlane, but the provided script complains with:
./NewRelicAgent.framework/Versions/A/Resources/newrelic_postbuild.sh must be run from an XCode build
How can I execute this from within my standard deploy script? I don't want to add this as an XCode post-compile run script or upload manually through the web site.
After some research, I learned that the provided newrelic_postbuild.sh script simply zips up the dSYM folder and uploads it with a curl script.
Fastlane should already do the first part with the gym action. Just specify the output directory in your normal Fastfile build lane.
gym({output_directory: "./build")
When execute, the action above dumps out the symbol file to: ./build/HelloWorld.app.dSYM.zip
To upload that, add it to a variable and execute the following:
NEWRELIC_URL="https://mobile-symbol-upload.newrelic.com/symbol"
NEWRELIC_KEY = "ABCd3fgH1JkLmN0PqRsTuVW8Yz"
DYSM_ZIP_FILE = "./build/HelloWorld.app.dSYM.zip"
Dir.chdir("..") do
sh "curl -F dsym=#\"#{DYSM_ZIP_FILE}\" -H \"x-app-license-key: #{NEWRELIC_KEY}\" \"#{NEWRELIC_URL}\""
end
That'll do it. If you want to just do it from within a bash script, that command would be:
curl -F dsym=#"${DYSM_ZIP_FILE}" -H "x-app-license-key: ${NEWRELIC_KEY}" "${NEWRELIC_URL}"
The benefit of this approach is that we don't have to clutter our Xcode build settings with extra scripts, and we can avoid executing unnecessary and redundant scripting code.

How can I save jenkins output to file

Is anyone able to provide a way to save the jenkins output to a file that can be uploaded to s3 using shell commands and without the post-build plugin?
You can use the Curl command to get the console output to a text file and then upload the file to your nexus, in the below example ,in place of last build you can specify the specific build number for which you want the console output.
curl -L http://path-for-jenkins-JOB/lastBuild/consoleText > consoleText.txt

Trigger Jenkins Build on Perforce submit by keyword

I am wondering if anyone knows if it is possible to trigger a Jenkins build on a Perforce commit, only if it has a certain keyword in it?
My use case is that I am looking to find a way to trigger a Jenkins build that will build a Nuget package of the library I am working on, and place it in the correct Nuget server directory. I don't want to build a Nuget package each and every time I make a submit to Perforce, so I was wondering if it is possible to set up some kind of trigger to only run the Jenkins build if some keyword was included in the changelist description.
Does anyone know if this is possible, or any other possible ideas on how to implement this?
This works for me. I'm sure it could be more efficient, but it works. This looks for the string "buildit" in the changelist description.
First, create a change-submit trigger in Perforce, e.g.,
buildit change-submit //... "/usr/bin/buildthis %changelist%"
(wherever you place it should be writable, and create a file called "description" that should also be writable).
Below is the contents of the buildthis script:
#!/bin/sh
changelist="$1"
P4PORT=perforce:1666
P4CLIENT=myclient
P4USER=myuser
p4 -p $P4PORT -c $P4CLIENT -u $P4USER describe $changelist >/usr/bin/description
if grep -q buildit /usr/bin/description;
then
curl -X POST http://jenkinsserver:port/job/jobname/build?token=TOKEN
else
exit 0
fi

How to get surefire reports form Travis-CI build?

The question says it all really. How can I download or view the surefire-reports generated during a build on Travis?
You can just do
after_failure:
- cat target/surefire-reports/*.txt
Having not found a direct way to access the surefire-report files I came up with the this workaround:
In .travis.yml I added an after_failure hook:
after_failure: print_surefire_reports.sh
In the hook print_surefire_reports.sh I put:
#!/usr/bin/env sh
echo "Current directory is $(pwd)"
echo "\n=== SUREFIRE REPORTS ===\n"
for F in target/surefire-reports/*.txt
do
echo $F
cat $F
echo
done
I am using python html2text in travis after script phase.
My travis script looks like:
after_script:
- python html2text.py target/site/surefire-report.html
surefire-report.html is generated by surefire-report-plugin
See example output here: https://travis-ci.org/rmpestano/dbunit-rules/builds/160170324#L3541
Based on this bug report and this question, there is not a clean way to do this. There are, however, a couple unsupported methods of getting the reports listed in the bug report.
Those may provide options for you to look into, but the Travis CI maintainers have not provided or supported an explicit way to handle this yet. Note that those bug reports/questions are well over a year old too.
The prevailing suggestion in those threads seems to be to have Travis recommit the build artifacts back to the user's repository. This, however, requires authentication, which you probably shouldn't store in your .travis.yml file

Resources