Author: nickboldt
Date: 2011-06-10 21:00:17 -0400 (Fri, 10 Jun 2011)
New Revision: 32038
Modified:
trunk/build/publish.sh
Log:
improve checking for git/svn source style - can't pull config.xml w/o first logging
in
Modified: trunk/build/publish.sh
===================================================================
--- trunk/build/publish.sh 2011-06-11 01:00:00 UTC (rev 32037)
+++ trunk/build/publish.sh 2011-06-11 01:00:17 UTC (rev 32038)
@@ -56,22 +56,25 @@
rm -f ${bl}; wget -q
http://hudson.qa.jboss.com/hudson/job/${JOB_NAME}/${BUILD_NUMBER}/console... -O ${bl}
--timeout=900 --wait=10 --random-wait --tries=10 --retry-connrefused
--no-check-certificate
# JBDS-1361 - fetch XML and then sed it into plain text
-rl=${STAGINGDIR}/logs/SVN_REVISION
-rm -f ${rl}.txt ${rl}.xml; wget -O ${rl}.xml
"http://hudson.qa.jboss.com/hudson/job/${JOB_NAME}/api/xml?wrapper=changeSet&depth=1&xpath=//build[1]/changeSet/revision"
--timeout=900 --wait=10 --random-wait --tries=30 --retry-connrefused
--no-check-certificate --server-response
-if [[ $? -gt 0 ]]; then
- rm -f ${rl}.txt ${rl}.xml; wget -O ${rl}.xml
"http://hudson.qa.jboss.com/hudson/job/${JOB_NAME}/config.xml" --timeout=900
--wait=10 --random-wait --tries=30 --retry-connrefused --no-check-certificate
--server-response
- if [[ $(cat ${rl}.xml | grep "git") ]]; then
- echo "GIT Sources" > ${rl}.txt
- rm -f ${rl}.txt ${rl}.xml
- # Now, track git source revision through hudson api:
/job/${JOB_NAME}/${BUILD_NUMBER}/api/xml?xpath=//lastBuiltRevision
- rl=${STAGINGDIR}/logs/GIT_REVISION
- wget -O ${rl}.xml
"http://hudson.qa.jboss.com/hudson/job/${JOB_NAME}/${BUILD_NUMBER}/api/xml?xpath=//lastBuiltRevision"
--timeout=900 --wait=10 --random-wait --tries=30 --retry-connrefused
--no-check-certificate --server-response
- sed -e
"s#<lastBuiltRevision><SHA1>\([a-f0-9]\+\)</SHA1><branch><SHA1>\([a-f0-9]\+\)</SHA1><name>\([^<>]\+\)</name></branch></lastBuiltRevision>#\3\@\1#g"
${rl}.xml | sed -e "s#<[^<>]\+>##g" > ${rl}.txt
+wgetParams="--timeout=900 --wait=10 --random-wait --tries=30 --retry-connrefused
--no-check-certificate --server-response"
+rl=${STAGINGDIR}/logs/REVISION
+if [[ $(find ${WORKSPACE} -mindepth 2 -maxdepth 3 -name ".svn") ]]; then
+ # Track git source revision through hudson api:
/job/${JOB_NAME}/${BUILD_NUMBER}/api/xml?xpath=//lastBuiltRevision
+ rl=${STAGINGDIR}/logs/GIT_REVISION
+ rm -f ${rl}.txt ${rl}.xml; wget -O ${rl}.xml
"http://hudson.qa.jboss.com/hudson/job/${JOB_NAME}/${BUILD_NUMBER}/api/xml?xpath=//lastBuiltRevision"
${wgetParams}
+ sed -e
"s#<lastBuiltRevision><SHA1>\([a-f0-9]\+\)</SHA1><branch><SHA1>\([a-f0-9]\+\)</SHA1><name>\([^<>]\+\)</name></branch></lastBuiltRevision>#\3\@\1#g"
${rl}.xml | sed -e "s#<[^<>]\+>##g" > ${rl}.txt
+elif [[ $(find ${WORKSPACE} -mindepth 2 -maxdepth 3 -name ".svn") ]]; then
+ # Track svn source revision through hudson api:
/job/${JOB_NAME}/api/xml?wrapper=changeSet&depth=1&xpath=//build[1]/changeSet/revision
+ rl=${STAGINGDIR}/logs/SVN_REVISION
+ rm -f ${rl}.txt ${rl}.xml; wget -O ${rl}.xml
"http://hudson.qa.jboss.com/hudson/job/${JOB_NAME}/api/xml?wrapper=changeSet&depth=1&xpath=//build[1]/changeSet/revision"
${wgetParams}
+ if [[ $? -eq 0 ]]; then
+ sed -e
"s#<module>\(http[^<>]\+\)</module><revision>\([0-9]\+\)</revision>#\1\@\2\n#g"
${rl}.xml | sed -e "s#<[^<>]\+>##g" > ${rl}.txt
else
- echo "UNKNOWN" > ${rl}.txt
+ echo "UNKNOWN SVN REVISION(S)" > ${rl}.txt
fi
else
- sed -e
"s#<module>\(http[^<>]\+\)</module><revision>\([0-9]\+\)</revision>#\1\@\2\n#g"
${rl}.xml | sed -e "s#<[^<>]\+>##g" > ${rl}.txt
+ # not git or svn... unsupported
+ echo "UNKNOWN REVISION(S)" > ${rl}.txt
fi
METAFILE="${BUILD_ID}-H${BUILD_NUMBER}.txt"