Merge "Emit deprecation warning on old format use with gerrit trigger"

This commit is contained in:
Jenkins 2014-11-14 19:14:17 +00:00 committed by Gerrit Code Review
commit c3fae9b348
2 changed files with 21 additions and 14 deletions

View File

@ -41,6 +41,8 @@ import re
def gerrit_handle_legacy_configuration(data):
hyphenizer = re.compile("[A-Z]")
logger = logging.getLogger("%s:gerrit" % __name__)
def hyphenize(attr):
"""Convert strings like triggerOn to trigger-on.
"""
@ -50,7 +52,10 @@ def gerrit_handle_legacy_configuration(data):
def convert_dict(d, old_keys):
for old_key in old_keys:
if old_key in d:
d[hyphenize(old_key)] = d[old_key]
new_key = hyphenize(old_key)
logger.warn("'%s' is deprecated and will be removed after "
"1.0.0, please use '%s' instead", old_key, new_key)
d[new_key] = d[old_key]
del d[old_key]
convert_dict(data, [
@ -222,7 +227,8 @@ def gerrit(parser, xml_parent, data):
Until version 0.4.0 of Jenkins Job Builder, camelCase keys were used to
configure Gerrit Trigger Plugin, instead of hyphenated-keys. While still
supported, camedCase keys are deprecated and should not be used.
supported, camedCase keys are deprecated and should not be used. Support
for this will be removed after 1.0.0 is released.
Example:

View File

@ -38,19 +38,20 @@
name: gerrit-review
triggers:
- gerrit:
triggerOnPatchsetUploadedEvent: true
triggerOnChangeMergedEvent: false
triggerOnRefUpdatedEvent: false
triggerOnCommentAddedEvent: false
overrideVotes: true
gerritBuildSuccessfulVerifiedValue: 1
gerritBuildFailedVerifiedValue: -1
trigger-on-patchset-uploaded-event: true
trigger-on-change-merged-event: false
trigger-on-ref-updated-event: false
trigger-on-comment-added-event: false
override-votes: true
gerrit-build-successful-verified-value: 1
gerrit-build-failed-verified-value: -1
projects:
- projectCompareType: 'PLAIN'
projectPattern: '{project_pattern}'
branchCompareType: 'ANT'
branchPattern: '**'
failureMessage: 'This change was unable to be automatically merged with the current state of the repository. Please rebase your change and upload a new patchset.'
- project-compare-type: 'PLAIN'
project-pattern: '{project_pattern}'
branches:
- branch-compare-type: 'ANT'
branch-pattern: '**'
failure-message: 'This change was unable to be automatically merged with the current state of the repository. Please rebase your change and upload a new patchset.'
- scm:
name: gerrit-scm