From 4d0042c02b080138588f0ce94bf9ccbfc87c1ac3 Mon Sep 17 00:00:00 2001 From: Danyal-Faheem Date: Fri, 30 Aug 2024 19:37:04 +0500 Subject: [PATCH] fix: change lexicographical based comparison to numerical comparison to handle edge cases --- tutor/templates/k8s/deployments.yml | 6 +++++- tutor/templates/local/docker-compose.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tutor/templates/k8s/deployments.yml b/tutor/templates/k8s/deployments.yml index cfc62cf64d..fe1fd415d9 100644 --- a/tutor/templates/k8s/deployments.yml +++ b/tutor/templates/k8s/deployments.yml @@ -397,7 +397,11 @@ spec: - "--character-set-server=utf8mb4" - "--collation-server=utf8mb4_unicode_ci" - "--binlog-expire-logs-seconds=259200" - {% if DOCKER_IMAGE_MYSQL >= "docker.io/mysql:8.4.0" -%}- "--mysql-native-password=ON"{%- endif %} + # We only require this option for MySQL 8.4 and above + # Breaks MySQL for previous versions as this option does not exist on versions earlier than 8.4 + {% if DOCKER_IMAGE_MYSQL.split(':')[-1].split('.') | map('int') | list >= '8.4.0'.split('.') | map('int') | list -%} + - "--mysql-native-password=ON" + {%- endif %} env: - name: MYSQL_ROOT_PASSWORD value: "{{ MYSQL_ROOT_PASSWORD }}" diff --git a/tutor/templates/local/docker-compose.yml b/tutor/templates/local/docker-compose.yml index 7b172e53aa..3b764fdd99 100644 --- a/tutor/templates/local/docker-compose.yml +++ b/tutor/templates/local/docker-compose.yml @@ -44,7 +44,11 @@ services: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --binlog-expire-logs-seconds=259200 - {% if DOCKER_IMAGE_MYSQL >= "docker.io/mysql:8.4.0" -%}--mysql-native-password=ON{%- endif %} + # We only require this option for MySQL 8.4 and above + # Breaks MySQL for previous versions as this option does not exist on versions earlier than 8.4 + {% if DOCKER_IMAGE_MYSQL.split(':')[-1].split('.') | map('int') | list >= '8.4.0'.split('.') | map('int') | list -%} + --mysql-native-password=ON + {%- endif %} restart: unless-stopped user: "999:999" volumes: