Skip to content

Conversation

@potiuk
Copy link
Member

@potiuk potiuk commented Jan 30, 2022

Airflow produces images for multiple versions. Sometimes we
release several images for different versions close to one another
when base Python image is the same. In those cases it would be
great if images for different Airflow versions shared as much
as possible of image layers - the "base" dependencies usually
do not change between versions so two images with the same Python
version could only start differring at the moment we start to
install Airflow for the first time.

This change moves AIRFLOW_VERSION ARG declaration and ENV variable
as late as possible, so that earlier layers in the Docker images are
the same for different Airflow image versions as long as the base
Python image is the same.

This should decrease significantly used space if someone switches
between two Airflow versions in the same system (for testing
or when doing migration). It also should speed up cache
refreshing and rebuilding and decrease overall size of the cache
used by multiple Airflow Images (especially when we are close
to release (like we are now with Airlfow 2.2.4)


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@potiuk potiuk requested review from ashb and mik-laj as code owners January 30, 2022 13:34
@boring-cyborg boring-cyborg bot added area:dev-tools area:production-image Production image improvements and fixes labels Jan 30, 2022
@potiuk potiuk force-pushed the optimize-cross-version-image-caching branch from b651bbd to 8ccd896 Compare January 30, 2022 13:39
@potiuk potiuk closed this Jan 30, 2022
@potiuk potiuk reopened this Jan 30, 2022
Airflow produces images for multiple versions. Sometimes we
release several images for different versions close to one another
when base Python image is the same. In those cases it would be
great if images for different Airflow versions shared as much
as possible of image layers - the "base" dependencies usually
do not change between versions so two images with the same Python
version could only start differring at the moment we start to
install Airflow for the first time.

This change moves AIRFLOW_VERSION ARG declaration and ENV variable
as late as possible, so that earlier layers in the Docker images are the
same for different Airflow image versions as long as the base Python
image is the same.

This should decrease significantly used space if someone switches
between two Airflow versions in the same system (for testing
or when doing migration). It also should speed up cache
refreshing and rebuilding and decrease overall size of the cache
used by multiple Airflow Images (especially when we are close
to release (like we are now with Airlfow 2.2.4)
@potiuk potiuk force-pushed the optimize-cross-version-image-caching branch from 8ccd896 to 2eda0b5 Compare January 30, 2022 16:03
@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Jan 30, 2022
@potiuk potiuk merged commit a879219 into apache:main Jan 30, 2022
@potiuk potiuk deleted the optimize-cross-version-image-caching branch January 30, 2022 20:07
@potiuk potiuk restored the optimize-cross-version-image-caching branch April 26, 2022 20:52
@potiuk potiuk deleted the optimize-cross-version-image-caching branch July 29, 2022 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:production-image Production image improvements and fixes full tests needed We need to run full set of tests for this PR to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants