Skip to content

Commit 2ce3925

Browse files
authored
Block update change to labels mode (Azure#8927)
1 parent 5bbdbab commit 2ce3925

File tree

4 files changed

+5059
-0
lines changed

4 files changed

+5059
-0
lines changed

src/containerapp/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Release History
44
===============
55
upcoming
66
++++++
7+
* 'az containerapp update/up': Disallow changing `--revisions-mode` to Labels.
78
* 'az containerapp session code-interpreter': Fix `--path` in examples
89
* 'az containerapp env premium-ingress': Deprecate `--min-replicas` and `--max-replicas` parameters, use workload profile scale instead.
910

src/containerapp/azext_containerapp/containerapp_decorator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ def validate_arguments(self):
143143
if not self.containerapp_def:
144144
raise ResourceNotFoundError("The containerapp '{}' does not exist".format(self.get_argument_name()))
145145

146+
# Transitioning into labels mode is complicated and we don't want to combine it with other updates.
147+
# If the app was not previously in labels mode throw an error saying to use Set-Mode instead.
148+
if (self.get_argument_revisions_mode()
149+
and self.get_argument_revisions_mode().lower() == "labels"
150+
and safe_get(self.containerapp_def, "properties", "configuration", "activeRevisionsMode").lower() != "labels"):
151+
raise ArgumentUsageError("The containerapp '{}' is not in labels mode. Please use `az containerapp revision set-mode` to switch to labels mode first.".format(
152+
self.get_argument_name()))
153+
146154
validate_revision_suffix(self.get_argument_revision_suffix())
147155
# Validate that max_replicas is set to 0-1000
148156
if self.get_argument_max_replicas() is not None:

0 commit comments

Comments
 (0)