Remove deprecated status_url config and format
Remove the deprecated `web.status_url` config option as well as the `status_url`, `change` and `changes` string substitution in pipeline reporter messages. Change-Id: Icccc5057c316ea325fee2b62807e14b201c6ca89
This commit is contained in:
committed by
James E. Blair
parent
183404f05e
commit
2eb2c4cb45
@@ -211,17 +211,6 @@ success, the pipeline reports back to Gerrit with ``Verified`` vote of
|
||||
The name of the pipeline
|
||||
item_url
|
||||
The full URL to information about the item in the web UI
|
||||
change
|
||||
Deprecated: information about the change
|
||||
changes
|
||||
Deprecated: information about the change
|
||||
status_url
|
||||
Deprecated: the configured web ui status page root
|
||||
|
||||
.. warning:: The replacement fields ``change``, ``changes``, and
|
||||
``status_url`` are deprecated. Use ``item_url``,
|
||||
which is automatically the best URL for information
|
||||
about the item instead.
|
||||
|
||||
.. attr:: enqueue-message
|
||||
|
||||
@@ -233,17 +222,6 @@ success, the pipeline reports back to Gerrit with ``Verified`` vote of
|
||||
The name of the pipeline
|
||||
item_url
|
||||
The full URL to information about the item in the web UI
|
||||
change
|
||||
Deprecated: information about the change
|
||||
changes
|
||||
Deprecated: information about the change
|
||||
status_url
|
||||
Deprecated: the configured web ui status page root
|
||||
|
||||
.. warning:: The replacement fields ``change``, ``changes``, and
|
||||
``status_url`` are deprecated. Use ``item_url``,
|
||||
which is automatically the best URL for information
|
||||
about the item instead.
|
||||
|
||||
.. attr:: merge-conflict-message
|
||||
:default: Merge failed.
|
||||
@@ -262,17 +240,6 @@ success, the pipeline reports back to Gerrit with ``Verified`` vote of
|
||||
The name of the pipeline
|
||||
item_url
|
||||
The full URL to information about the item in the web UI
|
||||
change
|
||||
Deprecated: information about the change
|
||||
changes
|
||||
Deprecated: information about the change
|
||||
status_url
|
||||
Deprecated: the configured web ui status page root
|
||||
|
||||
.. warning:: The replacement fields ``change``, ``changes``, and
|
||||
``status_url`` are deprecated. Use ``item_url``,
|
||||
which is automatically the best URL for information
|
||||
about the item instead.
|
||||
|
||||
.. attr:: dequeue-message
|
||||
:default: Build canceled.
|
||||
|
||||
@@ -248,15 +248,6 @@ The following sections of ``zuul.conf`` are used by the scheduler:
|
||||
See :attr:`tenant.web-root` for additional options for
|
||||
whitelabeled tenant configuration.
|
||||
|
||||
.. attr:: status_url
|
||||
|
||||
.. warning:: This is deprecate and only used for the also deprecated
|
||||
``status_url`` replacement field available in pipeline
|
||||
reporter messages.
|
||||
|
||||
URL that will be posted in Zuul comments made to changes when
|
||||
starting jobs for a change.
|
||||
|
||||
.. attr:: keystore
|
||||
|
||||
.. _keystore-password:
|
||||
|
||||
@@ -240,3 +240,9 @@ Version 33
|
||||
:Description: Send SemaphoreReleaseEvents to the tenant management event queue
|
||||
instead of the pipeline trigger event queue.
|
||||
Affects schedulers and executors.
|
||||
|
||||
Version 34
|
||||
----------
|
||||
:Prior Zuul version: 11.3.0
|
||||
:Description: Don't store deprecated web ``status_url`` in system attributes anymore.
|
||||
Affects schedulers and web.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The `web.status_url` configuration option is no longer supported and using
|
||||
the `status_url`, `change` and `changes` string substitutions in pipeline
|
||||
reporter messages will result in an error.
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
- pipeline:
|
||||
name: gate
|
||||
manager: dependent
|
||||
start-message: Jobs started in {pipeline.name} for {change.number},{change.patchset}.
|
||||
start-message: "Jobs started in {pipeline.name}: {item_url}."
|
||||
trigger:
|
||||
gerrit:
|
||||
- event: comment-added
|
||||
|
||||
@@ -28,6 +28,7 @@ from tests.base import (
|
||||
model_version,
|
||||
ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
from zuul import model
|
||||
from zuul.zk import ZooKeeperClient
|
||||
from zuul.zk.branch_cache import BranchCache, BranchFlag
|
||||
from zuul.zk.locks import management_queue_lock
|
||||
@@ -65,6 +66,34 @@ class TestModelUpgrade(ZuulTestCase):
|
||||
if component_registry.model_api == 1:
|
||||
break
|
||||
|
||||
@model_version(33)
|
||||
def test_model_upgrade_33_34(self):
|
||||
|
||||
attrs = model.SystemAttributes.fromDict({
|
||||
"use_relative_priority": True,
|
||||
"max_hold_expiration": 7200,
|
||||
"default_hold_expiration": 3600,
|
||||
"default_ansible_version": "X",
|
||||
"web_root": "/web/root",
|
||||
"websocket_url": "/web/socket",
|
||||
"web_status_url": "ignored",
|
||||
})
|
||||
|
||||
attr_dict = attrs.toDict()
|
||||
self.assertIn("web_status_url", attr_dict)
|
||||
self.assertEqual(attr_dict["web_status_url"], "")
|
||||
|
||||
# Upgrade our component
|
||||
self.model_test_component_info.model_api = 34
|
||||
|
||||
component_registry = ComponentRegistry(self.zk_client)
|
||||
for _ in iterate_timeout(30, "model api to update"):
|
||||
if component_registry.model_api == 34:
|
||||
break
|
||||
|
||||
attr_dict = attrs.toDict()
|
||||
self.assertNotIn("web_status_url", attr_dict)
|
||||
|
||||
|
||||
class TestModelUpgradeGerritCircularDependencies(ZuulTestCase):
|
||||
config_file = "zuul-gerrit-github.conf"
|
||||
|
||||
@@ -5493,7 +5493,10 @@ For CI problems and help debugging, contact ci@example.org"""
|
||||
self.waitUntilSettled()
|
||||
|
||||
self.assertEqual(1, len(self.smtp_messages))
|
||||
start_msg = "Jobs started in gate for 1,1."
|
||||
start_msg = (
|
||||
"Jobs started in gate: "
|
||||
"https://zuul.example.com/t/tenant-one/status/change/1,1."
|
||||
)
|
||||
self.assertTrue(self.smtp_messages[0]['body'].startswith(start_msg))
|
||||
|
||||
@simple_layout('layouts/unmanaged-project.yaml')
|
||||
|
||||
@@ -1597,7 +1597,6 @@ class TestSystemConfigCache(ZooKeeperBaseTestCase):
|
||||
"default_hold_expiration": 3600,
|
||||
"default_ansible_version": "X",
|
||||
"web_root": "/web/root",
|
||||
"web_status_url": "/web/status",
|
||||
"websocket_url": "/web/socket",
|
||||
})
|
||||
self.config_cache.set(uac, attrs)
|
||||
|
||||
+4
-7
@@ -8907,8 +8907,6 @@ class SystemAttributes:
|
||||
self.default_hold_expiration = 0
|
||||
self.default_ansible_version = None
|
||||
self.web_root = None
|
||||
# TODO: Deprecated, remove after version 12
|
||||
self.web_status_url = ""
|
||||
self.websocket_url = None
|
||||
|
||||
def __eq__(self, other):
|
||||
@@ -8920,7 +8918,6 @@ class SystemAttributes:
|
||||
and self.default_hold_expiration == other.default_hold_expiration
|
||||
and self.default_ansible_version == other.default_ansible_version
|
||||
and self.web_root == other.web_root
|
||||
and self.web_status_url == other.web_status_url
|
||||
and self.websocket_url == other.websocket_url)
|
||||
|
||||
@classmethod
|
||||
@@ -8958,19 +8955,20 @@ class SystemAttributes:
|
||||
web_root = urllib.parse.urljoin(web_root, 't/{tenant.name}/')
|
||||
self.web_root = web_root
|
||||
|
||||
self.web_status_url = get_default(config, 'web', 'status_url', '')
|
||||
self.websocket_url = get_default(config, 'web', 'websocket_url', None)
|
||||
|
||||
def toDict(self):
|
||||
return {
|
||||
attributes = {
|
||||
"use_relative_priority": self.use_relative_priority,
|
||||
"max_hold_expiration": self.max_hold_expiration,
|
||||
"default_hold_expiration": self.default_hold_expiration,
|
||||
"default_ansible_version": self.default_ansible_version,
|
||||
"web_root": self.web_root,
|
||||
"web_status_url": self.web_status_url,
|
||||
"websocket_url": self.websocket_url,
|
||||
}
|
||||
if COMPONENT_REGISTRY.model_api < 34:
|
||||
attributes["web_status_url"] = ""
|
||||
return attributes
|
||||
|
||||
@classmethod
|
||||
def fromDict(cls, data):
|
||||
@@ -8980,7 +8978,6 @@ class SystemAttributes:
|
||||
sys_attrs.default_hold_expiration = data["default_hold_expiration"]
|
||||
sys_attrs.default_ansible_version = data["default_ansible_version"]
|
||||
sys_attrs.web_root = data["web_root"]
|
||||
sys_attrs.web_status_url = data["web_status_url"]
|
||||
sys_attrs.websocket_url = data["websocket_url"]
|
||||
return sys_attrs
|
||||
|
||||
|
||||
+1
-1
@@ -14,4 +14,4 @@
|
||||
|
||||
# When making ZK schema changes, increment this and add a record to
|
||||
# doc/source/developer/model-changelog.rst
|
||||
MODEL_API = 33
|
||||
MODEL_API = 34
|
||||
|
||||
@@ -186,28 +186,14 @@ class BaseReporter(object, metaclass=abc.ABCMeta):
|
||||
return ret
|
||||
|
||||
def _formatItemReportEnqueue(self, item, change, with_jobs=True):
|
||||
if status_url := self.connection.sched.globals.web_status_url:
|
||||
status_url = item.formatUrlPattern(status_url)
|
||||
|
||||
# change, changes, and status_url are deprecated
|
||||
return item.manager.pipeline.enqueue_message.format(
|
||||
pipeline=item.manager.pipeline.getSafeAttributes(),
|
||||
change=item.changes[0].getSafeAttributes(),
|
||||
changes=[c.getSafeAttributes() for c in item.changes],
|
||||
item_url=item.formatItemUrl(),
|
||||
status_url=status_url)
|
||||
item_url=item.formatItemUrl())
|
||||
|
||||
def _formatItemReportStart(self, item, change, with_jobs=True):
|
||||
if status_url := self.connection.sched.globals.web_status_url:
|
||||
status_url = item.formatUrlPattern(status_url)
|
||||
|
||||
# change, changes, and status_url are deprecated
|
||||
return item.manager.pipeline.start_message.format(
|
||||
pipeline=item.manager.pipeline.getSafeAttributes(),
|
||||
change=item.changes[0].getSafeAttributes(),
|
||||
changes=[c.getSafeAttributes() for c in item.changes],
|
||||
item_url=item.formatItemUrl(),
|
||||
status_url=status_url)
|
||||
item_url=item.formatItemUrl())
|
||||
|
||||
def _formatItemReportSuccess(self, item, change, with_jobs=True):
|
||||
msg = item.manager.pipeline.success_message
|
||||
@@ -296,16 +282,9 @@ class BaseReporter(object, metaclass=abc.ABCMeta):
|
||||
return msg
|
||||
|
||||
def _formatItemReportNoJobs(self, item, change, with_jobs=True):
|
||||
if status_url := self.connection.sched.globals.web_status_url:
|
||||
status_url = item.formatUrlPattern(status_url)
|
||||
|
||||
# change, changes, and status_url are deprecated
|
||||
return item.manager.pipeline.no_jobs_message.format(
|
||||
pipeline=item.manager.pipeline.getSafeAttributes(),
|
||||
change=item.changes[0].getSafeAttributes(),
|
||||
changes=[c.getSafeAttributes() for c in item.changes],
|
||||
item_url=item.formatItemUrl(),
|
||||
status_url=status_url)
|
||||
item_url=item.formatItemUrl())
|
||||
|
||||
def _formatItemReportDisabled(self, item, change, with_jobs=True):
|
||||
if item.current_build_set.result == 'SUCCESS':
|
||||
|
||||
Reference in New Issue
Block a user