Disable progress bar for PIP installation (#14126)

When the image is prepared, PIP installation produces progress
bars which are annoying - especially in the CI environment.

This PR adds argument to control progress bar and sets it to "off"
for CI builds.
This commit is contained in:
Jarek Potiuk 2021-02-10 00:20:50 +01:00 коммит произвёл GitHub
Родитель e7f176d2dc
Коммит 9b7852e047
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 29 добавлений и 1 удалений

Просмотреть файл

@ -49,6 +49,9 @@ ARG PYTHON_MAJOR_MINOR_VERSION="3.6"
ARG AIRFLOW_PIP_VERSION=20.2.4
# By default PIP has progress bar but you can disable it.
ARG PIP_PROGRESS_BAR="on"
##############################################################################################
# This is the build image where we build all dependencies
##############################################################################################
@ -172,6 +175,10 @@ RUN if [[ -f /docker-context-files/.pypirc ]]; then \
ARG AIRFLOW_PIP_VERSION
ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION}
# By default PIP has progress bar but you can disable it.
ARG PIP_PROGRESS_BAR
ENV PIP_PROGRESS_BAR=${PIP_PROGRESS_BAR}
# Install Airflow with "--user" flag, so that we can copy the whole .local folder to the final image
# from the build image and always in non-editable mode
ENV AIRFLOW_INSTALL_USER_FLAG="--user"

Просмотреть файл

@ -281,6 +281,10 @@ ARG PIP_NO_CACHE_DIR="true"
ENV PIP_NO_CACHE_DIR=${PIP_NO_CACHE_DIR}
RUN echo "Pip no cache dir: ${PIP_NO_CACHE_DIR}"
# By default PIP has progress bar but you can disable it.
ARG PIP_PROGRESS_BAR="on"
ENV PIP_PROGRESS_BAR=${PIP_PROGRESS_BAR}
RUN pip install --upgrade "pip==${AIRFLOW_PIP_VERSION}"
# Only copy install_airflow_from_latest_master.sh to not invalidate cache on other script changes

Просмотреть файл

@ -613,6 +613,10 @@ The following build arguments (``--build-arg`` in docker build command) can be u
| ``ADDITIONAL_RUNTIME_APT_ENV`` | | Additional env variables defined |
| | | when installing runtime deps |
+------------------------------------------+------------------------------------------+------------------------------------------+
| ``AIRFLOW_PIP_VERSION`` | ``20.2.4`` | PIP version used. |
+------------------------------------------+------------------------------------------+------------------------------------------+
| ``PIP_PROGRESS_BAR`` | ``on`` | Progress bar for PIP installation |
+------------------------------------------+------------------------------------------+------------------------------------------+
Here are some examples of how CI images can built manually. CI is always built from local sources.

Просмотреть файл

@ -664,6 +664,10 @@ The following build arguments (``--build-arg`` in docker build command) can be u
| | | The mysql extra is removed from extras |
| | | if the client is not installed. |
+------------------------------------------+------------------------------------------+------------------------------------------+
| ``AIRFLOW_PIP_VERSION`` | ``20.2.4`` | PIP version used. |
+------------------------------------------+------------------------------------------+------------------------------------------+
| ``PIP_PROGRESS_BAR`` | ``on`` | Progress bar for PIP installation |
+------------------------------------------+------------------------------------------+------------------------------------------+
There are build arguments that determine the installation mechanism of Apache Airflow for the
production image. There are three types of build:

Просмотреть файл

@ -26,6 +26,11 @@ function build_images::add_build_args_for_remote_install() {
"--build-arg" "AIRFLOW_SOURCES_FROM=empty"
"--build-arg" "AIRFLOW_SOURCES_TO=/empty"
)
if [[ ${CI} == "true" ]]; then
EXTRA_DOCKER_PROD_BUILD_FLAGS+=(
"--build-arg" "PIP_PROGRESS_BAR=off"
)
fi
if [[ -n "${AIRFLOW_CONSTRAINTS_REFERENCE}" ]]; then
EXTRA_DOCKER_PROD_BUILD_FLAGS+=(
"--build-arg" "AIRFLOW_CONSTRAINTS_REFERENCE=${AIRFLOW_CONSTRAINTS_REFERENCE}"
@ -692,7 +697,11 @@ function build_images::build_ci_image() {
EXTRA_DOCKER_CI_BUILD_FLAGS=(
"--build-arg" "AIRFLOW_CONSTRAINTS_REFERENCE=${DEFAULT_CONSTRAINTS_BRANCH}"
)
if [[ ${CI} == "true" ]]; then
EXTRA_DOCKER_PROD_BUILD_FLAGS+=(
"--build-arg" "PIP_PROGRESS_BAR=off"
)
fi
if [[ -n "${AIRFLOW_CONSTRAINTS_LOCATION}" ]]; then
EXTRA_DOCKER_CI_BUILD_FLAGS+=(
"--build-arg" "AIRFLOW_CONSTRAINTS_LOCATION=${AIRFLOW_CONSTRAINTS_LOCATION}"