$search
00001 #!/usr/bin/python 00002 00003 00004 00005 # template to create openni hudson configuration file 00006 HUDSON_OPENNI_CONFIG = """<?xml version='1.0' encoding='UTF-8'?> 00007 <project> 00008 <description>Openni build of NAME on UBUNTUDISTRO, ARCH</description> 00009 <logRotator> 00010 <daysToKeep>5</daysToKeep> 00011 <numToKeep>-1</numToKeep> 00012 </logRotator> 00013 <keepDependencies>false</keepDependencies> 00014 <properties> 00015 <hudson.plugins.trac.TracProjectProperty> 00016 <tracWebsite>http://code.ros.org/trac/ros/</tracWebsite> 00017 </hudson.plugins.trac.TracProjectProperty> 00018 </properties> 00019 <assignedNode>hudson-devel</assignedNode> 00020 <canRoam>false</canRoam> 00021 <disabled>false</disabled> 00022 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> 00023 <triggers class="vector"> 00024 <hudson.triggers.SCMTrigger> 00025 <spec>TIME_TRIGGER</spec> 00026 </hudson.triggers.SCMTrigger> 00027 </triggers> 00028 <concurrentBuild>false</concurrentBuild> 00029 <builders> 00030 <hudson.tasks.Shell> 00031 <command>cat > $WORKSPACE/script.sh <<DELIM 00032 #!/usr/bin/env bash 00033 set -o errexit 00034 echo "_________________________________BEGIN SCRIPT______________________________________" 00035 00036 cd /tmp/ # not /tmp/ros to avoid 00037 hg clone https://kforge.ros.org/openni/drivers 00038 00039 cd drivers 00040 00041 #./run_chroot.py --arch=ARCH --distro=UBUNTUDISTRO --workspace . --script local_script.bash --ramdisk 00042 ./local_script.bash 00043 00044 #move output into workspace 00045 cp -r UBUNTUDISTRO /tmp/ros 00046 cp add_debs.py /tmp/ros 00047 00048 echo "_________________________________END SCRIPT_______________________________________" 00049 DELIM 00050 00051 set -o errexit 00052 00053 rm -rf $WORKSPACE/test_results 00054 rm -rf $WORKSPACE/test_output 00055 00056 wget --no-check-certificate https://code.ros.org/svn/ros/stacks/ros_release/trunk/hudson/scripts/run_chroot.py -O $WORKSPACE/run_chroot.py 00057 chmod +x $WORKSPACE/run_chroot.py 00058 cd $WORKSPACE && $WORKSPACE/run_chroot.py --distro=UBUNTUDISTRO --arch=ARCH --ramdisk --script=$WORKSPACE/script.sh --ssh-key-file=/home/rosbuild/rosbuild-ssh.tar 00059 00060 00061 echo "copying debians to server" 00062 00063 scp -r $WORKSPACE/UBUNTUDISTRO rosbuild@pub8:/tmp/ 00064 scp $WORKSPACE/add_debs.py rosbuild@pub8:/tmp 00065 00066 </command> 00067 </hudson.tasks.Shell> 00068 </builders> 00069 <publishers> 00070 <hudson.tasks.BuildTrigger> 00071 <childProjects>JOB_CHILDREN</childProjects> 00072 <threshold> 00073 <name>SUCCESS</name> 00074 <ordinal>0</ordinal> 00075 <color>BLUE</color> 00076 </threshold> 00077 </hudson.tasks.BuildTrigger> 00078 <hudson.plugins.emailext.ExtendedEmailPublisher> 00079 <recipientList>EMAIL</recipientList> 00080 <configuredTriggers> 00081 <hudson.plugins.emailext.plugins.trigger.UnstableTrigger> 00082 <email> 00083 <recipientList></recipientList> 00084 <subject>$PROJECT_DEFAULT_SUBJECT</subject> 00085 <body>$PROJECT_DEFAULT_CONTENT</body> 00086 <sendToDevelopers>true</sendToDevelopers> 00087 <sendToRecipientList>true</sendToRecipientList> 00088 <contentTypeHTML>false</contentTypeHTML> 00089 <script>true</script> 00090 </email> 00091 </hudson.plugins.emailext.plugins.trigger.UnstableTrigger> 00092 <hudson.plugins.emailext.plugins.trigger.FailureTrigger> 00093 <email> 00094 <recipientList></recipientList> 00095 <subject>$PROJECT_DEFAULT_SUBJECT</subject> 00096 <body>$PROJECT_DEFAULT_CONTENT</body> 00097 <sendToDevelopers>true</sendToDevelopers> 00098 <sendToRecipientList>true</sendToRecipientList> 00099 <contentTypeHTML>false</contentTypeHTML> 00100 <script>true</script> 00101 </email> 00102 </hudson.plugins.emailext.plugins.trigger.FailureTrigger> 00103 <hudson.plugins.emailext.plugins.trigger.StillFailingTrigger> 00104 <email> 00105 <recipientList></recipientList> 00106 <subject>$PROJECT_DEFAULT_SUBJECT</subject> 00107 <body>$PROJECT_DEFAULT_CONTENT</body> 00108 <sendToDevelopers>true</sendToDevelopers> 00109 <sendToRecipientList>true</sendToRecipientList> 00110 <contentTypeHTML>false</contentTypeHTML> 00111 <script>true</script> 00112 </email> 00113 </hudson.plugins.emailext.plugins.trigger.StillFailingTrigger> 00114 <hudson.plugins.emailext.plugins.trigger.FixedTrigger> 00115 <email> 00116 <recipientList></recipientList> 00117 <subject>$PROJECT_DEFAULT_SUBJECT</subject> 00118 <body>$PROJECT_DEFAULT_CONTENT</body> 00119 <sendToDevelopers>true</sendToDevelopers> 00120 <sendToRecipientList>true</sendToRecipientList> 00121 <contentTypeHTML>false</contentTypeHTML> 00122 <script>true</script> 00123 00124 </email> 00125 </hudson.plugins.emailext.plugins.trigger.FixedTrigger> 00126 <hudson.plugins.emailext.plugins.trigger.StillUnstableTrigger> 00127 <email> 00128 <recipientList></recipientList> 00129 <subject>$PROJECT_DEFAULT_SUBJECT</subject> 00130 <body>$PROJECT_DEFAULT_CONTENT</body> 00131 <sendToDevelopers>true</sendToDevelopers> 00132 <sendToRecipientList>true</sendToRecipientList> 00133 <contentTypeHTML>false</contentTypeHTML> 00134 <script>true</script> 00135 </email> 00136 </hudson.plugins.emailext.plugins.trigger.StillUnstableTrigger> 00137 </configuredTriggers> 00138 <defaultSubject>$DEFAULT_SUBJECT</defaultSubject> 00139 <defaultContent>$DEFAULT_CONTENT</defaultContent> 00140 <defaultContentTypeHTML>false</defaultContentTypeHTML> 00141 <defaultContentIsScript>true</defaultContentIsScript> 00142 </hudson.plugins.emailext.ExtendedEmailPublisher> 00143 </publishers> 00144 <buildWrappers/> 00145 </project> 00146 """ 00147 00148 import roslib; roslib.load_manifest("job_generation") 00149 from job_generation.jobs_common import * 00150 import hudson 00151 import urllib 00152 import optparse 00153 import yaml 00154 00155 00156 def openni_job_name(ubuntudistro, arch): 00157 return "_".join(['openni_driver_debs', ubuntudistro, arch]) 00158 00159 00160 def create_openni_configs(): 00161 # create gold distro 00162 gold_job = openni_job_name(UBUNTU_DISTRO_MAP['diamondback'][0], ARCHES[0]) 00163 # distros for diamondback and unstable 00164 distros = set(UBUNTU_DISTRO_MAP['diamondback']) 00165 distros.update(UBUNTU_DISTRO_MAP['unstable']) 00166 00167 gold_children = [openni_job_name(u, a) 00168 for a in ARCHES for u in distros] 00169 gold_children.remove(gold_job) 00170 00171 # create hudson config files for each ubuntu distro 00172 configs = {} 00173 for ubuntudistro in distros: 00174 for arch in ARCHES: 00175 name = openni_job_name(ubuntudistro, arch) 00176 00177 # check if this is the 'gold' job 00178 time_trigger = '' 00179 job_children = '' 00180 if name == gold_job: 00181 time_trigger = '*/5 * * * *' 00182 job_children = ', '.join(gold_children) 00183 00184 hudson_config = HUDSON_OPENNI_CONFIG 00185 hudson_config = hudson_config.replace('UBUNTUDISTRO', ubuntudistro) 00186 hudson_config = hudson_config.replace('ARCH', arch) 00187 hudson_config = hudson_config.replace('TIME_TRIGGER', time_trigger) 00188 hudson_config = hudson_config.replace('JOB_CHILDREN', job_children) 00189 hudson_config = hudson_config.replace('EMAIL', 'tfoote+openni_debs@willowgarage.com') 00190 configs[name] = hudson_config 00191 return configs 00192 00193 00194 00195 00196 def main(): 00197 parser = optparse.OptionParser() 00198 parser.add_option('--delete', dest = 'delete', default=False, action='store_true', 00199 help='Delete jobs from Hudson') 00200 (options, args) = parser.parse_args() 00201 00202 00203 # hudson instance 00204 info = urllib.urlopen(CONFIG_PATH).read().split(',') 00205 hudson_instance = hudson.Hudson(SERVER, info[0], info[1]) 00206 00207 # send openni tests to Hudson 00208 print 'Creating openni Hudson jobs:' 00209 openni_configs = create_openni_configs() 00210 00211 for job_name in openni_configs: 00212 exists = hudson_instance.job_exists(job_name) 00213 00214 # delete job 00215 if options.delete and exists: 00216 print "Deleting job %s"%job_name 00217 hudson_instance.delete_job(job_name) 00218 00219 # reconfigure job 00220 elif exists: 00221 print " - %s"%job_name 00222 hudson_instance.reconfig_job(job_name, openni_configs[job_name]) 00223 00224 # create job 00225 elif not exists: 00226 print " - %s"%job_name 00227 hudson_instance.create_job(job_name, openni_configs[job_name]) 00228 00229 00230 00231 if __name__ == '__main__': 00232 main() 00233 00234 00235 00236