potiuk commented on code in PR #33722:
URL: https://github.com/apache/airflow/pull/33722#discussion_r1305961293


##########
Dockerfile:
##########
@@ -222,33 +229,74 @@ install_mysql_client() {
         gpg --keyserver "${keyserver}" --recv-keys "${key}" 2>&1 && break
     done
     set -e
-    gpg --export "${key}" > /etc/apt/trusted.gpg.d/mysql.gpg
+    gpg --export "${key}" > "/etc/apt/trusted.gpg.d/${name}.gpg"
     gpgconf --kill all
     rm -rf "${GNUPGHOME}"
     unset GNUPGHOME
-    echo "deb http://repo.mysql.com/apt/debian/ $(lsb_release -cs) 
mysql-${MYSQL_VERSION}" > /etc/apt/sources.list.d/mysql.list
+}
+
+install_mysql_client() {
+    if [[ "${1}" != "dev" && "${1}" != "prod" ]]; then
+        echo
+        echo "${COLOR_RED}Specify either prod or dev${COLOR_RESET}"
+        echo
+        exit 1
+    fi
+
+    local mysql_version="${MYSQL_LTS_VERSION}"
+    local mysql_path="mysql-${MYSQL_LTS_VERSION}"
+    if ! version_lte "${MYSQL_INNOVATION_RELEASE}" "${MYSQL_LTS_VERSION}"; then
+        mysql_version="${MYSQL_INNOVATION_RELEASE}"
+        mysql_path="mysql-innovation"
+    fi
+    readonly mysql_version
+    readonly mysql_path
+
+    export_key "467B942D3A79BD29" "mysql"
+
+    echo
+    echo "${COLOR_BLUE}Installing mysql client version ${mysql_version}: 
${1}${COLOR_RESET}"
+    echo
+
+    echo "deb http://repo.mysql.com/apt/debian/ $(lsb_release -cs) 
${mysql_path}" > /etc/apt/sources.list.d/mysql.list
     apt-get update
+    if [[ "${1}" == "prod" ]]; then
+        packages=("mysql-client" "$(current_libmysqlclient)")
+    else
+        packages=("libmysqlclient-dev" "mysql-client")
+    fi
     apt-get install --no-install-recommends -y "${packages[@]}"
     apt-get autoremove -yqq --purge
     apt-get clean && rm -rf /var/lib/apt/lists/*
 }
 
 install_mariadb_client() {
+    # Different naming against Debian repo, we used `libmariadb-dev` as 
replacement of `libmysqlclient-dev`,

Review Comment:
   Nice



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to