mik-laj commented on a change in pull request #20338:
URL: https://github.com/apache/airflow/pull/20338#discussion_r775831326



##########
File path: dev/breeze/src/airflow_breeze/ci/build_image.py
##########
@@ -0,0 +1,93 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+# from airflow_breeze.utils import run_command
+import os
+import shlex
+
+from airflow_breeze.breeze import get_airflow_sources_root
+from airflow_breeze.cache import check_cache_and_write_if_not_cached
+from airflow_breeze.ci.build_params import BuildParams
+from airflow_breeze.utils import run_command
+
+PARAMS_CI_IMAGE = [
+    "python_base_image",
+    "airflow_version",
+    "airflow_branch",
+    "airflow_extras",
+    "airflow_pre_cached_pip_packages",
+    "additional_airflow_extras",
+    "additional_python_deps",
+    "additional_dev_apt_command",
+    "additional_dev_apt_deps",
+    "additional_dev_apt_env",
+    "additional_runtime_apt_command",
+    "additional_runtime_apt_deps",
+    "additional_runtime_apt_env",
+    "upgrade_to_newer_dependencies",
+    "constraints_github_repository",
+    "airflow_constraints_reference",
+    "airflow_constraints",
+    "airflow_image_repository",
+    "airflow_image_date_created",
+    "build_id",
+    "commit_sha",
+]
+
+PARAMS_TO_VERIFY_CI_IMAGE = [
+    "dev_apt_command",
+    "dev_apt_deps",
+    "runtime_apt_command",
+    "runtime_apt_deps",
+]
+
+
+def construct_arguments_docker_command(ci_image: BuildParams) -> str:
+    args_command = ""
+    for param in PARAMS_CI_IMAGE:
+        args_command += " --build-arg " + param.upper() + "=" + 
str(getattr(ci_image, param))
+    for verify_param in PARAMS_TO_VERIFY_CI_IMAGE:
+        param_value = str(getattr(ci_image, verify_param))
+        if len(param_value) > 0:
+            args_command += " --build-arg " + verify_param.upper() + "=" + 
param_value
+    args_command += " " + ci_image.docker_cache_ci_directive

Review comment:
       ```suggestion
       args_command = []
       for param in PARAMS_CI_IMAGE:
           args_command += ["--build-arg", 
f"{param.upper()}={str(getattr(ci_image, param))}]
       for verify_param in PARAMS_TO_VERIFY_CI_IMAGE:
           param_value = str(getattr(ci_image, verify_param))
           if len(param_value) > 0:
               args_command += ["--build-arg", 
f"{verify_param.upper()}={param_value}"]
       args_command += ci_image.docker_cache_ci_directive
   ```




-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to