Apache DataFusion SQL Query Engine
ARROW-4909: [CI] Use hadolint to lint Dockerfiles
Krisztián Szűcs713524050e8d
diff --git a/.hadolint.yaml b/.hadolint.yamlnew file mode 100644index 0000000000..33190e80a3--- /dev/null+++ b/.hadolint.yaml@@ -0,0 +1,21 @@+# 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.++ignored:+ - DL3008+ - DL3013+ - DL3018diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 8823164fc2..d72b126ef3 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -24,13 +24,13 @@ repos:- repo: localhooks:- id: rat- name: rat+ name: Release Audit Toollanguage: systementry: bash -c "git archive HEAD --prefix=apache-arrow/ --output=arrow-src.tar && ./dev/release/run-rat.sh arrow-src.tar"always_run: truepass_filenames: false- id: rustfmt- name: rustfmt+ name: Rust Formatlanguage: systementry: bash -c "cd rust && cargo +stable fmt --all -- --check"files: ^rust/.*\.rs$@@ -38,20 +38,29 @@ repos:- file- rust- id: cmake-format- name: cmake-format+ name: CMake Formatlanguage: pythonentry: bash -c "pip install cmake-format && python run-cmake-format.py --check"entry: echofiles: ^(.*/CMakeLists.txt|.*.cmake)$+ - id: hadolint+ name: Docker Format+ language: docker_image+ types:+ - dockerfile+ entry: --entrypoint /bin/hadolint hadolint/hadolint:latest -+ exclude: ^dev/.*$- repo: git://github.com/pre-commit/pre-commit-hookssha: v1.2.3hooks:- id: flake8+ name: Python Formatfiles: ^(python|crossbow|integration)/types:- file- python- id: flake8+ name: Cython Formatfiles: ^python/types:- filediff --git a/.travis.yml b/.travis.ymlindex ea4d609988..f5b6fd79c2 100644--- a/.travis.yml+++ b/.travis.yml@@ -46,7 +46,7 @@ before_install:matrix:fast_finish: trueinclude:- - name: "Lint C++, Python, R"+ - name: "Lint C++, Python, R, Docker"os: linuxlanguage: pythonpython: "3.6"diff --git a/ci/docker_build_and_test_cpp.sh b/ci/docker_build_and_test_cpp.shnew file mode 100755index 0000000000..ff332213dc--- /dev/null+++ b/ci/docker_build_and_test_cpp.sh@@ -0,0 +1,24 @@+#!/usr/bin/env bash+# 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.++set -e++/arrow/ci/docker_build_cpp.sh+pushd /build/cpp+ninja test+popddiff --git a/ci/docker_build_and_test_python.sh b/ci/docker_build_and_test_python.shnew file mode 100755index 0000000000..ce555b7d24--- /dev/null+++ b/ci/docker_build_and_test_python.sh@@ -0,0 +1,23 @@+#!/usr/bin/env bash+# 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.++set -e++/arrow/ci/docker_build_cpp.sh+/arrow/ci/docker_build_python.sh+pytest -v --pyargs pyarrowdiff --git a/ci/travis_lint.sh b/ci/travis_lint.shindex f99a7f26f6..1c36eaf08a 100755--- a/ci/travis_lint.sh+++ b/ci/travis_lint.sh@@ -23,6 +23,13 @@ set -exexport ARROW_TRAVIS_USE_TOOLCHAIN=0source $TRAVIS_BUILD_DIR/ci/travis_env_common.sh+pip install pre_commit+pre-commit install++# TODO: Move more checks into pre-commit as this gives a nice summary+# and doesn't abort on the first failed check.+pre-commit run hadolint -a+# CMake formatting checkpip install cmake_format$TRAVIS_BUILD_DIR/run-cmake-format.py --checkdiff --git a/integration/dask/Dockerfile b/integration/dask/Dockerfileindex 5e054c51c5..ceadb3ef8b 100644--- a/integration/dask/Dockerfile+++ b/integration/dask/Dockerfile@@ -17,15 +17,11 @@FROM arrow:python-3.6-# setup /etc/localtime-RUN DEBIAN_FRONTEND=noninteractive \- apt-get install -y -q tzdata-# install dask release from condaRUN conda install -c conda-forge dask pytest=3 && \conda clean --all# build and test-CMD arrow/ci/docker_build_cpp.sh && \+CMD ["/bin/bash", "-c", "arrow/ci/docker_build_cpp.sh && \arrow/ci/docker_build_python.sh && \- arrow/integration/dask/runtest.sh+ arrow/integration/dask/runtest.sh"]diff --git a/integration/hdfs/Dockerfile b/integration/hdfs/Dockerfileindex 7ad22f342f..8744b795f9 100644--- a/integration/hdfs/Dockerfile+++ b/integration/hdfs/Dockerfile@@ -24,12 +24,14 @@ ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 \HADOOP_OPTS=-Djava.library.path=/usr/local/hadoop/lib/native \PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbinRUN apt-get update -y && \- apt-get install -y openjdk-8-jdk && \+ apt-get install -y --no-install-recommends openjdk-8-jdk && \wget -q -O hadoop-$HADOOP_VERSION.tar.gz "https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=hadoop/common/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz" && \tar -zxf /hadoop-$HADOOP_VERSION.tar.gz && \rm /hadoop-$HADOOP_VERSION.tar.gz && \- mv /hadoop-$HADOOP_VERSION /usr/local/hadoop-ADD integration/hdfs/hdfs-site.xml $HADOOP_HOME/etc/hadoop/+ mv /hadoop-$HADOOP_VERSION /usr/local/hadoop \+ && apt-get clean \+ && rm -rf /var/lib/apt/lists/*+COPY integration/hdfs/hdfs-site.xml $HADOOP_HOME/etc/hadoop/# installing libhdfs3, it needs to be pinned, see ARROW-1465 and ARROW-1445# after the conda-forge migration it's failing with abi incompatibilities, so@@ -46,6 +48,6 @@ ENV CC=gcc \ARROW_BUILD_TESTS=ON# build and test-CMD arrow/ci/docker_build_cpp.sh && \+CMD ["/bin/bash", "-c", "arrow/ci/docker_build_cpp.sh && \arrow/ci/docker_build_python.sh && \- arrow/integration/hdfs/runtest.sh+ arrow/integration/hdfs/runtest.sh"]diff --git a/integration/spark/Dockerfile b/integration/spark/Dockerfileindex 36b64791ac..d6a29bde6b 100644--- a/integration/spark/Dockerfile+++ b/integration/spark/Dockerfile@@ -23,11 +23,13 @@ ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 \M2_HOME=/root/.m2 \PATH=/root/.m2/bin:/usr/local/maven/bin:$PATHRUN apt-get update -q -y && \- apt-get install -q -y openjdk-8-jdk && \+ apt-get install -q -y --no-install-recommends openjdk-8-jdk && \wget -q -O maven-$MAVEN_VERSION.tar.gz "https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" && \tar -zxf /maven-$MAVEN_VERSION.tar.gz && \rm /maven-$MAVEN_VERSION.tar.gz && \- mv /apache-maven-$MAVEN_VERSION /usr/local/maven+ mv /apache-maven-$MAVEN_VERSION /usr/local/maven \+ && apt-get clean \+ && rm -rf /var/lib/apt/lists/*# installing specific version of sparkARG SPARK_VERSION=master@@ -44,7 +46,7 @@ ENV CC=gcc \ARROW_BUILD_TESTS=OFF# build and test-CMD arrow/ci/docker_build_cpp.sh && \+CMD ["/bin/bash", "-c", "arrow/ci/docker_build_cpp.sh && \arrow/ci/docker_build_python.sh && \arrow/ci/docker_build_java.sh && \- arrow/integration/spark/runtest.sh+ arrow/integration/spark/runtest.sh"]diff --git a/rust/Dockerfile b/rust/Dockerfileindex 17661fcb5d..77eba7b7fd 100644--- a/rust/Dockerfile+++ b/rust/Dockerfile@@ -20,7 +20,7 @@ FROM rustlang/rust:nightly# sadly cargo doesn't have a command to fetch and build the# dependencies without building the library itselfENV CARGO_TARGET_DIR=/build/rust-ADD rust/Cargo.toml /arrow/rust/Cargo.toml+COPY rust/Cargo.toml /arrow/rust/Cargo.tomlWORKDIR /arrow/rust-CMD cargo test+CMD ["cargo", "test"]