Skip to content

Commit 36ba5b6

Browse files
authored
Clarifies installation/runtime options for CI/PROD images. (apache#15320)
After PROD images were added, some of the flags had two meanings These behaved differently in PROD image and CI image and were the source of confusion especially when start-airflow command was used. For PROD image, the image can be customized during image building, and packages could be installed from .whl or .sdist packages available in `docker-context-files`. This is used at CI and dockerhub building time to produce image built packages that were prepared using local sources. The CI image is always built from local sources but airflow can be removed and re-installed at runtime from pypi. Both airflow and provider packages can be installed from .whl or .sdist packages available in dist folder. This is used in CI to test current provider packages with older Airflow released (2.0.0) and to test provider packages locally. After the change we have two sets of flags/variables: PROD image (building image): * install-airflow-version, install-airflow-reference, install-from-docker-context-files CI image (runtime): * use-airflow-version, use-packages-from-dist That should avoid confusion and failures of commands such as `start-airflow` that is used to test provider packages and airflow itself.
1 parent 3584455 commit 36ba5b6

22 files changed

+289
-319
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,12 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
551551
- name: "Install and test provider packages and airflow via wheel files"
552552
run: ./scripts/ci/provider_packages/ci_install_and_test_provider_packages.sh
553553
env:
554-
INSTALL_AIRFLOW_VERSION: "wheel"
554+
USE_AIRFLOW_VERSION: "wheel"
555555
PACKAGE_FORMAT: "wheel"
556556
- name: "Install and test provider packages and airflow on Airflow 2.0 files"
557557
run: ./scripts/ci/provider_packages/ci_install_and_test_provider_packages.sh
558558
env:
559-
INSTALL_AIRFLOW_VERSION: "2.0.0"
559+
USE_AIRFLOW_VERSION: "2.0.0"
560560
PACKAGE_FORMAT: "wheel"
561561

562562
prepare-test-provider-packages-sdist:
@@ -597,7 +597,7 @@ ${{ hashFiles('.pre-commit-config.yaml') }}"
597597
- name: "Install and test provider packages and airflow via sdist files"
598598
run: ./scripts/ci/provider_packages/ci_install_and_test_provider_packages.sh
599599
env:
600-
INSTALL_AIRFLOW_VERSION: "sdist"
600+
USE_AIRFLOW_VERSION: "sdist"
601601
PACKAGE_FORMAT: "sdist"
602602

603603
tests-helm:

BREEZE.rst

+55-58
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,8 @@ This is the current syntax for `./breeze <./breeze>`_:
12501250
'breeze \
12511251
--github-image-id 209845560' - pull/use image with RUN_ID
12521252
1253+
Most flags are applicable to the shell command as it will run build when needed.
1254+
12531255
12541256
####################################################################################################
12551257
@@ -1310,41 +1312,21 @@ This is the current syntax for `./breeze <./breeze>`_:
13101312
2.7 3.5 3.6 3.7 3.8
13111313
13121314
-a, --install-airflow-version INSTALL_AIRFLOW_VERSION
1313-
In CI image, installs Airflow (in entrypoint) from PIP released version or using
1314-
the installation method specified (sdist, wheel, none).
1315-
1316-
In PROD image the installation of selected method or version happens during image building.
1317-
For PROD image, the 'none' options is not valid.
1318-
1319-
One of:
1315+
Uses differen version of Airflow when building PROD image.
13201316
1321-
2.0.1 2.0.0 1.10.15 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 none wheel sdist
1322-
1323-
When 'none' is used, you can install airflow from local packages. When building image,
1324-
airflow package should be added to 'docker-context-files' and
1325-
--install-from-docker-context-files flag should be used. When running an image, airflow
1326-
package should be added to dist folder and --install-packages-from-dist flag should be used.
1317+
2.0.1 2.0.0 1.10.15 1.10.14 wheel sdist
13271318
13281319
-t, --install-airflow-reference INSTALL_AIRFLOW_REFERENCE
1329-
If specified, installs Airflow directly from reference in GitHub. This happens at
1330-
image building time in production image and at container entering time for CI image.
1320+
Installs Airflow directly from reference in GitHub when building PROD image.
13311321
This can be a GitHub branch like master or v1-10-test, or a tag like 2.0.0a1.
13321322
13331323
--installation-method INSTALLATION_METHOD
1334-
Method of installing airflow for production image - either from the sources ('.')
1324+
Method of installing Airflow in PROD image - either from the sources ('.')
13351325
or from package 'apache-airflow' to install from PyPI.
13361326
Default in Breeze is to install from sources. One of:
13371327
13381328
. apache-airflow
13391329
1340-
--no-rbac-ui
1341-
Disables RBAC UI when Airflow 1.10.* is installed.
1342-
1343-
--install-packages-from-dist
1344-
If specified it will look for packages placed in dist folder and it will install the
1345-
packages after installing Airflow. This is useful for testing provider
1346-
packages.
1347-
13481330
--upgrade-to-newer-dependencies
13491331
Upgrades PIP packages to latest versions available without looking at the constraints.
13501332
@@ -1392,12 +1374,12 @@ This is the current syntax for `./breeze <./breeze>`_:
13921374
are needed by the extras. When you build image during the development (which is
13931375
default in Breeze) all providers are installed by default from sources.
13941376
You can disable it by adding this flag but then you have to install providers from
1395-
wheel packages via --install-packages-from-dist flag.
1377+
wheel packages via --use-packages-from-dist flag.
13961378
13971379
--disable-pypi-when-building
13981380
Disable installing Airflow from pypi when building. If you use this flag and want
13991381
to install Airflow, you have to install it from packages placed in
1400-
'docker-context-files' and use --install-from-local-files-when-building flag.
1382+
'docker-context-files' and use --install-from-docker-context-files flag.
14011383
14021384
--additional-extras ADDITIONAL_EXTRAS
14031385
Additional extras to pass to build images The default is no additional extras.
@@ -1452,7 +1434,7 @@ This is the current syntax for `./breeze <./breeze>`_:
14521434
--disable-pip-cache
14531435
Disables GitHub PIP cache during the build. Useful if GitHub is not reachable during build.
14541436
1455-
--install-from-local-files-when-building
1437+
--install-from-docker-context-files
14561438
This flag is used during image building. If it is used additionally to installing
14571439
Airflow from PyPI, the packages are installed from the .whl and .tar.gz packages placed
14581440
in the 'docker-context-files' folder. The same flag can be used during entering the image in
@@ -1839,6 +1821,22 @@ This is the current syntax for `./breeze <./breeze>`_:
18391821
18401822
Flags:
18411823
1824+
--use-airflow-version AIRFLOW_SPECIFICATION
1825+
In CI image, installs Airflow at runtime from PIP released version or using
1826+
the installation method specified (sdist, wheel, none). When 'none' is used,
1827+
airflow is just removed. In this case airflow package should be added to dist folder
1828+
and --use-packages-from-dist flag should be used.
1829+
1830+
2.0.1 2.0.0 1.10.15 1.10.14 wheel sdist none
1831+
1832+
--use-packages-from-dist
1833+
In CI image, if specified it will look for packages placed in dist folder and
1834+
it will install the packages after entering the image.
1835+
This is useful for testing provider packages.
1836+
1837+
--no-rbac-ui
1838+
Disables RBAC UI when Airflow 1.10.* is installed.
1839+
18421840
--load-example-dags
18431841
Include Airflow example dags.
18441842
@@ -2043,12 +2041,12 @@ This is the current syntax for `./breeze <./breeze>`_:
20432041
are needed by the extras. When you build image during the development (which is
20442042
default in Breeze) all providers are installed by default from sources.
20452043
You can disable it by adding this flag but then you have to install providers from
2046-
wheel packages via --install-packages-from-dist flag.
2044+
wheel packages via --use-packages-from-dist flag.
20472045
20482046
--disable-pypi-when-building
20492047
Disable installing Airflow from pypi when building. If you use this flag and want
20502048
to install Airflow, you have to install it from packages placed in
2051-
'docker-context-files' and use --install-from-local-files-when-building flag.
2049+
'docker-context-files' and use --install-from-docker-context-files flag.
20522050
20532051
--additional-extras ADDITIONAL_EXTRAS
20542052
Additional extras to pass to build images The default is no additional extras.
@@ -2103,7 +2101,7 @@ This is the current syntax for `./breeze <./breeze>`_:
21032101
--disable-pip-cache
21042102
Disables GitHub PIP cache during the build. Useful if GitHub is not reachable during build.
21052103
2106-
--install-from-local-files-when-building
2104+
--install-from-docker-context-files
21072105
This flag is used during image building. If it is used additionally to installing
21082106
Airflow from PyPI, the packages are installed from the .whl and .tar.gz packages placed
21092107
in the 'docker-context-files' folder. The same flag can be used during entering the image in
@@ -2526,50 +2524,49 @@ This is the current syntax for `./breeze <./breeze>`_:
25262524
Assume 'quit' answer to all questions.
25272525
25282526
****************************************************************************************************
2529-
Choose different Airflow version to install or run
2527+
Install different Airflow version during PROD image build
25302528
25312529
-a, --install-airflow-version INSTALL_AIRFLOW_VERSION
2532-
In CI image, installs Airflow (in entrypoint) from PIP released version or using
2533-
the installation method specified (sdist, wheel, none).
2530+
Uses differen version of Airflow when building PROD image.
25342531
2535-
In PROD image the installation of selected method or version happens during image building.
2536-
For PROD image, the 'none' options is not valid.
2537-
2538-
One of:
2539-
2540-
2.0.1 2.0.0 1.10.15 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 none wheel sdist
2541-
2542-
When 'none' is used, you can install airflow from local packages. When building image,
2543-
airflow package should be added to 'docker-context-files' and
2544-
--install-from-docker-context-files flag should be used. When running an image, airflow
2545-
package should be added to dist folder and --install-packages-from-dist flag should be used.
2532+
2.0.1 2.0.0 1.10.15 1.10.14 wheel sdist
25462533
25472534
-t, --install-airflow-reference INSTALL_AIRFLOW_REFERENCE
2548-
If specified, installs Airflow directly from reference in GitHub. This happens at
2549-
image building time in production image and at container entering time for CI image.
2535+
Installs Airflow directly from reference in GitHub when building PROD image.
25502536
This can be a GitHub branch like master or v1-10-test, or a tag like 2.0.0a1.
25512537
25522538
--installation-method INSTALLATION_METHOD
2553-
Method of installing airflow for production image - either from the sources ('.')
2539+
Method of installing Airflow in PROD image - either from the sources ('.')
25542540
or from package 'apache-airflow' to install from PyPI.
25552541
Default in Breeze is to install from sources. One of:
25562542
25572543
. apache-airflow
25582544
2559-
--no-rbac-ui
2560-
Disables RBAC UI when Airflow 1.10.* is installed.
2561-
2562-
--install-packages-from-dist
2563-
If specified it will look for packages placed in dist folder and it will install the
2564-
packages after installing Airflow. This is useful for testing provider
2565-
packages.
2566-
25672545
--upgrade-to-newer-dependencies
25682546
Upgrades PIP packages to latest versions available without looking at the constraints.
25692547
25702548
--continue-on-pip-check-failure
25712549
Continue even if 'pip check' fails.
25722550
2551+
****************************************************************************************************
2552+
Use different Airflow version at runtime in CI image
2553+
2554+
--use-airflow-version AIRFLOW_SPECIFICATION
2555+
In CI image, installs Airflow at runtime from PIP released version or using
2556+
the installation method specified (sdist, wheel, none). When 'none' is used,
2557+
airflow is just removed. In this case airflow package should be added to dist folder
2558+
and --use-packages-from-dist flag should be used.
2559+
2560+
2.0.1 2.0.0 1.10.15 1.10.14 wheel sdist none
2561+
2562+
--use-packages-from-dist
2563+
In CI image, if specified it will look for packages placed in dist folder and
2564+
it will install the packages after entering the image.
2565+
This is useful for testing provider packages.
2566+
2567+
--no-rbac-ui
2568+
Disables RBAC UI when Airflow 1.10.* is installed.
2569+
25732570
****************************************************************************************************
25742571
Credentials
25752572
@@ -2618,12 +2615,12 @@ This is the current syntax for `./breeze <./breeze>`_:
26182615
are needed by the extras. When you build image during the development (which is
26192616
default in Breeze) all providers are installed by default from sources.
26202617
You can disable it by adding this flag but then you have to install providers from
2621-
wheel packages via --install-packages-from-dist flag.
2618+
wheel packages via --use-packages-from-dist flag.
26222619
26232620
--disable-pypi-when-building
26242621
Disable installing Airflow from pypi when building. If you use this flag and want
26252622
to install Airflow, you have to install it from packages placed in
2626-
'docker-context-files' and use --install-from-local-files-when-building flag.
2623+
'docker-context-files' and use --install-from-docker-context-files flag.
26272624
26282625
--additional-extras ADDITIONAL_EXTRAS
26292626
Additional extras to pass to build images The default is no additional extras.
@@ -2678,7 +2675,7 @@ This is the current syntax for `./breeze <./breeze>`_:
26782675
--disable-pip-cache
26792676
Disables GitHub PIP cache during the build. Useful if GitHub is not reachable during build.
26802677
2681-
--install-from-local-files-when-building
2678+
--install-from-docker-context-files
26822679
This flag is used during image building. If it is used additionally to installing
26832680
Airflow from PyPI, the packages are installed from the .whl and .tar.gz packages placed
26842681
in the 'docker-context-files' folder. The same flag can be used during entering the image in

CI.rst

-10
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,6 @@ You can use those variables when you try to reproduce the build locally.
253253
+-----------------------------------------+-------------+-------------+------------+-------------------------------------------------+
254254
| ``HOST_HOME`` | | | | Home directory on the host. |
255255
+-----------------------------------------+-------------+-------------+------------+-------------------------------------------------+
256-
| Image variables |
257-
+-----------------------------------------+-------------+-------------+------------+-------------------------------------------------+
258-
| ``INSTALL_AIRFLOW_VERSION`` | | | | Installs Airflow version from PyPI when |
259-
| | | | | building image. Can be "none" to skip airflow |
260-
| | | | | installation so that it can be installed from |
261-
| | | | | locally prepared packages. |
262-
+-----------------------------------------+-------------+-------------+------------+-------------------------------------------------+
263-
| ``INSTALL_AIRFLOW_REFERENCE`` | | | | Installs Airflow version from GitHub |
264-
| | | | | branch or tag. |
265-
+-----------------------------------------+-------------+-------------+------------+-------------------------------------------------+
266256
| Version suffix variables |
267257
+-----------------------------------------+-------------+-------------+------------+-------------------------------------------------+
268258
| ``VERSION_SUFFIX_FOR_PYPI`` | | | | Version suffix used during provider |

Dockerfile.ci

-14
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,6 @@ ENV AIRFLOW_PRE_CACHED_PIP_PACKAGES=${AIRFLOW_PRE_CACHED_PIP_PACKAGES}
260260
ARG INSTALL_PROVIDERS_FROM_SOURCES="true"
261261
ENV INSTALL_PROVIDERS_FROM_SOURCES=${INSTALL_PROVIDERS_FROM_SOURCES}
262262

263-
ARG INSTALL_FROM_DOCKER_CONTEXT_FILES=""
264-
ENV INSTALL_FROM_DOCKER_CONTEXT_FILES=${INSTALL_FROM_DOCKER_CONTEXT_FILES}
265-
266263
ARG INSTALL_FROM_PYPI="true"
267264
ENV INSTALL_FROM_PYPI=${INSTALL_FROM_PYPI}
268265

@@ -367,17 +364,6 @@ RUN if [[ ${INSTALL_FROM_PYPI} == "true" ]]; then \
367364
bash /scripts/docker/install_airflow.sh; \
368365
fi
369366

370-
# Only copy install_from_docker_context_files.sh to not invalidate cache on other script changes
371-
COPY scripts/docker/install_from_docker_context_files.sh /scripts/docker/install_from_docker_context_files.sh
372-
373-
# If wheel files are found in /docker-context-files during installation
374-
# they are also installed additionally to whatever is installed from Airflow.
375-
COPY docker-context-files/ /docker-context-files/
376-
377-
RUN if [[ ${INSTALL_FROM_DOCKER_CONTEXT_FILES} == "true" ]]; then \
378-
bash /scripts/docker/install_from_docker_context_files.sh; \
379-
fi
380-
381367
# Copy all the www/ files we need to compile assets. Done as two separate COPY
382368
# commands so as otherwise it copies the _contents_ of static/ in to www/
383369
COPY airflow/www/webpack.config.js ${AIRFLOW_SOURCES}/airflow/www/

0 commit comments

Comments
 (0)