Apache DataFusion SQL Query Engine
ARROW-8722: [Dev] Pass environment variables to the container when running "archery docker run -e"
Krisztián Szűcsd2bda72d7a9c
diff --git a/ci/docker/conda-cpp.dockerfile b/ci/docker/conda-cpp.dockerfileindex 0e35b6caf6..033427af8b 100644--- a/ci/docker/conda-cpp.dockerfile+++ b/ci/docker/conda-cpp.dockerfile@@ -63,8 +63,8 @@ SHELL [ "/bin/bash", "-c", "-l" ]ENTRYPOINT [ "/bin/bash", "-c", "-l" ]ENV ARROW_BUILD_TESTS=ON \- ARROW_DEPENDENCY_SOURCE=CONDA \ARROW_DATASET=ON \+ ARROW_DEPENDENCY_SOURCE=CONDA \ARROW_FLIGHT=ON \ARROW_GANDIVA=ON \ARROW_HOME=$CONDA_PREFIX \@@ -79,6 +79,6 @@ ENV ARROW_BUILD_TESTS=ON \ARROW_WITH_SNAPPY=ON \ARROW_WITH_ZLIB=ON \ARROW_WITH_ZSTD=ON \- PARQUET_BUILD_EXECUTABLES=ON \PARQUET_BUILD_EXAMPLES=ON \+ PARQUET_BUILD_EXECUTABLES=ON \PARQUET_HOME=$CONDA_PREFIXdiff --git a/dev/archery/archery/__init__.py b/dev/archery/archery/__init__.pynew file mode 100644index 0000000000..13a83393a9--- /dev/null+++ b/dev/archery/archery/__init__.py@@ -0,0 +1,16 @@+# 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.diff --git a/dev/archery/archery/cli.py b/dev/archery/archery/cli.pyindex 19590b4181..8915b65a9d 100644--- a/dev/archery/archery/cli.py+++ b/dev/archery/archery/cli.py@@ -740,10 +740,12 @@ def docker_compose_run(obj, image, command, env, force_pull, force_build,compose._execute = MethodType(_print_command, compose)+ env = dict(kv.split('=') for kv in env)try:compose.run(image,command=command,+ env=env,force_pull=force_pull,force_build=force_build,use_cache=use_cache,diff --git a/dev/archery/archery/tests/test_cli.py b/dev/archery/archery/tests/test_cli.pynew file mode 100644index 0000000000..db5b88d866--- /dev/null+++ b/dev/archery/archery/tests/test_cli.py@@ -0,0 +1,101 @@+# 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 unittest.mock import patch++import pytest+from click.testing import CliRunner++from archery.cli import archery+from archery.docker import DockerCompose++[email protected](('command', 'args', 'kwargs'), [+ (+ ['ubuntu-cpp'],+ ['ubuntu-cpp'],+ dict(+ command=None,+ env={},+ force_pull=True,+ force_build=True,+ use_cache=True,+ use_leaf_cache=True+ )+ ),+ (+ ['ubuntu-cpp', 'bash'],+ ['ubuntu-cpp'],+ dict(+ command='bash',+ env={},+ force_pull=True,+ force_build=True,+ use_cache=True,+ use_leaf_cache=True+ )+ ),+ (+ ['ubuntu-cpp', '--no-pull', '--no-build'],+ ['ubuntu-cpp'],+ dict(+ command=None,+ env={},+ force_pull=False,+ force_build=False,+ use_cache=True,+ use_leaf_cache=True+ )+ ),+ (+ [+ 'ubuntu-cpp', '--no-pull', '--force-build', '--no-cache',+ '--no-leaf-cache'+ ],+ ['ubuntu-cpp'],+ dict(+ command=None,+ env={},+ force_pull=False,+ force_build=True,+ use_cache=False,+ use_leaf_cache=False+ )+ ),+ (+ ['-e', 'ARROW_GANDIVA=OFF', '-e', 'ARROW_FLIGHT=ON', 'ubuntu-cpp'],+ ['ubuntu-cpp'],+ dict(+ command=None,+ env={+ 'ARROW_GANDIVA': 'OFF',+ 'ARROW_FLIGHT': 'ON'+ },+ force_pull=True,+ force_build=True,+ use_cache=True,+ use_leaf_cache=True+ )+ )+])+def test_docker_run(command, args, kwargs):+ runner = CliRunner()++ with patch.object(DockerCompose, 'run') as run:+ result = runner.invoke(archery, ['docker', 'run'] + command)+ assert result.exit_code == 0+ run.assert_called_once_with(*args, **kwargs)