summaryrefslogtreecommitdiff
path: root/zuul
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-03-02 21:10:38 +0000
committerGerrit Code Review <review@openstack.org>2022-03-02 21:10:38 +0000
commit3784a8d264a62a235a1c157a667d8d8ec30b6309 (patch)
tree11e5be3faf4aa3e0b609a0f3d31e1b84999f8580 /zuul
parent78cbfe9a189a1061dc865d3b9cdd0234547d845a (diff)
parente03d8c887c092367b9ff2b00b48f244d4f6584f9 (diff)
downloadzuul-3784a8d264a62a235a1c157a667d8d8ec30b6309.tar.gz
Merge "Rename MERGER_FAILURE to MERGE_CONFLICT"
Diffstat (limited to 'zuul')
-rw-r--r--zuul/configloader.py28
-rw-r--r--zuul/driver/gitlab/gitlabreporter.py2
-rw-r--r--zuul/driver/pagure/pagurereporter.py2
-rw-r--r--zuul/driver/sql/alembic/versions/4647def24b32_merge_conflict_rename.py42
-rw-r--r--zuul/driver/sql/sqlconnection.py6
-rw-r--r--zuul/executor/server.py2
-rw-r--r--zuul/manager/__init__.py12
-rw-r--r--zuul/model.py6
-rw-r--r--zuul/reporter/__init__.py8
-rw-r--r--zuul/scheduler.py5
10 files changed, 84 insertions, 29 deletions
diff --git a/zuul/configloader.py b/zuul/configloader.py
index 2ee732c13..e0cf88d12 100644
--- a/zuul/configloader.py
+++ b/zuul/configloader.py
@@ -1148,7 +1148,7 @@ class PipelineParser(object):
'start': 'start_actions',
'success': 'success_actions',
'failure': 'failure_actions',
- 'merge-failure': 'merge_failure_actions',
+ 'merge-conflict': 'merge_conflict_actions',
'no-jobs': 'no_jobs_actions',
'disabled': 'disabled_actions',
'dequeue': 'dequeue_actions',
@@ -1198,6 +1198,7 @@ class PipelineParser(object):
'success-message': str,
'failure-message': str,
'start-message': str,
+ 'merge-conflict-message': str,
'merge-failure-message': str,
'no-jobs-message': str,
'footer-message': str,
@@ -1220,7 +1221,8 @@ class PipelineParser(object):
pipeline['reject'] = self.getDriverSchema('reject')
pipeline['trigger'] = vs.Required(self.getDriverSchema('trigger'))
for action in ['enqueue', 'start', 'success', 'failure',
- 'merge-failure', 'no-jobs', 'disabled', 'dequeue']:
+ 'merge-conflict', 'merge-failure', 'no-jobs',
+ 'disabled', 'dequeue']:
pipeline[action] = self.getDriverSchema('reporter')
return vs.Schema(pipeline)
@@ -1236,12 +1238,16 @@ class PipelineParser(object):
pipeline.precedence = precedence
pipeline.failure_message = conf.get('failure-message',
"Build failed.")
- pipeline.merge_failure_message = conf.get(
+ # TODO: Remove in Zuul v6.0
+ backwards_compat_merge_message = conf.get(
'merge-failure-message', "Merge Failed.\n\nThis change or one "
"of its cross-repo dependencies was unable to be "
"automatically merged with the current state of its "
"repository. Please rebase the change and upload a new "
"patchset.")
+ pipeline.merge_conflict_message = conf.get(
+ 'merge-conflict-message', backwards_compat_merge_message)
+
pipeline.success_message = conf.get('success-message',
"Build succeeded.")
pipeline.footer_message = conf.get('footer-message', "")
@@ -1259,12 +1265,18 @@ class PipelineParser(object):
pipeline.post_review = conf.get(
'post-review', False)
+ # TODO: Remove in Zuul v6.0
+ # Make a copy to manipulate for backwards compat.
+ conf_copy = conf.copy()
+ if 'merge-failure' in conf_copy and 'merge-conflict' not in conf_copy:
+ conf_copy['merge-conflict'] = conf_copy['merge-failure']
+
for conf_key, action in self.reporter_actions.items():
reporter_set = []
allowed_reporters = self.pcontext.tenant.allowed_reporters
- if conf.get(conf_key):
+ if conf_copy.get(conf_key):
for reporter_name, params \
- in conf.get(conf_key).items():
+ in conf_copy.get(conf_key).items():
if allowed_reporters is not None and \
reporter_name not in allowed_reporters:
raise UnknownConnection(reporter_name)
@@ -1274,9 +1286,9 @@ class PipelineParser(object):
reporter_set.append(reporter)
setattr(pipeline, action, reporter_set)
- # If merge-failure actions aren't explicit, use the failure actions
- if not pipeline.merge_failure_actions:
- pipeline.merge_failure_actions = pipeline.failure_actions
+ # If merge-conflict actions aren't explicit, use the failure actions
+ if not pipeline.merge_conflict_actions:
+ pipeline.merge_conflict_actions = pipeline.failure_actions
pipeline.disable_at = conf.get(
'disable-after-consecutive-failures', None)
diff --git a/zuul/driver/gitlab/gitlabreporter.py b/zuul/driver/gitlab/gitlabreporter.py
index c3abf3dd8..f364521f5 100644
--- a/zuul/driver/gitlab/gitlabreporter.py
+++ b/zuul/driver/gitlab/gitlabreporter.py
@@ -69,7 +69,7 @@ class GitlabReporter(BaseReporter):
if self._merge:
self.mergeMR(item)
if not item.change.is_merged:
- msg = self._formatItemReportMergeFailure(item)
+ msg = self._formatItemReportMergeConflict(item)
self.addMRComment(item, msg)
def addMRComment(self, item, comment=None):
diff --git a/zuul/driver/pagure/pagurereporter.py b/zuul/driver/pagure/pagurereporter.py
index e6f33ef47..918a31b6b 100644
--- a/zuul/driver/pagure/pagurereporter.py
+++ b/zuul/driver/pagure/pagurereporter.py
@@ -60,7 +60,7 @@ class PagureReporter(BaseReporter):
if self._merge:
self.mergePull(item)
if not item.change.is_merged:
- msg = self._formatItemReportMergeFailure(item)
+ msg = self._formatItemReportMergeConflict(item)
self.addPullComment(item, msg)
def _formatItemReportJobs(self, item):
diff --git a/zuul/driver/sql/alembic/versions/4647def24b32_merge_conflict_rename.py b/zuul/driver/sql/alembic/versions/4647def24b32_merge_conflict_rename.py
new file mode 100644
index 000000000..64be6fe8f
--- /dev/null
+++ b/zuul/driver/sql/alembic/versions/4647def24b32_merge_conflict_rename.py
@@ -0,0 +1,42 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+"""merge_conflict_rename
+
+Revision ID: 4647def24b32
+Revises: c57e9e76b812
+Create Date: 2022-02-24 14:56:52.597907
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '4647def24b32'
+down_revision = 'c57e9e76b812'
+branch_labels = None
+depends_on = None
+
+from alembic import op
+import sqlalchemy as sa
+
+BUILDSET_TABLE = 'zuul_buildset'
+
+
+def upgrade(table_prefix=''):
+ buildset = sa.table(table_prefix + BUILDSET_TABLE, sa.column('result'))
+ op.execute(buildset.update().
+ where(buildset.c.result ==
+ op.inline_literal('MERGER_FAILURE')).
+ values({'result': op.inline_literal('MERGE_CONFLICT')}))
+
+
+def downgrade():
+ raise Exception("Downgrades not supported")
diff --git a/zuul/driver/sql/sqlconnection.py b/zuul/driver/sql/sqlconnection.py
index 2f9195988..8dd5f9d44 100644
--- a/zuul/driver/sql/sqlconnection.py
+++ b/zuul/driver/sql/sqlconnection.py
@@ -284,7 +284,7 @@ class SQLConnection(BaseConnection):
def getSession(self):
return DatabaseSession(self)
- def _migrate(self):
+ def _migrate(self, revision='head'):
"""Perform the alembic migrations for this connection"""
with self.engine.begin() as conn:
context = alembic.migration.MigrationContext.configure(conn)
@@ -304,9 +304,9 @@ class SQLConnection(BaseConnection):
if current_rev is None and not self.force_migrations:
self.metadata.create_all(self.engine)
- alembic.command.stamp(config, "head", tag=tag)
+ alembic.command.stamp(config, revision, tag=tag)
else:
- alembic.command.upgrade(config, 'head', tag=tag)
+ alembic.command.upgrade(config, revision, tag=tag)
def onLoad(self, zk_client, component_registry=None):
safe_connection = quote_plus(self.connection_name)
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index ad94b41ce..3129c4595 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -1616,7 +1616,7 @@ class AnsibleJob(object):
self.executor_server.completeBuild(self.build_request, result)
return None
if not ret: # merge conflict
- result = dict(result='MERGER_FAILURE')
+ result = dict(result='MERGE_CONFLICT')
if self.executor_server.statsd:
base_key = "zuul.executor.{hostname}.merger"
self.executor_server.statsd.incr(base_key + ".FAILURE")
diff --git a/zuul/manager/__init__.py b/zuul/manager/__init__.py
index afaec4e25..d82d0d4a0 100644
--- a/zuul/manager/__init__.py
+++ b/zuul/manager/__init__.py
@@ -1862,14 +1862,14 @@ class PipelineManager(metaclass=ABCMeta):
elif item.getConfigErrors():
log.debug("Invalid config for change %s", item.change)
# TODOv3(jeblair): consider a new reporter action for this
- action = 'merge-failure'
- actions = self.pipeline.merge_failure_actions
+ action = 'merge-conflict'
+ actions = self.pipeline.merge_conflict_actions
item.setReportedResult('CONFIG_ERROR')
elif item.didMergerFail():
- log.debug("Merger failure")
- action = 'merge-failure'
- actions = self.pipeline.merge_failure_actions
- item.setReportedResult('MERGER_FAILURE')
+ log.debug("Merge conflict")
+ action = 'merge-conflict'
+ actions = self.pipeline.merge_conflict_actions
+ item.setReportedResult('MERGE_CONFLICT')
elif item.wasDequeuedNeedingChange():
log.debug("Dequeued needing change")
action = 'failure'
diff --git a/zuul/model.py b/zuul/model.py
index 9a3334d20..857be8b9a 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -430,7 +430,7 @@ class Pipeline(object):
self.start_mark = None
self.description = None
self.failure_message = None
- self.merge_failure_message = None
+ self.merge_conflict_message = None
self.success_message = None
self.footer_message = None
self.enqueue_message = None
@@ -448,7 +448,7 @@ class Pipeline(object):
self.start_actions = []
self.success_actions = []
self.failure_actions = []
- self.merge_failure_actions = []
+ self.merge_conflict_actions = []
self.no_jobs_actions = []
self.disabled_actions = []
self.dequeue_actions = []
@@ -473,7 +473,7 @@ class Pipeline(object):
self.start_actions +
self.success_actions +
self.failure_actions +
- self.merge_failure_actions +
+ self.merge_conflict_actions +
self.no_jobs_actions +
self.disabled_actions +
self.dequeue_actions
diff --git a/zuul/reporter/__init__.py b/zuul/reporter/__init__.py
index 1749f8a63..3372c8ae5 100644
--- a/zuul/reporter/__init__.py
+++ b/zuul/reporter/__init__.py
@@ -122,7 +122,7 @@ class BaseReporter(object, metaclass=abc.ABCMeta):
'start': self._formatItemReportStart,
'success': self._formatItemReportSuccess,
'failure': self._formatItemReportFailure,
- 'merge-failure': self._formatItemReportMergeFailure,
+ 'merge-conflict': self._formatItemReportMergeConflict,
'no-jobs': self._formatItemReportNoJobs,
'disabled': self._formatItemReportDisabled,
'dequeue': self._formatItemReportDequeue,
@@ -186,7 +186,7 @@ class BaseReporter(object, metaclass=abc.ABCMeta):
msg = "{}\n\n{}".format(
msg, self._formatItemReportOtherBundleItems(item))
elif item.didMergerFail():
- msg = item.pipeline.merge_failure_message
+ msg = item.pipeline.merge_conflict_message
elif item.getConfigErrors():
msg = str(item.getConfigErrors()[0].error)
else:
@@ -195,8 +195,8 @@ class BaseReporter(object, metaclass=abc.ABCMeta):
msg += '\n\n' + self._formatItemReportJobs(item)
return msg
- def _formatItemReportMergeFailure(self, item, with_jobs=True):
- return item.pipeline.merge_failure_message
+ def _formatItemReportMergeConflict(self, item, with_jobs=True):
+ return item.pipeline.merge_conflict_message
def _formatItemReportNoJobs(self, item, with_jobs=True):
status_url = get_default(self.connection.sched.config,
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index 26fa6ac51..1449e6488 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -2453,8 +2453,9 @@ class Scheduler(threading.Thread):
if result == "ABORTED":
# Always retry if the executor just went away
build.retry = True
- if result == "MERGER_FAILURE":
- # The build result MERGER_FAILURE is a bit misleading here
+ # TODO: Remove merger_failure in v6.0
+ if result in ["MERGE_CONFLICT", "MERGER_FAILURE"]:
+ # The build result MERGE_CONFLICT is a bit misleading here
# because when we got here we know that there are no merge
# conflicts. Instead this is most likely caused by some
# infrastructure failure. This can be anything like connection