From 6bd5e9ba5f34aa78d5d6a77c4bd381dc8b1d1779 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sat, 2 Nov 2019 11:47:38 +0100 Subject: [PATCH] [AIRFLOW-5829] Get rid of the checklicence image This change is a further step of simplifying the set of scripts used by CI. The separate checklicence image was implemented as an optimisation of the licence check time. The image to download was small and could be downloaded slightly faster in CI. However that made all the management script more complex and lead to having separate jobs for check licence and static checks. That lead to actually longer time of Travis jobs - because new machine had to be spun-off for checklicence check only. With this change, the CI image is the only one left and it is slightly bigger (with RAT tool added) but the same image is used for all the tests - unit tests, static checks and checklicence checks. This also makes it easier to manage the images and decreases update overhead on the developers using Breeze. --- .travis.yml | 12 +-- BREEZE.rst | 5 - Dockerfile | 24 ++++- Dockerfile-checklicence | 92 ------------------- breeze | 1 - common/_files_for_rebuild_check.sh | 1 - hooks/build | 41 +-------- scripts/ci/_utils.sh | 38 +------- scripts/ci/ci_check_license.sh | 2 +- scripts/ci/ci_run_all_static_tests.sh | 3 +- .../ci_run_all_static_tests_except_pylint.sh | 50 ---------- ..._all_static_tests_except_pylint_licence.sh | 49 ---------- scripts/ci/ci_run_all_static_tests_pylint.sh | 49 ---------- scripts/ci/docker-compose.yml | 8 +- scripts/ci/in_container/entrypoint_ci.sh | 4 +- .../ci/local_ci_build_checklicence_image.sh | 35 ------- scripts/ci/local_ci_cleanup.sh | 2 - scripts/ci/pre_commit_check_license.sh | 2 +- 18 files changed, 36 insertions(+), 382 deletions(-) delete mode 100644 Dockerfile-checklicence delete mode 100755 scripts/ci/ci_run_all_static_tests_except_pylint.sh delete mode 100755 scripts/ci/ci_run_all_static_tests_except_pylint_licence.sh delete mode 100755 scripts/ci/ci_run_all_static_tests_pylint.sh delete mode 100755 scripts/ci/local_ci_build_checklicence_image.sh diff --git a/.travis.yml b/.travis.yml index 72659eb8617a6..6e8a9d8e2cde0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,17 +32,13 @@ stages: - test jobs: include: - - name: "Static checks (no pylint, no license check)" - stage: pre-test - script: ./scripts/ci/ci_run_all_static_tests_except_pylint_licence.sh - - name: "Check license compliance for Apache" + - name: "Static checks" + python: "3.5" stage: pre-test - script: ./scripts/ci/ci_check_license.sh + script: ./scripts/ci/ci_run_all_static_tests.sh env: AIRFLOW_MOUNT_SOURCE_DIR_FOR_STATIC_CHECKS="true" - - name: "Pylint checks" - stage: pre-test - script: ./scripts/ci/ci_run_all_static_tests_pylint.sh - name: "Build documentation" + python: "3.5" stage: pre-test script: ./scripts/ci/ci_docs.sh - name: "Tests postgres kubernetes python 3.6 (persistent)" diff --git a/BREEZE.rst b/BREEZE.rst index 3df93e66a4623..4d4924bc03b66 100644 --- a/BREEZE.rst +++ b/BREEZE.rst @@ -84,11 +84,6 @@ There are three images that we are currently managing: Its tag follows the pattern of ``-python-ci`` (for example, ``apache/airflow:master-python3.6-ci``). The image is built using the ``_ Dockerfile. -* **Checklicense image** that is used during license check with the Apache RAT tool. It does not - require any of the dependencies that the two CI images need so it is built using a different Dockerfile - ``_ and only contains Java + Apache RAT tool. The image is - labelled with ``checklicence``, for example: ``apache/airflow:checklicence``. No versioning is used for - the Checklicence image. Before you run tests, enter the environment or run local static checks, the necessary local images should be pulled and built from Docker Hub. This happens automatically for the test environment but you need to diff --git a/Dockerfile b/Dockerfile index 3ba54caee9350..34d29e87dd89e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -144,11 +144,11 @@ RUN mkdir -pv /usr/share/man/man1 \ && rm -rf /var/lib/apt/lists/* ENV HADOOP_DISTRO="cdh" HADOOP_MAJOR="5" HADOOP_DISTRO_VERSION="5.11.0" HADOOP_VERSION="2.6.0" \ - HADOOP_HOME="/tmp/hadoop-cdh" -ENV HIVE_VERSION="1.1.0" HIVE_HOME="/tmp/hive" + HADOOP_HOME="/opt/hadoop-cdh" +ENV HIVE_VERSION="1.1.0" HIVE_HOME="/opt/hive" ENV HADOOP_URL="https://archive.cloudera.com/${HADOOP_DISTRO}${HADOOP_MAJOR}/${HADOOP_DISTRO}/${HADOOP_MAJOR}/" ENV MINICLUSTER_BASE="https://github.com/bolkedebruin/minicluster/releases/download/" \ - MINICLUSTER_HOME="/tmp/minicluster" \ + MINICLUSTER_HOME="/opt/minicluster" \ MINICLUSTER_VER="1.1" RUN mkdir -pv "${HADOOP_HOME}" \ @@ -176,10 +176,10 @@ ENV MINICLUSTER_URL="${MINICLUSTER_BASE}${MINICLUSTER_VER}/minicluster-${MINICLU MINICLUSTER_TMP_FILE="/tmp/minicluster.zip" RUN curl -sL "${MINICLUSTER_URL}" > "${MINICLUSTER_TMP_FILE}" \ - && unzip "${MINICLUSTER_TMP_FILE}" -d "/tmp" \ + && unzip "${MINICLUSTER_TMP_FILE}" -d "/opt" \ && rm "${MINICLUSTER_TMP_FILE}" -ENV PATH "${PATH}:/tmp/hive/bin" +ENV PATH "${PATH}:/opt/hive/bin" RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \ && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable" \ @@ -203,6 +203,20 @@ RUN curl -Lo kind \ && chmod +x kind \ && mv kind /usr/local/bin/kind +ARG RAT_VERSION="0.13" + +ENV RAT_VERSION="${RAT_VERSION}" \ + RAT_JAR="/opt/apache-rat-${RAT_VERSION}.jar" \ + RAT_URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar" +ENV RAT_JAR_MD5="${RAT_JAR}.md5" \ + RAT_URL_MD5="${RAT_URL}.md5" + +RUN echo "Downloading RAT from ${RAT_URL} to ${RAT_JAR}" \ + && curl -sL "${RAT_URL}" > "${RAT_JAR}" \ + && curl -sL "${RAT_URL_MD5}" > "${RAT_JAR_MD5}" \ + && jar -tf "${RAT_JAR}" \ + && md5sum -c <<<"$(cat "${RAT_JAR_MD5}") ${RAT_JAR}" + ARG AIRFLOW_USER=airflow ENV AIRFLOW_USER=${AIRFLOW_USER} diff --git a/Dockerfile-checklicence b/Dockerfile-checklicence deleted file mode 100644 index 35ecf7e8f4df2..0000000000000 --- a/Dockerfile-checklicence +++ /dev/null @@ -1,92 +0,0 @@ -# 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. -# -# WARNING: THIS DOCKERFILE IS NOT INTENDED FOR PRODUCTION USE OR DEPLOYMENT. -# -FROM debian:stretch-slim - -SHELL ["/bin/bash", "-o", "pipefail", "-e", "-u", "-x", "-c"] - -# Make sure noninteractie debian install is used and language variables set -ENV DEBIAN_FRONTEND=noninteractive LANGUAGE=C.UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8 \ - LC_CTYPE=C.UTF-8 LC_MESSAGES=C.UTF-8 - -ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ - -# Note missing man directories on debian-stretch -# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199 -# Install OpenJDK -RUN mkdir -pv /usr/share/man/man1 \ - && mkdir -pv /usr/share/man/man7 \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - sudo \ - curl \ - openjdk-8-jdk \ - && apt-get autoremove -yqq --purge \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -ARG RAT_VERSION="0.13" - -ENV RAT_VERSION="${RAT_VERSION}" \ - RAT_JAR="/tmp/apache-rat-${RAT_VERSION}.jar" \ - RAT_URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar" -ENV RAT_JAR_MD5="${RAT_JAR}.md5" \ - RAT_URL_MD5="${RAT_URL}.md5" - -RUN echo "Downloading RAT from ${RAT_URL} to ${RAT_JAR}" \ - && curl -sL "${RAT_URL}" > "${RAT_JAR}" \ - && curl -sL "${RAT_URL_MD5}" > "${RAT_JAR_MD5}" \ - && jar -tf "${RAT_JAR}" \ - && md5sum -c <<<"$(cat "${RAT_JAR_MD5}") ${RAT_JAR}" - -ARG DUMB_INIT_VERSION="1.2.2" -ENV DUMB_INIT_VERSION="${DUMB_INIT_VERSION}" \ - DUMB_INIT_FILE="/tmp/dumb-init_${DUMB_INIT_VERSION}_amd64.deb" \ - DUMB_INIT_FILE_SHA256SUMS="/tmp/sha256sums" \ - DUMB_INIT_URL="https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_amd64.deb" \ - DUMB_INIT_URL_SHA256SUMS="https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/sha256sums" - -WORKDIR /tmp -RUN echo "Downloading dumb-init from ${DUMB_INIT_URL} to ${DUMB_INIT_FILE}" \ - && curl -sL "${DUMB_INIT_URL}" > "${DUMB_INIT_FILE}" \ - && curl -sL "${DUMB_INIT_URL_SHA256SUMS}" > "${DUMB_INIT_FILE_SHA256SUMS}" \ - && sha256sum --check --ignore-missing "${DUMB_INIT_FILE_SHA256SUMS}" \ - && dpkg -i "${DUMB_INIT_FILE}" - -ARG AIRFLOW_USER=airflow -ENV AIRFLOW_USER=${AIRFLOW_USER} - -ARG HOME=/home/airflow -ENV HOME=${HOME} - -ARG AIRFLOW_HOME=${HOME}/airflow -ENV AIRFLOW_HOME=${AIRFLOW_HOME} - -ARG AIRFLOW_SOURCES=/opt/airflow -ENV AIRFLOW_SOURCES=${AIRFLOW_SOURCES} - -RUN adduser airflow \ - && echo "airflow ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/airflow \ - && chmod 0440 /etc/sudoers.d/airflow - -COPY --chown=airflow:airflow scripts ${AIRFLOW_SOURCES}/scripts - -USER airflow - -WORKDIR ${AIRFLOW_SOURCES} - -ENTRYPOINT ["/opt/airflow/scripts/ci/in_container/run_check_licence.sh"] diff --git a/breeze b/breeze index 442cb311698cb..31174a036a69f 100755 --- a/breeze +++ b/breeze @@ -932,7 +932,6 @@ prepare_command_file "${BUILD_CACHE_DIR}/${LAST_DC_TEST_FILE}" "${DC_RUN_COMMAND prepare_command_file "${BUILD_CACHE_DIR}/${LAST_DC_FILE}" '"' "false" rebuild_ci_image_if_needed -rebuild_checklicence_image_if_needed export AIRFLOW_CONTAINER_DOCKER_IMAGE=\ ${DOCKERHUB_USER}/${DOCKERHUB_REPO}:${AIRFLOW_CONTAINER_BRANCH_NAME}-python${PYTHON_VERSION}-ci diff --git a/common/_files_for_rebuild_check.sh b/common/_files_for_rebuild_check.sh index d5cea135482da..f6474e675a91c 100644 --- a/common/_files_for_rebuild_check.sh +++ b/common/_files_for_rebuild_check.sh @@ -21,7 +21,6 @@ FILES_FOR_REBUILD_CHECK=( "setup.py" "setup.cfg" "Dockerfile" - "Dockerfile-checklicence" ".dockerignore" "airflow/version.py" "airflow/www/package.json" diff --git a/hooks/build b/hooks/build index 91e0917c37d80..bc9be66a8c5ec 100755 --- a/hooks/build +++ b/hooks/build @@ -115,7 +115,7 @@ function build_python_image { --build-arg AIRFLOW_BRANCH="${AIRFLOW_CONTAINER_BRANCH_NAME}" \ --build-arg AIRFLOW_CONTAINER_CI_OPTIMISED_BUILD="${AIRFLOW_CONTAINER_CI_OPTIMISED_BUILD}" \ --build-arg HOME="${HOME}" \ - "${DOCKER_CACHE_DIRECTIVE[@]}" \ + "${DOCKER_CACHE_DIRECTIVE_CI[@]}" \ -t "${MY_IMAGE_TAG}" \ --target "${TARGET_IMAGE}" \ . @@ -202,10 +202,6 @@ export AIRFLOW_CONTAINER_SKIP_LATEST_PYTHON_PULL=${AIRFLOW_CONTAINER_SKIP_LATEST export AIRFLOW_CONTAINER_SKIP_CI_IMAGE=${AIRFLOW_CONTAINER_SKIP_CI_IMAGE:="false"} echo "Skip CI image: ${AIRFLOW_CONTAINER_SKIP_CI_IMAGE}" -# Skips downloading and building the checklicence image - one used for checking the licences -export AIRFLOW_CONTAINER_SKIP_CHECKLICENCE_IMAGE=${AIRFLOW_CONTAINER_SKIP_CHECKLICENCE_IMAGE:="false"} -echo "Skip CHECKLICENCE image: ${AIRFLOW_CONTAINER_SKIP_CHECKLICENCE_IMAGE}" - # Fixes permissions for git-checked out files. This is needed to have consistent build cache across # Dockerhub, TravisCI and locally checked out code export AIRFLOW_FIX_PERMISSIONS=${AIRFLOW_FIX_PERMISSIONS:="all"} @@ -217,20 +213,14 @@ echo "The build optimised for CI: ${AIRFLOW_CONTAINER_CI_OPTIMISED_BUILD}" # Base python image for the build export PYTHON_BASE_IMAGE=python:${PYTHON_VERSION}-slim-stretch -# Base image for checklicence image -export CHECKLICENCE_BASE_IMAGE=debian:stretch-slim - if [[ "${AIRFLOW_RELEASE_BUILD}" == "true" ]]; then export AIRFLOW_CI_IMAGE="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:${AIRFLOW_VERSION}-python${PYTHON_VERSION}-ci" export AIRFLOW_CI_IMAGE_DEFAULT="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:${AIRFLOW_VERSION}-ci" export AIRFLOW_CI_IMAGE_LATEST="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:latest-python${PYTHON_VERSION}-${TAG_PREFIX}-ci" export AIRFLOW_CI_IMAGE_LATEST_DEFAULT="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:latest-${TAG_PREFIX}-ci" - - export AIRFLOW_CHECKLICENCE_IMAGE="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:checklicence" else export AIRFLOW_CI_IMAGE="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:${TAG_PREFIX}-python${PYTHON_VERSION}-ci" export AIRFLOW_CI_IMAGE_DEFAULT="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:${TAG_PREFIX}-ci" - export AIRFLOW_CHECKLICENCE_IMAGE="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:checklicence" fi # In the future we can enable buildkit. # It's experimental now and cache does not work out of the box with buildkit in Docker 18.09.2, buildkit 0.3.3 @@ -251,9 +241,7 @@ if [[ "${AIRFLOW_CONTAINER_CLEANUP_IMAGES}" == "true" ]]; then echo start_step "Removing images" docker rmi "${PYTHON_BASE_IMAGE}" || true - docker rmi "${CHECKLICENCE_BASE_IMAGE}" || true docker rmi "${AIRFLOW_CI_IMAGE}" || true - docker rmi "${AIRFLOW_CHECKLICENCE_IMAGE}" || true echo echo "###################################################################" echo "NOTE!! Removed Airflow images for Python version ${PYTHON_VERSION}." @@ -268,7 +256,6 @@ fi start_step "Populating cache" DOCKER_CACHE_DIRECTIVE_CI=() -DOCKER_CACHE_DIRECTIVE_CHECKLICENCE=() if [[ "${AIRFLOW_CONTAINER_USE_PULLED_IMAGES_CACHE}" == "true" ]]; then echo @@ -286,9 +273,6 @@ if [[ "${AIRFLOW_CONTAINER_USE_PULLED_IMAGES_CACHE}" == "true" ]]; then echo "Force pull base python image." echo docker pull "${PYTHON_BASE_IMAGE}" - echo "Force pull base checklicence image." - echo - docker pull "${CHECKLICENCE_BASE_IMAGE}" echo set +x fi @@ -298,10 +282,6 @@ if [[ "${AIRFLOW_CONTAINER_USE_PULLED_IMAGES_CACHE}" == "true" ]]; then echo "Downloading the CI Airflow image" IMAGES_TO_PULL="${IMAGES_TO_PULL} ${AIRFLOW_CI_IMAGE}" fi - if [[ "${AIRFLOW_CONTAINER_SKIP_CHECKLICENCE_IMAGE}" != "true" ]]; then - echo "Downloading the CHECKLICENCE Airflow image" - IMAGES_TO_PULL="${IMAGES_TO_PULL} ${AIRFLOW_CHECKLICENCE_IMAGE}" - fi DOCKER_CACHE_DIRECTIVE_CI=() if [[ ${IMAGES_TO_PULL} == "" ]]; then @@ -343,8 +323,6 @@ if [[ "${AIRFLOW_CONTAINER_USE_PULLED_IMAGES_CACHE}" == "true" ]]; then fi if [[ "${IMAGE}" == "${AIRFLOW_CI_IMAGE}" ]]; then DOCKER_CACHE_DIRECTIVE_CI+=("--cache-from" "${IMAGE}") - elif [[ "${IMAGE}" == "${AIRFLOW_CHECKLICENCE_IMAGE}" ]]; then - DOCKER_CACHE_DIRECTIVE_CHECKLICENCE+=("--cache-from" "${IMAGE}") else echo echo "Don't know how to set cache directive for ${IMAGE}. Exiting" @@ -359,13 +337,11 @@ start_step "Setting cache options" if [[ "${AIRFLOW_CONTAINER_USE_NO_CACHE}" == "true" ]]; then DOCKER_CACHE_DIRECTIVE_CI+=("--no-cache") - DOCKER_CACHE_DIRECTIVE_CHECKLICENCE+=("--no-cache") echo echo "Skip cache for builds. Everything will be rebuilt from scratch." echo echo "Cache directives used: " echo "CI build: ${DOCKER_CACHE_DIRECTIVE_CI[*]}" - echo "CI checklicence build: ${DOCKER_CACHE_DIRECTIVE_CHECKLICENCE[*]}" echo elif [[ "${AIRFLOW_CONTAINER_USE_PULLED_IMAGES_CACHE}" == "true" ]]; then echo @@ -373,19 +349,16 @@ elif [[ "${AIRFLOW_CONTAINER_USE_PULLED_IMAGES_CACHE}" == "true" ]]; then echo "Cache directives used: " set +u echo "CI build: ${DOCKER_CACHE_DIRECTIVE_CI[*]}" - echo "CI checklicence build: ${DOCKER_CACHE_DIRECTIVE_CHECKLICENCE[*]}" set -u echo else DOCKER_CACHE_DIRECTIVE_CI=() - DOCKER_CACHE_DIRECTIVE_CHECKLICENCE=() echo echo "Use default cache from locally built images." echo echo "Cache directives used: " set +u echo "CI build: ${DOCKER_CACHE_DIRECTIVE_CI[*]}" - echo "CI checklicence build: ${DOCKER_CACHE_DIRECTIVE_CHECKLICENCE[*]}" set -u echo fi @@ -466,18 +439,6 @@ else fi fi -if [[ "${AIRFLOW_CONTAINER_SKIP_CHECKLICENCE_IMAGE}" == "true" ]]; then - echo "Skip building the CHECKLICENCE image" -else - start_step "Build Airflow CHECKLICENCE image" - set +u - docker build . -f Dockerfile-checklicence \ - "${DOCKER_CACHE_DIRECTIVE_CHECKLICENCE[@]}" -t "${AIRFLOW_CHECKLICENCE_IMAGE}" - set -u - add_image_to_push "${AIRFLOW_CHECKLICENCE_IMAGE}" -fi - - start_step "Pushing images" if [[ "${AIRFLOW_CONTAINER_PUSH_IMAGES}" != "false" ]]; then diff --git a/scripts/ci/_utils.sh b/scripts/ci/_utils.sh index 0daa85027654c..c2e6596a34e9e 100644 --- a/scripts/ci/_utils.sh +++ b/scripts/ci/_utils.sh @@ -33,7 +33,7 @@ export BUILD_CACHE_DIR LAST_FORCE_ANSWER_FILE="${BUILD_CACHE_DIR}/last_force_answer.sh" -IMAGES_TO_CHECK=("CI" "CHECKLICENCE") +IMAGES_TO_CHECK=("CI") export IMAGES_TO_CHECK mkdir -p "${AIRFLOW_SOURCES}/.mypy_cache" @@ -494,7 +494,6 @@ EOF # Rebuilds the image for tests if needed. # function rebuild_ci_image_if_needed() { - export AIRFLOW_CONTAINER_SKIP_CHECKLICENCE_IMAGE="true" export AIRFLOW_CONTAINER_SKIP_CI_IMAGE="false" export THE_IMAGE_TYPE="CI" @@ -510,7 +509,6 @@ function rebuild_ci_image_if_needed() { # function cleanup_ci_image() { export AIRFLOW_CONTAINER_SKIP_CI_IMAGE="false" - export AIRFLOW_CONTAINER_SKIP_CHECKLICENCE_IMAGE="true" export AIRFLOW_CONTAINER_CLEANUP_IMAGES="true" export THE_IMAGE_TYPE="CI" @@ -518,33 +516,6 @@ function cleanup_ci_image() { rebuild_image_if_needed } -# -# Rebuilds the image for licence checks if needed. -# -function rebuild_checklicence_image_if_needed() { - export AIRFLOW_CONTAINER_SKIP_CHECKLICENCE_IMAGE="false" - export AIRFLOW_CONTAINER_SKIP_CI_IMAGE="true" - - export THE_IMAGE_TYPE="CHECKLICENCE" - - rebuild_image_if_needed - - export AIRFLOW_CHECKLICENCE_IMAGE="${DOCKERHUB_USER}/${DOCKERHUB_REPO}:checklicence" -} - -# -# Cleans up the checklicence image -# -function cleanup_checklicence_image() { - export AIRFLOW_CONTAINER_SKIP_CI_IMAGE="true" - export AIRFLOW_CONTAINER_SKIP_CHECKLICENCE_IMAGE="false" - export AIRFLOW_CONTAINER_CLEANUP_IMAGES="true" - - export THE_IMAGE_TYPE="CHECKLICENCE" - - rebuild_image_if_needed -} - # # Starts the script/ If VERBOSE variable is set to true, it enables verbose output of commands executed # Also prints some useful diagnostics information at start of the script @@ -655,14 +626,14 @@ function run_docs() { function run_check_license() { docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" -t \ - --entrypoint "/usr/bin/dumb-init" \ + --entrypoint "/usr/local/bin/dumb-init" \ --env PYTHONDONTWRITEBYTECODE \ --env AIRFLOW_CI_VERBOSE="${VERBOSE}" \ --env AIRFLOW_CI_SILENT \ --env HOST_USER_ID="$(id -ur)" \ --env HOST_GROUP_ID="$(id -gr)" \ --rm \ - "${AIRFLOW_CHECKLICENCE_IMAGE}" \ + "${AIRFLOW_CI_IMAGE}" \ "--" "/opt/airflow/scripts/ci/in_container/run_check_licence.sh" \ | tee -a "${OUTPUT_LOG}" } @@ -850,7 +821,6 @@ function rebuild_all_images_if_needed_and_confirmed() { if [[ ${SKIP_REBUILD} != "true" ]]; then rebuild_ci_image_if_needed - rebuild_checklicence_image_if_needed fi fi } @@ -914,8 +884,6 @@ function build_image_on_ci() { else touch "${BUILD_CACHE_DIR}"/.skip_tests fi - elif [[ ${TRAVIS_JOB_NAME} == "Check lic"* ]]; then - rebuild_checklicence_image_if_needed elif [[ ${TRAVIS_JOB_NAME} == "Static"* ]]; then rebuild_ci_image_if_needed elif [[ ${TRAVIS_JOB_NAME} == "Pylint"* ]]; then diff --git a/scripts/ci/ci_check_license.sh b/scripts/ci/ci_check_license.sh index 2360a8d50af02..ba449de3f0dd2 100755 --- a/scripts/ci/ci_check_license.sh +++ b/scripts/ci/ci_check_license.sh @@ -33,7 +33,7 @@ basic_sanity_checks script_start -rebuild_checklicence_image_if_needed +rebuild_ci_image_if_needed run_check_license diff --git a/scripts/ci/ci_run_all_static_tests.sh b/scripts/ci/ci_run_all_static_tests.sh index 03ae9aca5057c..bb90870375c93 100755 --- a/scripts/ci/ci_run_all_static_tests.sh +++ b/scripts/ci/ci_run_all_static_tests.sh @@ -40,9 +40,8 @@ if [[ -f ${BUILD_CACHE_DIR}/.skip_tests ]]; then fi rebuild_ci_image_if_needed -rebuild_checklicence_image_if_needed -IMAGES_TO_CHECK=("CI" "CHECKLICENCE") +IMAGES_TO_CHECK=("CI") export IMAGES_TO_CHECK pre-commit run --all-files --show-diff-on-failure diff --git a/scripts/ci/ci_run_all_static_tests_except_pylint.sh b/scripts/ci/ci_run_all_static_tests_except_pylint.sh deleted file mode 100755 index e6943b79b2111..0000000000000 --- a/scripts/ci/ci_run_all_static_tests_except_pylint.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/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 -euo pipefail - -MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -export AIRFLOW_CI_SILENT=${AIRFLOW_CI_SILENT:="true"} - -export PYTHON_VERSION=3.5 - -# shellcheck source=scripts/ci/_utils.sh -. "${MY_DIR}/_utils.sh" - -basic_sanity_checks - -script_start - -if [[ -f ${BUILD_CACHE_DIR}/.skip_tests ]]; then - echo - echo "Skip tests" - echo - script_end - exit -fi - -rebuild_ci_image_if_needed -rebuild_checklicence_image_if_needed - -IMAGES_TO_CHECK=("CI" "CHECKLICENCE") -export IMAGES_TO_CHECK - -SKIP=pylint pre-commit run --all-files --show-diff-on-failure - -script_end diff --git a/scripts/ci/ci_run_all_static_tests_except_pylint_licence.sh b/scripts/ci/ci_run_all_static_tests_except_pylint_licence.sh deleted file mode 100755 index 0899eb6210222..0000000000000 --- a/scripts/ci/ci_run_all_static_tests_except_pylint_licence.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/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 -euo pipefail - -MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -export AIRFLOW_CI_SILENT=${AIRFLOW_CI_SILENT:="true"} - -export PYTHON_VERSION=3.5 - -# shellcheck source=scripts/ci/_utils.sh -. "${MY_DIR}/_utils.sh" - -basic_sanity_checks - -script_start - -if [[ -f ${BUILD_CACHE_DIR}/.skip_tests ]]; then - echo - echo "Skip tests" - echo - script_end - exit -fi - -rebuild_ci_image_if_needed - -IMAGES_TO_CHECK=("CI") -export IMAGES_TO_CHECK - -SKIP=pylint,check-apache-license pre-commit run --all-files --show-diff-on-failure - -script_end diff --git a/scripts/ci/ci_run_all_static_tests_pylint.sh b/scripts/ci/ci_run_all_static_tests_pylint.sh deleted file mode 100755 index 5bb8a655e552e..0000000000000 --- a/scripts/ci/ci_run_all_static_tests_pylint.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/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 -euo pipefail - -MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -export AIRFLOW_CI_SILENT=${AIRFLOW_CI_SILENT:="true"} - -export PYTHON_VERSION=3.5 - -# shellcheck source=scripts/ci/_utils.sh -. "${MY_DIR}/_utils.sh" - -basic_sanity_checks - -script_start - -if [[ -f ${BUILD_CACHE_DIR}/.skip_tests ]]; then - echo - echo "Skip tests" - echo - script_end - exit -fi - -rebuild_ci_image_if_needed - -IMAGES_TO_CHECK=("CI") -export IMAGES_TO_CHECK - -pre-commit run pylint --all-files --show-diff-on-failure - -script_end diff --git a/scripts/ci/docker-compose.yml b/scripts/ci/docker-compose.yml index 512760fce40d9..2eec9001b3851 100644 --- a/scripts/ci/docker-compose.yml +++ b/scripts/ci/docker-compose.yml @@ -76,10 +76,10 @@ services: - USER=root - ADDITIONAL_PATH=~/.local/bin - HADOOP_DISTRO=cdh - - HADOOP_HOME=/tmp/hadoop-cdh - - HADOOP_OPTS=-D/tmp/krb5.conf - - HIVE_HOME=/tmp/hive - - MINICLUSTER_HOME=/tmp/minicluster + - HADOOP_HOME=/opt/hadoop-cdh + - HADOOP_OPTS=-D/opt/krb5.conf + - HIVE_HOME=/opt/hive + - MINICLUSTER_HOME=/opt/minicluster - KRB5_CONFIG=/etc/krb5.conf - KRB5_KTNAME=/etc/airflow.keytab - CELERY_BROKER_URLS=amqp://guest:guest@rabbitmq:5672,redis://redis:6379/0 diff --git a/scripts/ci/in_container/entrypoint_ci.sh b/scripts/ci/in_container/entrypoint_ci.sh index 6be96c0785ec5..3d43ed901b91f 100755 --- a/scripts/ci/in_container/entrypoint_ci.sh +++ b/scripts/ci/in_container/entrypoint_ci.sh @@ -105,7 +105,7 @@ if [[ ! -d "${AIRFLOW_SOURCES}/airflow/www/static/dist" ]]; then fi export HADOOP_DISTRO="${HADOOP_DISTRO:="cdh"}" -export HADOOP_HOME="${HADOOP_HOME:="/tmp/hadoop-cdh"}" +export HADOOP_HOME="${HADOOP_HOME:="/opt/hadoop-cdh"}" if [[ ${AIRFLOW_CI_VERBOSE} == "true" ]]; then echo @@ -138,7 +138,7 @@ mkdir -p "${AIRFLOW_SOURCES}"/tmp/ if [[ "${ENV}" == "docker" ]]; then # Start MiniCluster - java -cp "/tmp/minicluster-1.1-SNAPSHOT/*" com.ing.minicluster.MiniCluster \ + java -cp "/opt/minicluster-1.1-SNAPSHOT/*" com.ing.minicluster.MiniCluster \ >"${AIRFLOW_HOME}/logs/minicluster.log" 2>&1 & # Set up ssh keys diff --git a/scripts/ci/local_ci_build_checklicence_image.sh b/scripts/ci/local_ci_build_checklicence_image.sh deleted file mode 100755 index a0b17ac5edfe9..0000000000000 --- a/scripts/ci/local_ci_build_checklicence_image.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/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 -euo pipefail -# -# Builds full CI docker image - the image that can be used for running full tests of Airflow -# -set -euo pipefail -MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# shellcheck source=scripts/ci/_utils.sh -. "${MY_DIR}/_utils.sh" - -basic_sanity_checks - -script_start - -rebuild_checklicence_image_if_needed - -script_end diff --git a/scripts/ci/local_ci_cleanup.sh b/scripts/ci/local_ci_cleanup.sh index 9600c5d3b5609..2595e7f54c032 100755 --- a/scripts/ci/local_ci_cleanup.sh +++ b/scripts/ci/local_ci_cleanup.sh @@ -32,6 +32,4 @@ script_start cleanup_ci_image -cleanup_checklicence_image - script_end diff --git a/scripts/ci/pre_commit_check_license.sh b/scripts/ci/pre_commit_check_license.sh index fbcff1497cb7e..bf63c18d1c2fd 100755 --- a/scripts/ci/pre_commit_check_license.sh +++ b/scripts/ci/pre_commit_check_license.sh @@ -22,4 +22,4 @@ MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export FORCE_ANSWER_TO_QUESTIONS=${FORCE_ANSWER_TO_QUESTIONS:="quit"} export REMEMBER_LAST_ANSWER="true" -"${MY_DIR}/ci_check_license.sh" "${@}" +"${MY_DIR}/ci_check_license.sh"