This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit d90852615817941ce6aeae163431258ebaee9964
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue Mar 23 03:20:23 2021 +0100

    Fixes default group of Airflow user. (#14944)
    
    The production image did not have root group set as default for
    the airflow user. This was not a big problem unless you extended
    the image - in which case you had to change the group manually
    when copying the images in order to keep the image OpenShift
    compatible (i.e. runnable with any user and root group).
    
    This PR fixes it by changing default group of airflow user
    to root, which also works when you extend the image.
    
    ```
    Connected.
    airflow@53f70b1e3675:/opt/airflow$ ls
    dags  logs
    airflow@53f70b1e3675:/opt/airflow$ cd dags/
    airflow@53f70b1e3675:/opt/airflow/dags$ ls -l
    total 4
    -rw-r--r-- 1 airflow root 1648 Mar 22 23:16 test_dag.py
    airflow@53f70b1e3675:/opt/airflow/dags$
    ```
---
 Dockerfile                    | 2 ++
 scripts/ci/libraries/_kind.sh | 8 ++------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index a62ce15..4b1b807 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -485,6 +485,8 @@ WORKDIR ${AIRFLOW_HOME}
 
 EXPOSE 8080
 
+RUN usermod -g 0 airflow
+
 USER ${AIRFLOW_UID}
 
 # Having the variable in final image allows to disable providers manager 
warnings when
diff --git a/scripts/ci/libraries/_kind.sh b/scripts/ci/libraries/_kind.sh
index f6be375..4fbfee1 100644
--- a/scripts/ci/libraries/_kind.sh
+++ b/scripts/ci/libraries/_kind.sh
@@ -255,13 +255,9 @@ function kind::build_image_for_kubernetes_tests() {
     docker build --tag "${AIRFLOW_PROD_IMAGE_KUBERNETES}" . -f - <<EOF
 FROM ${AIRFLOW_PROD_IMAGE}
 
-USER root
+COPY airflow/example_dags/ \${AIRFLOW_HOME}/dags/
 
-COPY --chown=airflow:root airflow/example_dags/ \${AIRFLOW_HOME}/dags/
-
-COPY --chown=airflow:root airflow/kubernetes_executor_templates/ 
\${AIRFLOW_HOME}/pod_templates/
-
-USER airflow
+COPY airflow/kubernetes_executor_templates/ \${AIRFLOW_HOME}/pod_templates/
 
 EOF
     echo "The ${AIRFLOW_PROD_IMAGE_KUBERNETES} is prepared for test kubernetes 
deployment."

Reply via email to