Bump pep8 to 1.3.3

However due to an upstream bug[1] we ignore E125 for now.

[1] https://github.com/jcrocholl/pep8/issues/126

Change-Id: I75337d9194156580cc66666aed9a5bc2fd5d4e15
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
Reviewed-on: https://review.openstack.org/16604
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Paul Belanger 2012-11-20 22:06:37 -05:00 committed by Jenkins
parent 9a4ad66bb8
commit 345fb6e5e1
13 changed files with 282 additions and 250 deletions

View File

@ -181,16 +181,16 @@ class YamlParser(object):
XML.SubElement(xml, 'disabled').text = 'false'
if data.get('block-downstream'):
XML.SubElement(xml,
'blockBuildWhenDownstreamBuilding').text = 'true'
'blockBuildWhenDownstreamBuilding').text = 'true'
else:
XML.SubElement(xml,
'blockBuildWhenDownstreamBuilding').text = 'false'
'blockBuildWhenDownstreamBuilding').text = 'false'
if data.get('block-upstream'):
XML.SubElement(xml,
'blockBuildWhenUpstreamBuilding').text = 'true'
'blockBuildWhenUpstreamBuilding').text = 'true'
else:
XML.SubElement(xml,
'blockBuildWhenUpstreamBuilding').text = 'false'
'blockBuildWhenUpstreamBuilding').text = 'false'
if data.get('concurrent'):
XML.SubElement(xml, 'concurrentBuild').text = 'true'
else:
@ -301,7 +301,7 @@ class Jenkins(object):
class Builder(object):
def __init__(self, jenkins_url, jenkins_user, jenkins_password,
config=None):
config=None):
self.jenkins = Jenkins(jenkins_url, jenkins_user, jenkins_password)
self.cache = CacheStorage()
self.global_config = config

View File

@ -29,15 +29,16 @@ def main():
parser_delete = subparser.add_parser('delete')
parser_delete.add_argument('name', help='name of job', nargs='+')
subparser.add_parser('delete-all',
help='Delete *ALL* jobs from Jenkins server, including those '
'jobs not managed Jenkins Job Builder.')
help='Delete *ALL* jobs from Jenkins server, '
'including those jobs not managed Jenkins Job '
'Builder.')
parser.add_argument('--conf', dest='conf', help='Configuration file')
parser.add_argument('-l', '--log_level', dest='log_level', default='info',
help="Log level (default: %(default)s)")
options = parser.parse_args()
options.log_level = getattr(logging, options.log_level.upper(),
logging.INFO)
logging.INFO)
logging.basicConfig(level=options.log_level)
logger = logging.getLogger()
@ -47,7 +48,7 @@ def main():
else:
# Fallback to script directory
localconf = os.path.join(os.path.dirname(__file__),
'jenkins_jobs.ini')
'jenkins_jobs.ini')
if os.path.isfile(localconf):
conf = localconf
@ -74,8 +75,8 @@ def main():
logger.info("Deleting all jobs")
builder.delete_all_jobs()
elif options.command == 'update':
logger.info("Updating jobs in {0} ({1})".format(options.path,
options.name))
logger.info("Updating jobs in {0} ({1})".format(
options.path, options.name))
builder.update_job(options.path, options.name)
elif options.command == 'test':
builder.update_job(options.path, options.name,

View File

@ -168,21 +168,25 @@ def trigger_builds(parser, xml_parent, data):
"""
tbuilder = XML.SubElement(xml_parent,
'hudson.plugins.parameterizedtrigger.TriggerBuilder')
'hudson.plugins.parameterizedtrigger.'
'TriggerBuilder')
configs = XML.SubElement(tbuilder, 'configs')
for project_def in data:
if 'project' not in project_def or project_def['project'] == '':
logger.debug("No project specified - skipping trigger-build")
continue
tconfig = XML.SubElement(configs,
'hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig')
'hudson.plugins.parameterizedtrigger.'
'BlockableBuildTriggerConfig')
tconfigs = XML.SubElement(tconfig, 'configs')
if(project_def.get('current-parameters')):
XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.CurrentBuildParameters')
'hudson.plugins.parameterizedtrigger.'
'CurrentBuildParameters')
if 'predefined-parameters' in project_def:
params = XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.PredefinedBuildParameters')
'hudson.plugins.parameterizedtrigger.'
'PredefinedBuildParameters')
properties = XML.SubElement(params, 'properties')
properties.text = project_def['predefined-parameters']
if(len(list(tconfigs)) == 0):
@ -233,7 +237,7 @@ def builders_from(parser, xml_parent, data):
- project: "base-build"
"""
pbs = XML.SubElement(xml_parent,
'hudson.plugins.templateproject.ProxyBuilder')
'hudson.plugins.templateproject.ProxyBuilder')
XML.SubElement(pbs, 'projectName').text = data
@ -302,26 +306,28 @@ def artifact_resolver(parser, xml_parent, data):
version: 1.2
"""
ar = XML.SubElement(xml_parent,
'org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver')
'org.jvnet.hudson.plugins.repositoryconnector.'
'ArtifactResolver')
XML.SubElement(ar, 'targetDirectory').text = data['target-directory']
artifacttop = XML.SubElement(ar, 'artifacts')
artifacts = data['artifacts']
for artifact in artifacts:
rcartifact = XML.SubElement(artifacttop,
'org.jvnet.hudson.plugins.repositoryconnector.Artifact')
'org.jvnet.hudson.plugins.'
'repositoryconnector.Artifact')
XML.SubElement(rcartifact, 'groupId').text = artifact['group-id']
XML.SubElement(rcartifact, 'artifactId').text = artifact['artifact-id']
XML.SubElement(rcartifact, 'classifier').text = artifact.get(
'classifier', '')
'classifier', '')
XML.SubElement(rcartifact, 'version').text = artifact['version']
XML.SubElement(rcartifact, 'extension').text = artifact.get(
'extension', 'jar')
'extension', 'jar')
XML.SubElement(rcartifact, 'targetFileName').text = artifact.get(
'target-file-name', '')
XML.SubElement(ar, 'failOnError').text = str(data.get('fail-on-error',
False)).lower()
'target-file-name', '')
XML.SubElement(ar, 'failOnError').text = str(data.get(
'fail-on-error', False)).lower()
XML.SubElement(ar, 'enableRepoLogging').text = str(data.get(
'repository-logging', False)).lower()
'repository-logging', False)).lower()
XML.SubElement(ar, 'snapshotUpdatePolicy').text = 'never'
XML.SubElement(ar, 'releaseUpdatePolicy').text = 'never'
XML.SubElement(ar, 'snapshotChecksumPolicy').text = 'warn'

View File

@ -69,11 +69,11 @@ class HipChat(jenkins_jobs.modules.base.Base):
# ConfigParser (it could possibly be a regular 'dict' object which
# doesn't have the right get() method).
if(not isinstance(self.registry.global_config,
ConfigParser.ConfigParser)):
ConfigParser.ConfigParser)):
raise jenkins_jobs.errors.JenkinsJobsException(
'HipChat requires a config object in the registry.')
'HipChat requires a config object in the registry.')
self.authToken = self.registry.global_config.get(
'hipchat', 'authtoken')
'hipchat', 'authtoken')
self.jenkinsUrl = self.registry.global_config.get('jenkins', 'url')
def gen_xml(self, parser, xml_parent, data):
@ -89,10 +89,11 @@ class HipChat(jenkins_jobs.modules.base.Base):
if properties is None:
properties = XML.SubElement(xml_parent, 'properties')
pdefhip = XML.SubElement(properties,
'jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty')
'jenkins.plugins.hipchat.'
'HipChatNotifier_-HipChatJobProperty')
XML.SubElement(pdefhip, 'room').text = hipchat['room']
XML.SubElement(pdefhip, 'startNotification').text = str(
hipchat.get('start-notify', 'false')).lower()
hipchat.get('start-notify', 'false')).lower()
publishers = xml_parent.find('publishers')
if publishers is None:

View File

@ -52,7 +52,8 @@ def http_endpoint(parser, xml_parent, data):
url: http://example.com/jenkins_endpoint
"""
endpoint_element = XML.SubElement(xml_parent,
'com.tikal.hudson.plugins.notification.Endpoint')
'com.tikal.hudson.plugins.notification.'
'Endpoint')
XML.SubElement(endpoint_element, 'protocol').text = 'HTTP'
XML.SubElement(endpoint_element, 'url').text = data['url']
@ -68,7 +69,9 @@ class Notifications(jenkins_jobs.modules.base.Base):
notifications = data.get('notifications', [])
if notifications:
notify_element = XML.SubElement(properties,
'com.tikal.hudson.plugins.notification.HudsonNotificationProperty')
'com.tikal.hudson.plugins.'
'notification.'
'HudsonNotificationProperty')
endpoints_element = XML.SubElement(notify_element, 'endpoints')
for endpoint in notifications:

View File

@ -146,7 +146,8 @@ def label_param(parser, xml_parent, data):
description: "The node on which to run the job"
"""
base_param(parser, xml_parent, data, True,
'org.jvnet.jenkins.plugins.nodelabelparameter.LabelParameterDefinition')
'org.jvnet.jenkins.plugins.nodelabelparameter.'
'LabelParameterDefinition')
def choice_param(parser, xml_parent, data):
@ -200,8 +201,8 @@ def validating_string_param(parser, xml_parent, data):
msg: Your entered value failed validation
"""
pdef = base_param(parser, xml_parent, data, True,
'hudson.plugins.validating__string__parameter.'
'ValidatingStringParameterDefinition')
'hudson.plugins.validating__string__parameter.'
'ValidatingStringParameterDefinition')
XML.SubElement(pdef, 'regex').text = data['regex']
XML.SubElement(pdef, 'failedValidationMessage').text = data['msg']
@ -230,7 +231,8 @@ def svn_tags_param(parser, xml_parent, data):
filter: [A-za-z0-9]*
"""
pdef = base_param(parser, xml_parent, data, True,
'hudson.scm.listtagsparameter.ListSubversionTagsParameterDefinition')
'hudson.scm.listtagsparameter.'
'ListSubversionTagsParameterDefinition')
XML.SubElement(pdef, 'tagsDir').text = data['url']
XML.SubElement(pdef, 'tagsFilter').text = data.get('filter', None)
XML.SubElement(pdef, 'reverseByDate').text = "true"

View File

@ -49,7 +49,8 @@ def github(parser, xml_parent, data):
url: https://github.com/openstack-ci/jenkins-job-builder/
"""
github = XML.SubElement(xml_parent,
'com.coravy.hudson.plugins.github.GithubProjectProperty')
'com.coravy.hudson.plugins.github.'
'GithubProjectProperty')
github_url = XML.SubElement(github, 'projectUrl')
github_url.text = data['url']
@ -73,7 +74,8 @@ def throttle(parser, xml_parent, data):
max-total: 4
"""
throttle = XML.SubElement(xml_parent,
'hudson.plugins.throttleconcurrents.ThrottleJobProperty')
'hudson.plugins.throttleconcurrents.'
'ThrottleJobProperty')
XML.SubElement(throttle, 'maxConcurrentPerNode').text = str(
data.get('max-per-node', '0'))
XML.SubElement(throttle, 'maxConcurrentTotal').text = str(
@ -111,7 +113,7 @@ def inject(parser, xml_parent, data):
properties-content: FOO=bar
"""
inject = XML.SubElement(xml_parent,
'EnvInjectJobProperty')
'EnvInjectJobProperty')
info = XML.SubElement(inject, 'info')
XML.SubElement(info, 'propertiesFilePath').text = str(
data.get('properties-file', ''))
@ -148,9 +150,10 @@ def authenticated_build(parser, xml_parent, data):
# TODO: generalize this
if data:
security = XML.SubElement(xml_parent,
'hudson.security.AuthorizationMatrixProperty')
'hudson.security.'
'AuthorizationMatrixProperty')
XML.SubElement(security, 'permission').text = \
'hudson.model.Item.Build:authenticated'
'hudson.model.Item.Build:authenticated'
def authorization(parser, xml_parent, data):
@ -200,11 +203,11 @@ def authorization(parser, xml_parent, data):
'run-delete': 'hudson.model.Run.Delete',
'run-update': 'hudson.model.Run.Update',
'scm-tag': 'hudson.scm.SCM.Tag'
}
}
if data:
matrix = XML.SubElement(xml_parent,
'hudson.security.AuthorizationMatrixProperty')
'hudson.security.AuthorizationMatrixProperty')
for (username, perms) in data.items():
for perm in perms:
pe = XML.SubElement(matrix, 'permission')

View File

@ -88,15 +88,18 @@ def trigger_parameterized_builds(parser, xml_parent, data):
project: other_job
"""
tbuilder = XML.SubElement(xml_parent,
'hudson.plugins.parameterizedtrigger.BuildTrigger')
'hudson.plugins.parameterizedtrigger.'
'BuildTrigger')
configs = XML.SubElement(tbuilder, 'configs')
for project_def in data:
tconfig = XML.SubElement(configs,
'hudson.plugins.parameterizedtrigger.BuildTriggerConfig')
'hudson.plugins.parameterizedtrigger.'
'BuildTriggerConfig')
tconfigs = XML.SubElement(tconfig, 'configs')
if 'predefined-parameters' in project_def:
params = XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.PredefinedBuildParameters')
'hudson.plugins.parameterizedtrigger.'
'PredefinedBuildParameters')
properties = XML.SubElement(params, 'properties')
properties.text = project_def['predefined-parameters']
else:
@ -128,16 +131,16 @@ def trigger(parser, xml_parent, data):
'SUCCESS': {
'ordinal': '0',
'color': 'BLUE'
},
},
'UNSTABLE': {
'ordinal': '1',
'color': 'YELLOW'
},
},
'FAILURE': {
'ordinal': '2',
'color': 'RED'
}
}
}
tconfig = XML.SubElement(xml_parent, 'hudson.tasks.BuildTrigger')
childProjects = XML.SubElement(tconfig, 'childProjects')
@ -173,8 +176,8 @@ def coverage(parser, xml_parent, data):
XML.SubElement(cobertura, 'onlyStable').text = 'false'
healthy = XML.SubElement(cobertura, 'healthyTarget')
targets = XML.SubElement(healthy, 'targets', {
'class': 'enum-map',
'enum-type': 'hudson.plugins.cobertura.targets.CoverageMetric'})
'class': 'enum-map',
'enum-type': 'hudson.plugins.cobertura.targets.CoverageMetric'})
entry = XML.SubElement(targets, 'entry')
XML.SubElement(entry, 'hudson.plugins.cobertura.targets.CoverageMetric'
).text = 'CONDITIONAL'
@ -189,8 +192,8 @@ def coverage(parser, xml_parent, data):
XML.SubElement(entry, 'int').text = '80'
unhealthy = XML.SubElement(cobertura, 'unhealthyTarget')
targets = XML.SubElement(unhealthy, 'targets', {
'class': 'enum-map',
'enum-type': 'hudson.plugins.cobertura.targets.CoverageMetric'})
'class': 'enum-map',
'enum-type': 'hudson.plugins.cobertura.targets.CoverageMetric'})
entry = XML.SubElement(targets, 'entry')
XML.SubElement(entry, 'hudson.plugins.cobertura.targets.CoverageMetric'
).text = 'CONDITIONAL'
@ -205,8 +208,8 @@ def coverage(parser, xml_parent, data):
XML.SubElement(entry, 'int').text = '0'
failing = XML.SubElement(cobertura, 'failingTarget')
targets = XML.SubElement(failing, 'targets', {
'class': 'enum-map',
'enum-type': 'hudson.plugins.cobertura.targets.CoverageMetric'})
'class': 'enum-map',
'enum-type': 'hudson.plugins.cobertura.targets.CoverageMetric'})
entry = XML.SubElement(targets, 'entry')
XML.SubElement(entry, 'hudson.plugins.cobertura.targets.CoverageMetric'
).text = 'CONDITIONAL'
@ -246,7 +249,8 @@ def ftp(parser, xml_parent, data):
excludes: '**/*.excludedfiletype'
"""
outer_ftp = XML.SubElement(xml_parent,
'jenkins.plugins.publish__over__ftp.BapFtpPublisherPlugin')
'jenkins.plugins.publish__over__ftp.'
'BapFtpPublisherPlugin')
XML.SubElement(outer_ftp, 'consolePrefix').text = 'FTP: '
delegate = XML.SubElement(outer_ftp, 'delegate')
publishers = XML.SubElement(delegate, 'publishers')
@ -257,7 +261,8 @@ def ftp(parser, xml_parent, data):
transfers = XML.SubElement(ftp, 'transfers')
ftp_transfers = XML.SubElement(transfers,
'jenkins.plugins.publish__over__ftp.BapFtpTransfer')
'jenkins.plugins.publish__over__ftp.'
'BapFtpTransfer')
XML.SubElement(ftp_transfers, 'remoteDirectory').text = data['target']
XML.SubElement(ftp_transfers, 'sourceFiles').text = data['source']
XML.SubElement(ftp_transfers, 'excludes').text = data['excludes']
@ -273,8 +278,10 @@ def ftp(parser, xml_parent, data):
XML.SubElement(delegate, 'failOnError').text = 'false'
XML.SubElement(delegate, 'alwaysPublishFromMaster').text = 'false'
XML.SubElement(delegate, 'hostConfigurationAccess',
{'class': 'jenkins.plugins.publish_over_ftp.BapFtpPublisherPlugin',
'reference': '../..'})
{'class':
'jenkins.plugins.publish_over_ftp.'
'BapFtpPublisherPlugin',
'reference': '../..'})
def junit(parser, xml_parent, data):
@ -359,20 +366,20 @@ def xunit(parser, xml_parent, data):
# Map our internal types to the XML element names used by Jenkins plugin
types_to_plugin_types = {
'aunit': 'AUnitJunitHudsonTestType',
'boosttest': 'AUnitJunitHudsonTestType',
'checktype': 'CheckType',
'cpptest': 'CppTestJunitHudsonTestType',
'cppunit': 'CppUnitJunitHudsonTestType',
'fpcunit': 'FPCUnitJunitHudsonTestType',
'junit': 'JUnitType',
'mstest': 'MSTestJunitHudsonTestType',
'nunit': 'NUnitJunitHudsonTestType',
'phpunit': 'PHPUnitJunitHudsonTestType',
'tusar': 'TUSARJunitHudsonTestType',
'unittest': 'UnitTestJunitHudsonTestType',
'valgrind': 'ValgrindJunitHudsonTestType',
# FIXME should implement the 'custom' type
'aunit': 'AUnitJunitHudsonTestType',
'boosttest': 'AUnitJunitHudsonTestType',
'checktype': 'CheckType',
'cpptest': 'CppTestJunitHudsonTestType',
'cppunit': 'CppUnitJunitHudsonTestType',
'fpcunit': 'FPCUnitJunitHudsonTestType',
'junit': 'JUnitType',
'mstest': 'MSTestJunitHudsonTestType',
'nunit': 'NUnitJunitHudsonTestType',
'phpunit': 'PHPUnitJunitHudsonTestType',
'tusar': 'TUSARJunitHudsonTestType',
'unittest': 'UnitTestJunitHudsonTestType',
'valgrind': 'ValgrindJunitHudsonTestType',
# FIXME should implement the 'custom' type
}
implemented_types = types_to_plugin_types.keys() # shortcut
@ -383,7 +390,7 @@ def xunit(parser, xml_parent, data):
type_name = configured_type.keys()[0]
if type_name not in implemented_types:
logger.warn("Requested xUnit type '%s' is not yet supported" %
type_name)
type_name)
else:
# Append for generation
supported_types.append(configured_type)
@ -393,7 +400,7 @@ def xunit(parser, xml_parent, data):
framework_name = supported_type.keys()[0]
xmltypes = XML.SubElement(xunit, 'types')
xmlframework = XML.SubElement(xmltypes,
types_to_plugin_types[framework_name])
types_to_plugin_types[framework_name])
XML.SubElement(xmlframework, 'pattern').text = \
supported_type[framework_name].get('pattern', '')
@ -412,15 +419,15 @@ def xunit(parser, xml_parent, data):
for t in data['thresholds']:
if not ('failed' in t or 'skipped' in t):
logger.warn(
"Unrecognized threshold, should be 'failed' or 'skipped'")
"Unrecognized threshold, should be 'failed' or 'skipped'")
continue
elname = "org.jenkinsci.plugins.xunit.threshold.%sThreshold" \
% t.keys()[0].title()
% t.keys()[0].title()
el = XML.SubElement(xmlthresholds, elname)
for threshold_name, threshold_value in t.values()[0].items():
# Normalize and craft the element name for this threshold
elname = "%sThreshold" % threshold_name.lower().replace(
'new', 'New')
'new', 'New')
XML.SubElement(el, elname).text = threshold_value
# Whether to use percent of exact number of tests.
@ -487,7 +494,8 @@ def violations(parser, xml_parent, data):
pattern: '**/pep8.txt'
"""
violations = XML.SubElement(xml_parent,
'hudson.plugins.violations.ViolationsPublisher')
'hudson.plugins.violations.'
'ViolationsPublisher')
config = XML.SubElement(violations, 'config')
suppressions = XML.SubElement(config, 'suppressions',
{'class': 'tree-set'})
@ -589,8 +597,8 @@ def pipeline(parser, xml_parent, data):
"""
if data != '':
pippub = XML.SubElement(xml_parent,
'au.com.centrumsystems.hudson.plugin.'
'buildpipeline.trigger.BuildPipelineTrigger')
'au.com.centrumsystems.hudson.plugin.'
'buildpipeline.trigger.BuildPipelineTrigger')
XML.SubElement(pippub, 'downstreamProjectNames').text = data
@ -642,7 +650,8 @@ def claimbuild(parser, xml_parent, data):
def base_email_ext(parser, xml_parent, data, ttype):
trigger = XML.SubElement(xml_parent,
'hudson.plugins.emailext.plugins.trigger.' + ttype)
'hudson.plugins.emailext.plugins.trigger.'
+ ttype)
email = XML.SubElement(trigger, 'email')
XML.SubElement(email, 'recipientList').text = ''
XML.SubElement(email, 'subject').text = '$PROJECT_DEFAULT_SUBJECT'
@ -703,7 +712,7 @@ def email_ext(parser, xml_parent, data):
pre-build: true
"""
emailext = XML.SubElement(xml_parent,
'hudson.plugins.emailext.ExtendedEmailPublisher')
'hudson.plugins.emailext.ExtendedEmailPublisher')
XML.SubElement(emailext, 'recipientList').text = data['recipients']
ctrigger = XML.SubElement(emailext, 'configuredTriggers')
if data.get('unstable', False):
@ -772,9 +781,9 @@ def aggregate_tests(parser, xml_parent, data):
include-failed-builds: true
"""
agg = XML.SubElement(xml_parent,
'hudson.tasks.test.AggregatedTestResultPublisher')
'hudson.tasks.test.AggregatedTestResultPublisher')
XML.SubElement(agg, 'includeFailedBuilds').text = str(data.get(
'include-failed-builds', False)).lower()
'include-failed-builds', False)).lower()
class Publishers(jenkins_jobs.modules.base.Base):

View File

@ -90,7 +90,7 @@ def git(self, xml_parent, data):
(None, 'gitConfigEmail', ''),
('skip-tag', 'skipTag', False),
(None, 'scmName', ''),
]
]
scm = XML.SubElement(xml_parent,
'scm', {'class': 'hudson.plugins.git.GitSCM'})
@ -156,18 +156,18 @@ def svn(self, xml_parent, data):
basedir: repo2
"""
scm = XML.SubElement(xml_parent, 'scm', {'class':
'hudson.scm.SubversionSCM'})
'hudson.scm.SubversionSCM'})
locations = XML.SubElement(scm, 'locations')
if 'repos' in data:
repos = data['repos']
for repo in repos:
module = XML.SubElement(locations,
'hudson.scm.SubversionSCM_-ModuleLocation')
'hudson.scm.SubversionSCM_-ModuleLocation')
XML.SubElement(module, 'remote').text = repo['url']
XML.SubElement(module, 'local').text = repo.get('basedir', '.')
elif 'url' in data:
module = XML.SubElement(locations,
'hudson.scm.SubversionSCM_-ModuleLocation')
'hudson.scm.SubversionSCM_-ModuleLocation')
XML.SubElement(module, 'remote').text = data['url']
XML.SubElement(module, 'local').text = data.get('basedir', '.')
else:
@ -182,7 +182,7 @@ def svn(self, xml_parent, data):
elif updater == 'update':
updaterclass = 'UpdateUpdater'
XML.SubElement(scm, 'workspaceUpdater', {'class':
'hudson.scm.subversion.' + updaterclass})
'hudson.scm.subversion.' + updaterclass})
class SCM(jenkins_jobs.modules.base.Base):

View File

@ -52,7 +52,8 @@ def timeout(parser, xml_parent, data):
fail: true
"""
twrapper = XML.SubElement(xml_parent,
'hudson.plugins.build__timeout.BuildTimeoutWrapper')
'hudson.plugins.build__timeout.'
'BuildTimeoutWrapper')
tminutes = XML.SubElement(twrapper, 'timeoutMinutes')
tminutes.text = str(data['timeout'])
failbuild = XML.SubElement(twrapper, 'failBuild')
@ -105,7 +106,8 @@ def mask_passwords(parser, xml_parent, data):
- mask-passwords
"""
XML.SubElement(xml_parent,
'com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper')
'com.michelin.cio.hudson.plugins.maskpasswords.'
'MaskPasswordsBuildWrapper')
def workspace_cleanup(parser, xml_parent, data):
@ -127,7 +129,7 @@ def workspace_cleanup(parser, xml_parent, data):
"""
p = XML.SubElement(xml_parent,
'hudson.plugins.ws__cleanup.PreBuildCleanup')
'hudson.plugins.ws__cleanup.PreBuildCleanup')
p.set("plugin", "ws-cleanup@0.10")
if "include" in data or "exclude" in data:
patterns = XML.SubElement(p, 'patterns')
@ -163,7 +165,8 @@ def build_name(parser, xml_parent, data):
name: Build-${FOO}
"""
bsetter = XML.SubElement(xml_parent,
'org.jenkinsci.plugins.buildnamesetter.BuildNameSetter')
'org.jenkinsci.plugins.buildnamesetter.'
'BuildNameSetter')
XML.SubElement(bsetter, 'template').text = data['name']
@ -182,10 +185,12 @@ def port_allocator(parser, xml_parent, data):
name: SERVER_PORT
"""
pa = XML.SubElement(xml_parent,
'org.jvnet.hudson.plugins.port__allocator.PortAllocator')
'org.jvnet.hudson.plugins.port__allocator.'
'PortAllocator')
ports = XML.SubElement(pa, 'ports')
dpt = XML.SubElement(ports,
'org.jvnet.hudson.plugins.port__allocator.DefaultPortType')
'org.jvnet.hudson.plugins.port__allocator.'
'DefaultPortType')
XML.SubElement(dpt, 'name').text = data['name']
@ -205,12 +210,13 @@ def locks(parser, xml_parent, data):
- FOO2
"""
lw = XML.SubElement(xml_parent,
'hudson.plugins.locksandlatches.LockWrapper')
'hudson.plugins.locksandlatches.LockWrapper')
locktop = XML.SubElement(lw, 'locks')
locks = data
for lock in locks:
lockwrapper = XML.SubElement(locktop,
'hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig')
'hudson.plugins.locksandlatches.'
'LockWrapper_-LockWaitConfig')
XML.Sublement(lockwrapper, 'name').text = lock

View File

@ -44,94 +44,94 @@ import jenkins_jobs.modules.base
ZUUL_PARAMETERS = [
{'string':
{'description': 'Zuul provided key to link builds with Gerrit events',
'name': 'ZUUL_UUID'}},
{'description': 'Zuul provided key to link builds with Gerrit events',
'name': 'ZUUL_UUID'}},
{'string':
{'description': 'Zuul provided key to link builds with Gerrit'
' events (deprecated use ZUUL_UUID instead)',
'name': 'UUID'}},
{'description': 'Zuul provided key to link builds with Gerrit'
' events (deprecated use ZUUL_UUID instead)',
'name': 'UUID'}},
{'string':
{'description': 'Zuul pipeline triggering this job',
'name': 'ZUUL_PIPELINE'}},
{'description': 'Zuul pipeline triggering this job',
'name': 'ZUUL_PIPELINE'}},
{'string':
{'description': 'Zuul provided project name',
'name': 'GERRIT_PROJECT'}},
{'description': 'Zuul provided project name',
'name': 'GERRIT_PROJECT'}},
{'string':
{'description': 'Branch name of triggering project',
'name': 'ZUUL_PROJECT'}},
{'description': 'Branch name of triggering project',
'name': 'ZUUL_PROJECT'}},
{'string':
{'description': 'Zuul provided branch name',
'name': 'GERRIT_BRANCH'}},
{'description': 'Zuul provided branch name',
'name': 'GERRIT_BRANCH'}},
{'string':
{'description': 'Branch name of triggering change',
'name': 'ZUUL_BRANCH'}},
{'description': 'Branch name of triggering change',
'name': 'ZUUL_BRANCH'}},
{'string':
{'description': 'Zuul provided list of dependent changes to merge',
'name': 'GERRIT_CHANGES'}},
{'description': 'Zuul provided list of dependent changes to merge',
'name': 'GERRIT_CHANGES'}},
{'string':
{'description': 'List of dependent changes to merge',
'name': 'ZUUL_CHANGES'}},
{'description': 'List of dependent changes to merge',
'name': 'ZUUL_CHANGES'}},
{'string':
{'description': 'Reference for the merged commit(s) to use',
'name': 'ZUUL_REF'}},
{'description': 'Reference for the merged commit(s) to use',
'name': 'ZUUL_REF'}},
{'string':
{'description': 'The commit SHA1 at the head of ZUUL_REF',
'name': 'ZUUL_COMMIT'}},
{'description': 'The commit SHA1 at the head of ZUUL_REF',
'name': 'ZUUL_COMMIT'}},
{'string':
{'description': 'List of included changes',
'name': 'ZUUL_CHANGE_IDS'}},
{'description': 'List of included changes',
'name': 'ZUUL_CHANGE_IDS'}},
{'string':
{'description': 'ID of triggering change',
'name': 'ZUUL_CHANGE'}},
{'description': 'ID of triggering change',
'name': 'ZUUL_CHANGE'}},
{'string':
{'description': 'Patchset of triggering change',
'name': 'ZUUL_PATCHSET'}},
]
{'description': 'Patchset of triggering change',
'name': 'ZUUL_PATCHSET'}},
]
ZUUL_POST_PARAMETERS = [
{'string':
{'description': 'Zuul provided key to link builds with Gerrit events',
'name': 'ZUUL_UUID'}},
{'description': 'Zuul provided key to link builds with Gerrit events',
'name': 'ZUUL_UUID'}},
{'string':
{'description': 'Zuul provided key to link builds with Gerrit'
' events (deprecated use ZUUL_UUID instead)',
'name': 'UUID'}},
{'description': 'Zuul provided key to link builds with Gerrit'
' events (deprecated use ZUUL_UUID instead)',
'name': 'UUID'}},
{'string':
{'description': 'Zuul pipeline triggering this job',
'name': 'ZUUL_PIPELINE'}},
{'description': 'Zuul pipeline triggering this job',
'name': 'ZUUL_PIPELINE'}},
{'string':
{'description': 'Zuul provided project name',
'name': 'GERRIT_PROJECT'}},
{'description': 'Zuul provided project name',
'name': 'GERRIT_PROJECT'}},
{'string':
{'description': 'Branch name of triggering project',
'name': 'ZUUL_PROJECT'}},
{'description': 'Branch name of triggering project',
'name': 'ZUUL_PROJECT'}},
{'string':
{'description': 'Zuul provided ref name',
'name': 'GERRIT_REFNAME'}},
{'description': 'Zuul provided ref name',
'name': 'GERRIT_REFNAME'}},
{'string':
{'description': 'Name of updated reference triggering this job',
'name': 'ZUUL_REFNAME'}},
{'description': 'Name of updated reference triggering this job',
'name': 'ZUUL_REFNAME'}},
{'string':
{'description': 'Zuul provided old reference for ref-updated',
'name': 'GERRIT_OLDREV'}},
{'description': 'Zuul provided old reference for ref-updated',
'name': 'GERRIT_OLDREV'}},
{'string':
{'description': 'Old SHA at this reference',
'name': 'ZUUL_OLDREV'}},
{'description': 'Old SHA at this reference',
'name': 'ZUUL_OLDREV'}},
{'string':
{'description': 'Zuul provided new reference for ref-updated',
'name': 'GERRIT_NEWREV'}},
{'description': 'Zuul provided new reference for ref-updated',
'name': 'GERRIT_NEWREV'}},
{'string':
{'description': 'New SHA at this reference',
'name': 'ZUUL_NEWREV'}},
{'description': 'New SHA at this reference',
'name': 'ZUUL_NEWREV'}},
{'string':
{'description': 'Shortened new SHA at this reference',
'name': 'ZUUL_SHORT_NEWREV'}},
]
{'description': 'Shortened new SHA at this reference',
'name': 'ZUUL_SHORT_NEWREV'}},
]
ZUUL_NOTIFICATIONS = [
{'http':
{'url': 'http://127.0.0.1:8001/jenkins_endpoint'}}
]
{'url': 'http://127.0.0.1:8001/jenkins_endpoint'}}
]
class Zuul(jenkins_jobs.modules.base.Base):

187
setup.py
View File

@ -46,99 +46,100 @@ setuptools.setup(
'Programming Language :: Python'
],
entry_points={
'console_scripts': [
'jenkins-jobs=jenkins_jobs.cmd:main',
],
'jenkins_jobs.projects': [
'freestyle=jenkins_jobs.modules.project_freestyle:Freestyle',
'maven=jenkins_jobs.modules.project_maven:Maven',
],
'jenkins_jobs.builders': [
'shell=jenkins_jobs.modules.builders:shell',
'ant=jenkins_jobs.modules.builders:ant',
'trigger-builds=jenkins_jobs.modules.builders:trigger_builds',
'builders-from=jenkins_jobs.modules.builders:builders_from',
'inject=jenkins_jobs.modules.builders:inject',
'artifact-resolver=jenkins_jobs.modules.builders:artifact_resolver',
'copyartifact=jenkins_jobs.modules.builders:copyartifact',
],
'jenkins_jobs.reporters': [
'email=jenkins_jobs.modules.reporters:email',
],
'jenkins_jobs.properties': [
'github=jenkins_jobs.modules.properties:github',
'throttle=jenkins_jobs.modules.properties:throttle',
'inject=jenkins_jobs.modules.properties:inject',
'authenticated-build=jenkins_jobs.modules.properties:'
'console_scripts': [
'jenkins-jobs=jenkins_jobs.cmd:main',
],
'jenkins_jobs.projects': [
'freestyle=jenkins_jobs.modules.project_freestyle:Freestyle',
'maven=jenkins_jobs.modules.project_maven:Maven',
],
'jenkins_jobs.builders': [
'shell=jenkins_jobs.modules.builders:shell',
'ant=jenkins_jobs.modules.builders:ant',
'trigger-builds=jenkins_jobs.modules.builders:trigger_builds',
'builders-from=jenkins_jobs.modules.builders:builders_from',
'inject=jenkins_jobs.modules.builders:inject',
'artifact-resolver=jenkins_jobs.modules.builders:'
'artifact_resolver',
'copyartifact=jenkins_jobs.modules.builders:copyartifact',
],
'jenkins_jobs.reporters': [
'email=jenkins_jobs.modules.reporters:email',
],
'jenkins_jobs.properties': [
'github=jenkins_jobs.modules.properties:github',
'throttle=jenkins_jobs.modules.properties:throttle',
'inject=jenkins_jobs.modules.properties:inject',
'authenticated-build=jenkins_jobs.modules.properties:'
'authenticated_build',
'authorization=jenkins_jobs.modules.properties:authorization',
],
'jenkins_jobs.parameters': [
'string=jenkins_jobs.modules.parameters:string_param',
'bool=jenkins_jobs.modules.parameters:bool_param',
'file=jenkins_jobs.modules.parameters:file_param',
'text=jenkins_jobs.modules.parameters:text_param',
'label=jenkins_jobs.modules.parameters:label_param',
'choice=jenkins_jobs.modules.parameters:choice_param',
'validating-string=jenkins_jobs.modules.parameters:'
'authorization=jenkins_jobs.modules.properties:authorization',
],
'jenkins_jobs.parameters': [
'string=jenkins_jobs.modules.parameters:string_param',
'bool=jenkins_jobs.modules.parameters:bool_param',
'file=jenkins_jobs.modules.parameters:file_param',
'text=jenkins_jobs.modules.parameters:text_param',
'label=jenkins_jobs.modules.parameters:label_param',
'choice=jenkins_jobs.modules.parameters:choice_param',
'validating-string=jenkins_jobs.modules.parameters:'
'validating_string_param',
'svn-tags=jenkins_jobs.modules.parameters:svn_tags_param',
],
'jenkins_jobs.notifications': [
'http=jenkins_jobs.modules.notifications:http_endpoint',
],
'jenkins_jobs.publishers': [
'archive=jenkins_jobs.modules.publishers:archive',
'trigger-parameterized-builds='
'jenkins_jobs.modules.publishers:trigger_parameterized_builds',
'trigger=jenkins_jobs.modules.publishers:trigger',
'coverage=jenkins_jobs.modules.publishers:coverage',
'ftp=jenkins_jobs.modules.publishers:ftp',
'junit=jenkins_jobs.modules.publishers:junit',
'xunit=jenkins_jobs.modules.publishers:xunit',
'violations=jenkins_jobs.modules.publishers:violations',
'scp=jenkins_jobs.modules.publishers:scp',
'pipeline=jenkins_jobs.modules.publishers:pipeline',
'email=jenkins_jobs.modules.publishers:email',
'claim-build=jenkins_jobs.modules.publishers:claimbuild',
'email-ext=jenkins_jobs.modules.publishers:email_ext',
'fingerprint=jenkins_jobs.modules.publishers:fingerprint',
'aggregate-tests=jenkins_jobs.modules.publishers:aggregate_tests',
],
'jenkins_jobs.scm': [
'git=jenkins_jobs.modules.scm:git',
'svn=jenkins_jobs.modules.scm:svn',
],
'jenkins_jobs.triggers': [
'gerrit=jenkins_jobs.modules.triggers:gerrit',
'pollscm=jenkins_jobs.modules.triggers:pollscm',
'timed=jenkins_jobs.modules.triggers:timed',
],
'jenkins_jobs.wrappers': [
'timeout=jenkins_jobs.modules.wrappers:timeout',
'timestamps=jenkins_jobs.modules.wrappers:timestamps',
'ansicolor=jenkins_jobs.modules.wrappers:ansicolor',
'mask-passwords=jenkins_jobs.modules.wrappers:mask_passwords',
'build-name=jenkins_jobs.modules.wrappers:build_name',
'workspace-cleanup=jenkins_jobs.modules.wrappers:'
'svn-tags=jenkins_jobs.modules.parameters:svn_tags_param',
],
'jenkins_jobs.notifications': [
'http=jenkins_jobs.modules.notifications:http_endpoint',
],
'jenkins_jobs.publishers': [
'archive=jenkins_jobs.modules.publishers:archive',
'trigger-parameterized-builds='
'jenkins_jobs.modules.publishers:trigger_parameterized_builds',
'trigger=jenkins_jobs.modules.publishers:trigger',
'coverage=jenkins_jobs.modules.publishers:coverage',
'ftp=jenkins_jobs.modules.publishers:ftp',
'junit=jenkins_jobs.modules.publishers:junit',
'xunit=jenkins_jobs.modules.publishers:xunit',
'violations=jenkins_jobs.modules.publishers:violations',
'scp=jenkins_jobs.modules.publishers:scp',
'pipeline=jenkins_jobs.modules.publishers:pipeline',
'email=jenkins_jobs.modules.publishers:email',
'claim-build=jenkins_jobs.modules.publishers:claimbuild',
'email-ext=jenkins_jobs.modules.publishers:email_ext',
'fingerprint=jenkins_jobs.modules.publishers:fingerprint',
'aggregate-tests=jenkins_jobs.modules.publishers:aggregate_tests',
],
'jenkins_jobs.scm': [
'git=jenkins_jobs.modules.scm:git',
'svn=jenkins_jobs.modules.scm:svn',
],
'jenkins_jobs.triggers': [
'gerrit=jenkins_jobs.modules.triggers:gerrit',
'pollscm=jenkins_jobs.modules.triggers:pollscm',
'timed=jenkins_jobs.modules.triggers:timed',
],
'jenkins_jobs.wrappers': [
'timeout=jenkins_jobs.modules.wrappers:timeout',
'timestamps=jenkins_jobs.modules.wrappers:timestamps',
'ansicolor=jenkins_jobs.modules.wrappers:ansicolor',
'mask-passwords=jenkins_jobs.modules.wrappers:mask_passwords',
'build-name=jenkins_jobs.modules.wrappers:build_name',
'workspace-cleanup=jenkins_jobs.modules.wrappers:'
'workspace_cleanup',
'port-allocator=jenkins_jobs.modules.wrappers:port_allocator',
'locks=jenkins_jobs.modules.wrappers:locks',
],
'jenkins_jobs.modules': [
'assignednode=jenkins_jobs.modules.assignednode:AssignedNode',
'builders=jenkins_jobs.modules.builders:Builders',
'logrotate=jenkins_jobs.modules.logrotate:LogRotate',
'properties=jenkins_jobs.modules.properties:Properties',
'parameters=jenkins_jobs.modules.parameters:Parameters',
'notifications=jenkins_jobs.modules.notifications:Notifications',
'publishers=jenkins_jobs.modules.publishers:Publishers',
'reporters=jenkins_jobs.modules.reporters:Reporters',
'scm=jenkins_jobs.modules.scm:SCM',
'triggers=jenkins_jobs.modules.triggers:Triggers',
'wrappers=jenkins_jobs.modules.wrappers:Wrappers',
'zuul=jenkins_jobs.modules.zuul:Zuul',
'hipchat=jenkins_jobs.modules.hipchat_notif:HipChat',
]
}
)
'port-allocator=jenkins_jobs.modules.wrappers:port_allocator',
'locks=jenkins_jobs.modules.wrappers:locks',
],
'jenkins_jobs.modules': [
'assignednode=jenkins_jobs.modules.assignednode:AssignedNode',
'builders=jenkins_jobs.modules.builders:Builders',
'logrotate=jenkins_jobs.modules.logrotate:LogRotate',
'properties=jenkins_jobs.modules.properties:Properties',
'parameters=jenkins_jobs.modules.parameters:Parameters',
'notifications=jenkins_jobs.modules.notifications:Notifications',
'publishers=jenkins_jobs.modules.publishers:Publishers',
'reporters=jenkins_jobs.modules.reporters:Reporters',
'scm=jenkins_jobs.modules.scm:SCM',
'triggers=jenkins_jobs.modules.triggers:Triggers',
'wrappers=jenkins_jobs.modules.wrappers:Wrappers',
'zuul=jenkins_jobs.modules.zuul:Zuul',
'hipchat=jenkins_jobs.modules.hipchat_notif:HipChat',
]
}
)

View File

@ -9,8 +9,8 @@ deps = -r{toxinidir}/tools/pip-requires
-r{toxinidir}/tools/test-requires
[testenv:pep8]
deps = pep8==1.2
commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc,build,*egg .
deps = pep8==1.3.3
commands = pep8 --repeat --show-source --ignore=E125 --exclude=.venv,.tox,dist,doc,build,*egg .
[testenv:pyflakes]
deps = pyflakes