Skip to content

Commit

Permalink
rosci running w/o commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tfoote committed Jun 19, 2012
1 parent 3e6aa62 commit 41938b8
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 7 deletions.
38 changes: 38 additions & 0 deletions src/buildfarm/resources/templates/rosci/scm-git-fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<scm class="hudson.plugins.git.GitSCM">
<configVersion>1</configVersion>
<remoteRepositories>
<org.spearce.jgit.transport.RemoteConfig>
<string>origin</string>
<int>5</int>
<string>fetch</string>
<string>+refs/heads/*:refs/remotes/origin/*</string>
<string>receivepack</string>
<string>git-upload-pack</string>
<string>uploadpack</string>
<string>git-upload-pack</string>
<string>url</string>
<string>%(source)s</string>
<string>tagopt</string>
<string/>
</org.spearce.jgit.transport.RemoteConfig>
</remoteRepositories>

<branches>
<hudson.plugins.git.BranchSpec>
<name>%(version)s</name>
</hudson.plugins.git.BranchSpec>
</branches>
<localBranch/>
<mergeOptions/>
<recursiveSubmodules>true</recursiveSubmodules>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<authorOrCommitter>false</authorOrCommitter>
<clean>false</clean>
<wipeOutWorkspace>false</wipeOutWorkspace>
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
<gitTool>Default</gitTool>
<submoduleCfg class="list"/>
<relativeTargetDir>%(local_name)s</relativeTargetDir>
<excludedRegions/>
<excludedUsers/>
</scm>
9 changes: 9 additions & 0 deletions src/buildfarm/resources/templates/rosci/scm-hg-fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<scm class="hudson.plugins.mercurial.MercurialSCM">
<source>%(source)s</source>
<branch>%(version)s</branch>
<subdir>%(local_name)s</subdir>
<modules/>
<clean>false</clean>
<forest>false</forest>
</scm>

15 changes: 15 additions & 0 deletions src/buildfarm/resources/templates/rosci/scm-svn-fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<scm class="hudson.scm.SubversionSCM">
<locations>
<hudson.scm.SubversionSCM_-ModuleLocation>
<remote>%(source)s</remote>
<local>%(local_name)s</local>
</hudson.scm.SubversionSCM_-ModuleLocation>
</locations>
<useUpdate>true</useUpdate>
<doRevert>false</doRevert>
<excludedRegions/>
<includedRegions/>
<excludedUsers/>
<excludedRevprop/>
<excludedCommitMessages/>
</scm>
28 changes: 24 additions & 4 deletions src/buildfarm/rosci_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,32 @@
import sys
import yaml

from . jenkins_support import VcsConfig_to_scm_fragment

DISPATH_SH_URI = 'https://raw.github.com/willowgarage/buildfarm/master/dispatch.sh'
CATKIN_BUILDER = 'rosci-catkin-cmake-builder.sh'

def get_resource_stream(name):
fullname = os.path.join('resources/templates/rosci', name)
if not pkg_resources.resource_exists('buildfarm', fullname):
raise RuntimeError("cannot locate template fragment: %s"%(fullname))
return pkg_resources.resource_stream('buildfarm', fullname)


def VcsConfig_to_scm_fragment(vcs_config, local_name, branch='devel'):
# have to set local_name, source, and version variables
uri, version = vcs_config.get_branch(branch, anonymous=True)
vcs_type = vcs_config.type
source = uri

if vcs_type == 'hg':
version = version or 'default'
elif vcs_type == 'svn':
if version is not None:
source = "%s@%s"%(uri, version)
elif vcs_type == 'git':
version = version or 'master'
f = get_resource_stream('scm-%s-fragment.xml'%vcs_type)
return f.read()%locals()

class JobConfig(object):

def __init__(self, name, job_type, vcs_config, email, label, params):
Expand Down Expand Up @@ -129,8 +150,7 @@ def create_jenkins_config_xml(job_config, rosdistro_name, os_name, os_platform,
#TODO
xunit_xml_fragment = ''

assert pkg_resources.resource_exists('buildfarm', 'resources/templates/rosci/config.xml')
f = pkg_resources.resource_stream('buildfarm', 'resources/templates/rosci/config.xml')
f = get_resource_stream('config.xml')
config_template = f.read()

return config_template%locals()
Expand Down
6 changes: 3 additions & 3 deletions src/buildfarm/rosci_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def rosci_main():
#print("starting rosci %s"%__version__)
parser = OptionParser(usage="usage: %prog <jobs.yaml> <rosdistro-name>", prog=NAME)
parser.add_option("-n", dest="fake", action="store_true", help="Don't actually upload to Jenkins", default=False)
parser.add_option("--commit", dest="commit", action="store_true", help="Actually upload to Jenkins", default=False)
options, args = parser.parse_args()
if len(args) < 2:
parser.error("please specify jobs.yaml file and ROS distribution name (e.g. fuerte)")
Expand All @@ -25,9 +25,9 @@ def rosci_main():
rosdistro_name = args[1]

#TODO: this raises on failure
server_config = load_server_config_file(get_default_server_config_file())
server_config = load_server_config_file(get_default_catkin_debs_config())
jenkins_handle = JenkinsConfig_to_handle(server_config)
jobs_data = load_jobs_from_file(jobs_yaml_path)

process_jobs(jobs_data, jenkins_handle, rosdistro_name, options.fake)
process_jobs(jobs_data, jenkins_handle, rosdistro_name, not options.commit)

0 comments on commit 41938b8

Please sign in to comment.