This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch install-rustup-cargo-in-images in repository https://gitbox.apache.org/repos/asf/airflow.git
commit b3a9571214e3769d64b58affe1a1af665b372d29 Author: Jarek Potiuk <[email protected]> AuthorDate: Tue Mar 31 14:56:59 2026 +0200 Install rustup and cargo in CI and prod build images --- .github/workflows/additional-ci-image-checks.yml | 8 ++++++-- Dockerfile | 11 +++++++++++ Dockerfile.ci | 12 +++++++++++- scripts/docker/install_os_dependencies.sh | 7 +++++++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/additional-ci-image-checks.yml b/.github/workflows/additional-ci-image-checks.yml index 6a33cea24a9..e39fcbd43b5 100644 --- a/.github/workflows/additional-ci-image-checks.yml +++ b/.github/workflows/additional-ci-image-checks.yml @@ -116,8 +116,10 @@ jobs: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') # Check that after earlier cache push, breeze command will build quickly + # This build is a bit slow from in-the scratch builds, so we should run it only in + # regular PRs check-that-image-builds-quickly: - timeout-minutes: 17 + timeout-minutes: 25 name: Check that image builds quickly runs-on: ${{ fromJSON(inputs.runners) }} env: @@ -141,4 +143,6 @@ jobs: - name: "Install Breeze" uses: ./.github/actions/breeze - name: "Check that image builds quickly" - run: breeze shell --max-time 900 --platform "${PLATFORM}" + # Synchronize to be a little bit shorter than above timeout-minutes to make sure that + # if the build takes too long the job will fail with logs. 22 minutes * 60 s = 1320 seconds + run: breeze shell --max-time 1320 --platform "${PLATFORM}" diff --git a/Dockerfile b/Dockerfile index 6c5f6ebb920..b88b4a86f89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -122,6 +122,7 @@ fi AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION:-3.10.18} PYTHON_LTO=${PYTHON_LTO:-true} GOLANG_MAJOR_MINOR_VERSION=${GOLANG_MAJOR_MINOR_VERSION:-1.24.4} +RUSTUP_DEFAULT_TOOLCHAIN=${RUSTUP_DEFAULT_TOOLCHAIN:-stable} COSIGN_VERSION=${COSIGN_VERSION:-3.0.5} if [[ "${1}" == "runtime" ]]; then @@ -493,6 +494,11 @@ function install_golang() { rm -rf /usr/local/go && tar -C /usr/local -xzf go"${GOLANG_MAJOR_MINOR_VERSION}".linux.tar.gz } +function install_rustup() { + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ + sh -s -- -y --default-toolchain "${RUSTUP_DEFAULT_TOOLCHAIN}" +} + function apt_clean() { apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false rm -rf /var/lib/apt/lists/* /var/log/* @@ -508,6 +514,7 @@ else install_debian_dev_dependencies install_python install_additional_dev_dependencies + install_rustup if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then install_golang fi @@ -1843,6 +1850,10 @@ ENV DEV_APT_DEPS=${DEV_APT_DEPS} \ ARG PYTHON_LTO +ENV RUSTUP_HOME="/usr/local/rustup" +ENV CARGO_HOME="/usr/local/cargo" +ENV PATH="${CARGO_HOME}/bin:${PATH}" + COPY --from=scripts install_os_dependencies.sh /scripts/docker/ RUN PYTHON_LTO=${PYTHON_LTO} bash /scripts/docker/install_os_dependencies.sh dev diff --git a/Dockerfile.ci b/Dockerfile.ci index 2b1c38f371e..aa4d5d03c7a 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -62,6 +62,7 @@ fi AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION:-3.10.18} PYTHON_LTO=${PYTHON_LTO:-true} GOLANG_MAJOR_MINOR_VERSION=${GOLANG_MAJOR_MINOR_VERSION:-1.24.4} +RUSTUP_DEFAULT_TOOLCHAIN=${RUSTUP_DEFAULT_TOOLCHAIN:-stable} COSIGN_VERSION=${COSIGN_VERSION:-3.0.5} if [[ "${1}" == "runtime" ]]; then @@ -433,6 +434,11 @@ function install_golang() { rm -rf /usr/local/go && tar -C /usr/local -xzf go"${GOLANG_MAJOR_MINOR_VERSION}".linux.tar.gz } +function install_rustup() { + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ + sh -s -- -y --default-toolchain "${RUSTUP_DEFAULT_TOOLCHAIN}" +} + function apt_clean() { apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false rm -rf /var/lib/apt/lists/* /var/log/* @@ -448,6 +454,7 @@ else install_debian_dev_dependencies install_python install_additional_dev_dependencies + install_rustup if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then install_golang fi @@ -1646,6 +1653,9 @@ ENV DEV_APT_COMMAND=${DEV_APT_COMMAND} \ ARG AIRFLOW_PYTHON_VERSION="3.12.13" ENV AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION} ENV GOLANG_MAJOR_MINOR_VERSION="1.26.1" +ENV RUSTUP_HOME="/usr/local/rustup" +ENV CARGO_HOME="/usr/local/cargo" +ENV PATH="${CARGO_HOME}/bin:${PATH}" ARG PYTHON_LTO @@ -1805,7 +1815,7 @@ ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION} \ AIRFLOW_PREK_VERSION=${AIRFLOW_PREK_VERSION} # The PATH is needed for python to find installed and cargo to build the wheels -ENV PATH="/usr/python/bin:/root/.local/bin:/root/.cargo/bin:${PATH}" +ENV PATH="/usr/python/bin:/root/.local/bin:${PATH}" # Useful for creating a cache id based on the underlying architecture, preventing the use of cached python packages from # an incorrect architecture. ARG TARGETARCH diff --git a/scripts/docker/install_os_dependencies.sh b/scripts/docker/install_os_dependencies.sh index 95b1679a250..a93adef0695 100644 --- a/scripts/docker/install_os_dependencies.sh +++ b/scripts/docker/install_os_dependencies.sh @@ -28,6 +28,7 @@ fi AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION:-3.10.18} PYTHON_LTO=${PYTHON_LTO:-true} GOLANG_MAJOR_MINOR_VERSION=${GOLANG_MAJOR_MINOR_VERSION:-1.24.4} +RUSTUP_DEFAULT_TOOLCHAIN=${RUSTUP_DEFAULT_TOOLCHAIN:-stable} COSIGN_VERSION=${COSIGN_VERSION:-3.0.5} if [[ "${1}" == "runtime" ]]; then @@ -399,6 +400,11 @@ function install_golang() { rm -rf /usr/local/go && tar -C /usr/local -xzf go"${GOLANG_MAJOR_MINOR_VERSION}".linux.tar.gz } +function install_rustup() { + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ + sh -s -- -y --default-toolchain "${RUSTUP_DEFAULT_TOOLCHAIN}" +} + function apt_clean() { apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false rm -rf /var/lib/apt/lists/* /var/log/* @@ -414,6 +420,7 @@ else install_debian_dev_dependencies install_python install_additional_dev_dependencies + install_rustup if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then install_golang fi
