Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare to switch to debian bullseye #21522

Merged
merged 1 commit into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ jobs:
- name: "Retrieve DEFAULTS from the _initialization.sh"
# We cannot "source" the script here because that would be a security problem (we cannot run
# any code that comes from the sources coming from the PR. Therefore we extract the
# DEFAULT_BRANCH and DEFAULT_CONSTRAINTS_BRANCH via custom grep/awk/sed commands
# DEFAULT_BRANCH and DEFAULT_CONSTRAINTS_BRANCH and DEBIAN_VERSION via custom grep/awk/sed commands
id: defaults
run: |
DEFAULT_BRANCH=$(grep "export DEFAULT_BRANCH" scripts/ci/libraries/_initialization.sh | \
Expand All @@ -196,6 +196,9 @@ jobs:
scripts/ci/libraries/_initialization.sh | \
awk 'BEGIN{FS="="} {print $3}' | sed s'/["}]//g')
echo "DEFAULT_CONSTRAINTS_BRANCH=${DEFAULT_CONSTRAINTS_BRANCH}" >> $GITHUB_ENV
DEBIAN_VERSION=$(grep "export DEBIAN_VERSION" scripts/ci/libraries/_initialization.sh | \
awk 'BEGIN{FS="="} {print $3}' | sed s'/["}]//g')
echo "DEBIAN_VERSION=${DEBIAN_VERSION}" >> $GITHUB_ENV
- name: >
Checkout "${{ needs.build-info.outputs.targetBranch }}" branch to 'main-airflow' folder
to use ci/scripts from there.
Expand Down Expand Up @@ -263,7 +266,7 @@ jobs:
- name: "Retrieve DEFAULTS from the _initialization.sh"
# We cannot "source" the script here because that would be a security problem (we cannot run
# any code that comes from the sources coming from the PR. Therefore we extract the
# DEFAULT_BRANCH and DEFAULT_CONSTRAINTS_BRANCH via custom grep/awk/sed commands
# DEFAULT_BRANCH and DEFAULT_CONSTRAINTS_BRANCH and DEBIAN_VERSION via custom grep/awk/sed commands
id: defaults
run: |
DEFAULT_BRANCH=$(grep "export DEFAULT_BRANCH" scripts/ci/libraries/_initialization.sh | \
Expand All @@ -273,6 +276,9 @@ jobs:
scripts/ci/libraries/_initialization.sh | \
awk 'BEGIN{FS="="} {print $3}' | sed s'/["}]//g')
echo "DEFAULT_CONSTRAINTS_BRANCH=${DEFAULT_CONSTRAINTS_BRANCH}" >> $GITHUB_ENV
DEBIAN_VERSION=$(grep "export DEBIAN_VERSION" scripts/ci/libraries/_initialization.sh | \
cut -d "=" -f 3 | sed s'/["}]//g')
echo "DEBIAN_VERSION=${DEBIAN_VERSION}" >> $GITHUB_ENV
- name: >
Checkout "${{ needs.build-info.outputs.targetBranch }}" branch to 'main-airflow' folder
to use ci/scripts from there.
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ FROM ${PYTHON_BASE_IMAGE} as airflow-build-image
SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-o", "nounset", "-o", "nolog", "-c"]

ARG PYTHON_BASE_IMAGE

ENV PYTHON_BASE_IMAGE=${PYTHON_BASE_IMAGE} \
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
Expand Down Expand Up @@ -348,7 +349,6 @@ SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-o", "nounset", "-o", "n
ARG AIRFLOW_UID

LABEL org.apache.airflow.distro="debian" \
org.apache.airflow.distro.version="buster" \
org.apache.airflow.module="airflow" \
org.apache.airflow.component="airflow" \
org.apache.airflow.image="airflow" \
Expand Down Expand Up @@ -512,7 +512,6 @@ ARG AIRFLOW_IMAGE_DATE_CREATED
ENV BUILD_ID=${BUILD_ID} COMMIT_SHA=${COMMIT_SHA}

LABEL org.apache.airflow.distro="debian" \
org.apache.airflow.distro.version="buster" \
org.apache.airflow.module="airflow" \
org.apache.airflow.component="airflow" \
org.apache.airflow.image="airflow" \
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ FROM ${PYTHON_BASE_IMAGE} as main
# xtrace - to show commands executed)
SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-o", "nounset", "-o", "nolog", "-c"]

ARG PYTHON_BASE_IMAGE="python:3.7-slim-buster"
ARG PYTHON_BASE_IMAGE
ARG AIRFLOW_IMAGE_REPOSITORY="https://github.com/apache/airflow"

# By increasing this number we can do force build of all dependencies
Expand Down Expand Up @@ -373,7 +373,6 @@ RUN ln -sf /usr/bin/dumb-init /usr/local/bin/dumb-init
EXPOSE 8080

LABEL org.apache.airflow.distro="debian" \
org.apache.airflow.distro.version="buster" \
org.apache.airflow.module="airflow" \
org.apache.airflow.component="airflow" \
org.apache.airflow.image="airflow-ci" \
Expand Down
3 changes: 0 additions & 3 deletions dev/retag_docker_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@


GHCR_IO_IMAGES = [
"{prefix}/{repo}/{branch}/ci-manifest/python{python_version}:latest",
"{prefix}/{repo}/{branch}/ci/python{python_version}:latest",
"{prefix}/{repo}/{branch}/prod-build/python{python_version}:latest",
"{prefix}/{repo}/{branch}/prod/python{python_version}:latest",
"{prefix}/{repo}/{branch}/python:{python_version}-slim-buster",
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ cd "${AIRFLOW_SOURCES}"

# [START build]
export AIRFLOW_VERSION=2.2.2
export DEBIAN_VERSION="buster"

docker build . \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-buster" \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-${DEBIAN_VERSION}" \
--build-arg AIRFLOW_VERSION="${AIRFLOW_VERSION}" \
--build-arg ADDITIONAL_PYTHON_DEPS="mpi4py" \
--build-arg ADDITIONAL_DEV_APT_DEPS="libopenmpi-dev" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ cd "${AIRFLOW_SOURCES}"

# [START build]
export AIRFLOW_VERSION=2.2.2
export DEBIAN_VERSION="buster"

docker build . -f Dockerfile \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-buster" \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-${DEBIAN_VERSION}" \
--build-arg AIRFLOW_VERSION="${AIRFLOW_VERSION}" \
--build-arg ADDITIONAL_AIRFLOW_EXTRAS="slack,odbc" \
--build-arg ADDITIONAL_PYTHON_DEPS=" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ set -euo pipefail
AIRFLOW_SOURCES="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../" && pwd)"
cd "${AIRFLOW_SOURCES}"
# [START build]
export DEBIAN_VERSION="buster"

docker build . \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-buster" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-${DEBIAN_VERSION}" \
--build-arg AIRFLOW_INSTALLATION_METHOD="https://github.com/potiuk/airflow/archive/main.tar.gz#egg=apache-airflow" \
--build-arg AIRFLOW_CONSTRAINTS_REFERENCE="constraints-main" \
--build-arg CONSTRAINTS_GITHUB_REPOSITORY="potiuk/airflow" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ AIRFLOW_SOURCES="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../" && pwd)"
cd "${AIRFLOW_SOURCES}"

# [START build]
export DEBIAN_VERSION="buster"

docker build . \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-buster" \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-${DEBIAN_VERSION}" \
--build-arg AIRFLOW_INSTALLATION_METHOD="https://github.com/apache/airflow/archive/main.tar.gz#egg=apache-airflow" \
--build-arg AIRFLOW_CONSTRAINTS_REFERENCE="constraints-main" \
--tag "my-github-main:0.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ AIRFLOW_SOURCES="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../" && pwd)"
cd "${AIRFLOW_SOURCES}"

# [START build]
export DEBIAN_VERSION="buster"
docker build . \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-buster" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-${DEBIAN_VERSION}" \
--build-arg AIRFLOW_INSTALLATION_METHOD="https://github.com/apache/airflow/archive/v2-2-test.tar.gz#egg=apache-airflow" \
--build-arg AIRFLOW_CONSTRAINTS_REFERENCE="constraints-2-2" \
--tag "my-github-v2-2:0.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ cd "${AIRFLOW_SOURCES}"

# [START build]
export AIRFLOW_VERSION=2.2.2
export DEBIAN_VERSION="buster"

docker build . \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-buster" \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-${DEBIAN_VERSION}" \
--build-arg AIRFLOW_VERSION="${AIRFLOW_VERSION}" \
--build-arg ADDITIONAL_AIRFLOW_EXTRAS="jdbc" \
--build-arg ADDITIONAL_PYTHON_DEPS="pandas" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ cd "${AIRFLOW_SOURCES}"

# [START build]
export AIRFLOW_VERSION=2.2.2
export DEBIAN_VERSION="buster"

docker build . \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-buster" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-${DEBIAN_VERSION}" \
--build-arg AIRFLOW_VERSION="${AIRFLOW_VERSION}" \
--build-arg ADDITIONAL_AIRFLOW_EXTRAS="mssql,hdfs" \
--build-arg ADDITIONAL_PYTHON_DEPS="oauth2client" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ pip download --dest docker-context-files \
# [END download]

# [START build]
export DEBIAN_VERSION="buster"

docker build . \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-buster" \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-${DEBIAN_VERSION}" \
--build-arg AIRFLOW_INSTALLATION_METHOD="apache-airflow" \
--build-arg AIRFLOW_VERSION="${AIRFLOW_VERSION}" \
--build-arg INSTALL_MYSQL_CLIENT="false" \
Expand Down
3 changes: 1 addition & 2 deletions docs/docker-stack/docker-images-recipes/hadoop.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASE_AIRFLOW_IMAGE

FROM ${BASE_AIRFLOW_IMAGE}

SHELL ["/bin/bash", "-o", "pipefail", "-e", "-u", "-x", "-c"]
Expand All @@ -24,7 +23,7 @@ USER 0
RUN mkdir -pv /usr/share/man/man1 \
&& mkdir -pv /usr/share/man/man7 \
&& curl -fsSL https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - \
&& echo 'deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main' > \
&& echo "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ $(lsb_release -cs) main" > \
/etc/apt/sources.list.d/adoptopenjdk.list \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ source "${LIBRARIES_DIR}/_all_libs.sh"
export SEMAPHORE_NAME="kubernetes-tests"

initialization::set_output_color_variables
initialization::initialize_image_build_variables

parallel::make_sure_gnu_parallel_is_installed
parallel::make_sure_python_versions_are_specified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ source "${LIBRARIES_DIR}/_all_libs.sh"
export SEMAPHORE_NAME="kubernetes-tests-upgrade"

initialization::set_output_color_variables
initialization::initialize_image_build_variables

parallel::make_sure_gnu_parallel_is_installed
parallel::make_sure_python_versions_are_specified
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/libraries/_build_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ function build_images::get_github_container_registry_image_prefix() {

function build_images::get_docker_cache_image_names() {
# Python base image to use
export PYTHON_BASE_IMAGE="python:${PYTHON_MAJOR_MINOR_VERSION}-slim-buster"
export PYTHON_BASE_IMAGE="python:${PYTHON_MAJOR_MINOR_VERSION}-slim-${DEBIAN_VERSION}"

local image_name
image_name="ghcr.io/$(build_images::get_github_container_registry_image_prefix)"
Expand Down
4 changes: 2 additions & 2 deletions scripts/ci/libraries/_docker_engine_resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ function docker_engine_resources::print_overall_stats() {
}

function docker_engine_resources::get_available_cpus_in_docker() {
CPUS_AVAILABLE_FOR_DOCKER=$(docker run --rm "debian:buster-slim" grep -cE 'cpu[0-9]+' /proc/stat)
CPUS_AVAILABLE_FOR_DOCKER=$(docker run --rm "debian:${DEBIAN_VERSION}-slim" grep -cE 'cpu[0-9]+' /proc/stat)
export CPUS_AVAILABLE_FOR_DOCKER
}

function docker_engine_resources::get_available_memory_in_docker() {
MEMORY_AVAILABLE_FOR_DOCKER=$(docker run --rm --entrypoint /bin/bash "debian:buster-slim" -c 'echo $(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE) / (1024 * 1024)))')
MEMORY_AVAILABLE_FOR_DOCKER=$(docker run --rm --entrypoint /bin/bash "debian:${DEBIAN_VERSION}-slim" -c 'echo $(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE) / (1024 * 1024)))')
export MEMORY_AVAILABLE_FOR_DOCKER
}

Expand Down
5 changes: 2 additions & 3 deletions scripts/ci/libraries/_initialization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ function initialization::initialize_image_build_variables() {
# Default build id
export CI_BUILD_ID="${CI_BUILD_ID:="0"}"

export DEBIAN_VERSION=${DEBIAN_VERSION:="buster"}

# Default extras used for building Production image. The canonical source of this information is in the Dockerfile
DEFAULT_PROD_EXTRAS=$(grep "ARG AIRFLOW_EXTRAS=" "${AIRFLOW_SOURCES}/Dockerfile" |
awk 'BEGIN { FS="=" } { print $2 }' | tr -d '"')
Expand Down Expand Up @@ -632,10 +634,7 @@ function initialization::initialize_common_environment() {
function initialization::set_default_python_version_if_empty() {
# default version of python used to tag the "main" and "latest" images in DockerHub
export DEFAULT_PYTHON_MAJOR_MINOR_VERSION=3.7

# default python Major/Minor version
export PYTHON_MAJOR_MINOR_VERSION=${PYTHON_MAJOR_MINOR_VERSION:=${DEFAULT_PYTHON_MAJOR_MINOR_VERSION}}

}

function initialization::summarize_build_environment() {
Expand Down
1 change: 0 additions & 1 deletion scripts/ci/testing/ci_run_airflow_testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ function run_all_test_types_in_parallel() {
parallel::print_job_summary_and_return_status_code
}


testing::skip_tests_if_requested

build_images::prepare_ci_build
Expand Down