Skip to content

Instantly share code, notes, and snippets.

@davehunt
Created November 10, 2011 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davehunt/1355795 to your computer and use it in GitHub Desktop.
Save davehunt/1355795 to your computer and use it in GitHub Desktop.
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.ChoiceParameterDefinition>
<name>PLATFORM</name>
<description></description>
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
%(platforms)s
</a>
</choices>
</hudson.model.ChoiceParameterDefinition>
<hudson.model.ChoiceParameterDefinition>
<name>BUILD_TYPE</name>
<description></description>
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>release</string>
<string>candidate</string>
<string>daily</string>
</a>
</choices>
</hudson.model.ChoiceParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>VERSION</name>
<description></description>
<defaultValue></defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>BUILD</name>
<description></description>
<defaultValue>1</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>LOCALE</name>
<description></description>
<defaultValue>en-US</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.ChoiceParameterDefinition>
<name>BRANCH</name>
<description></description>
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
<string></string>
<string>mozilla-central</string>
<string>mozilla-aurora</string>
<string>mozilla-beta</string>
<string>mozilla-release</string>
<string>mozilla-1.9.2</string>
</a>
</choices>
</hudson.model.ChoiceParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="hudson.plugins.mercurial.MercurialSCM">
<source>http://hg.mozilla.org/qa/mozmill-automation</source>
<modules></modules>
<clean>true</clean>
<forest>false</forest>
<browser class="hudson.plugins.mercurial.browser.HgWeb">
<url>http://hg.mozilla.org/qa/mozmill-automation/</url>
</browser>
</scm>
<assignedNode>%(labels)s</assignedNode>
<canRoam>false</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.plugins.copyartifact.CopyArtifact>
<projectName>mozmill-environment-%(environment)s</projectName>
<filter></filter>
<target></target>
<selector class="hudson.plugins.copyartifact.StatusBuildSelector"/>
</hudson.plugins.copyartifact.CopyArtifact>
<hudson.tasks.Shell>
<command>unzip %(environment)s-$MOZMILL_VERSION.zip</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>./download.py --build=$BUILD --locale=$LOCALE --platform=$PLATFORM --type=$BUILD_TYPE --version=$VERSION --branch=$BRANCH</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>%(testrun_command)s</command>
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.tasks.ArtifactArchiver>
<artifacts>results*.xml, *.log</artifacts>
<latestOnly>false</latestOnly>
</hudson.tasks.ArtifactArchiver>
<hudson.tasks.junit.JUnitResultArchiver>
<testResults>results*.xml</testResults>
<keepLongStdio>false</keepLongStdio>
<testDataPublishers/>
</hudson.tasks.junit.JUnitResultArchiver>
</publishers>
<buildWrappers/>
</project>
import xml.dom.minidom
import jenkins
testruns = (
{'type': 'functional'},
{'type': 'update',
'options': ['--no-fallback']},
{'type': 'l10n'},
{'type': 'endurance',
'options': ['--iterations=100', '--entities=10']},
{'type': 'remote'},
{'type': 'addons',
'options': ['--with-untrusted']})
nodes = (
{'labels': ['windows', '2000'],
'platforms': ['win32'],
'environment': 'windows'},
{'labels': ['windows', 'xp'],
'platforms': ['win32'],
'environment': 'windows'},
{'labels': ['windows', 'vista'],
'platforms': ['win32'],
'environment': 'windows'},
{'labels': ['windows', '7'],
'platforms': ['win32'],
'environment': 'windows'},
{'labels': ['windows', '7x64'],
'platforms': ['win32', 'win64'],
'environment': 'windows'},
{'labels': ['macos', '10.6.8x64'],
'platforms': ['mac', 'mac64'],
'environment': 'mac'},
{'labels': ['ubuntu', '10.10'],
'platforms': ['linux'],
'environment': 'linux'},
{'labels': ['ubuntu', '10.10x64'],
'platforms': ['linux', 'linux64'],
'environment': 'linux'})
testrun_command = '%(script)s ./testrun_%(type)s.py --port=2424${EXECUTOR_NUMBER} --junit=results.xml --logfile=%(type)s.log --report=http://mozmill-archive.brasstacks.mozilla.com/db/ %(options)s .'
def main():
j = jenkins.Jenkins('http://localhost:8080')
count = 1
for testrun in testruns:
type = testrun.get('type')
for node in nodes:
labels = node.get('labels')
job_name = '-'.join([type, '-'.join(labels)])
print '%i: %s' % (count, job_name)
count = count + 1
template = open('config.xml')
platforms = ''.join(['<string>%s</string>' % platform for platform in node.get('platforms')])
command = testrun_command % {
'script': './mozmill-env/run.sh',
'type': type,
'options': 'options' in testrun and ' '.join(testrun.get('options')) or ''
}
doc = xml.dom.minidom.parseString(template.read() % {
'labels': '&amp;&amp;'.join(labels),
'environment': node.get('environment'),
'platforms': platforms,
'testrun_command': command})
if j.job_exists(job_name):
j.reconfig_job(job_name, doc.toxml())
else:
j.create_job(job_name, doc.toxml())
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment