-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat: build Airflow and Superset from source #1304
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c2762f3
wip
dervoeti 98870e8
add build of UI assets for 3.x
adwk67 914a373
Merge branch 'main' of https://github.com/stackabletech/docker-images…
dervoeti 64bcd0c
wip
dervoeti 467a552
feat: build airflow 2 from source
dervoeti 3b7efec
fix: airflow build
dervoeti ad4f7aa
feat: build superset from source
dervoeti 52fc1e0
chore: move statsd_exporter to final stage
dervoeti e59ada1
Merge branch 'main' of https://github.com/stackabletech/docker-images…
dervoeti 2a4c068
chore: removed testpatch
dervoeti 1b2c469
chore: changelog
dervoeti adda3ab
chore: lint fix
dervoeti afc546b
Merge branch 'main' into spike/airflow-from-source
dervoeti 7e635d4
chore: use HOME env consistently
dervoeti e1b5680
Merge branch 'main' into spike/airflow-from-source
dervoeti 6a97e28
Merge branch 'main' into spike/airflow-from-source
dervoeti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,13 +37,13 @@ uv run pytest --disable-warnings | |
| uv build | ||
| EOF | ||
|
|
||
| FROM local-image/vector AS airflow-build-image | ||
| FROM local-image/stackable-devel AS airflow-build-image | ||
|
|
||
| ARG PRODUCT_VERSION | ||
| ARG SHARED_STATSD_EXPORTER_VERSION | ||
| ARG PYTHON_VERSION | ||
| ARG TARGETARCH | ||
| ARG STACKABLE_USER_UID | ||
| ARG NODEJS_VERSION | ||
| ARG S3FS_VERSION | ||
| ARG CYCLONEDX_BOM_VERSION | ||
| ARG UV_VERSION | ||
|
|
@@ -54,7 +54,8 @@ ARG UV_VERSION | |
| # Requires implementation of https://github.com/apache/airflow/blob/2.2.5/scripts/docker/install_mysql.sh | ||
| ARG AIRFLOW_EXTRAS | ||
|
|
||
| RUN microdnf update && \ | ||
| RUN microdnf module enable -y nodejs:${NODEJS_VERSION} && \ | ||
| microdnf update && \ | ||
| microdnf install \ | ||
| cyrus-sasl-devel \ | ||
| # Needed by ./configure to build gevent, see snippet [1] at the end of file | ||
|
|
@@ -72,6 +73,9 @@ RUN microdnf update && \ | |
| python${PYTHON_VERSION}-wheel \ | ||
| # The airflow odbc provider can compile without the development files (headers and libraries) (see https://github.com/stackabletech/docker-images/pull/683) | ||
| unixODBC \ | ||
| # Needed for Airflow UI assets | ||
| npm \ | ||
| nodejs \ | ||
| # Needed to modify the SBOM | ||
| jq && \ | ||
| microdnf clean all && \ | ||
|
|
@@ -81,6 +85,11 @@ COPY airflow/stackable/constraints/${PRODUCT_VERSION}/constraints-python${PYTHON | |
| COPY airflow/stackable/constraints/${PRODUCT_VERSION}/build-constraints-python${PYTHON_VERSION}.txt /tmp/build-constraints.txt | ||
| COPY --from=opa-auth-manager-builder /tmp/opa-auth-manager/dist/opa_auth_manager-0.1.0-py3-none-any.whl /tmp/ | ||
|
|
||
| COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/patches/patchable.toml /stackable/src/airflow/stackable/patches/patchable.toml | ||
| COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/patches/${PRODUCT_VERSION} /stackable/src/airflow/stackable/patches/${PRODUCT_VERSION} | ||
|
|
||
| WORKDIR /stackable | ||
|
|
||
| RUN <<EOF | ||
| python${PYTHON_VERSION} -m venv --system-site-packages /stackable/app | ||
|
|
||
|
|
@@ -90,8 +99,44 @@ source /stackable/app/bin/activate | |
| # Also install uv to get support for build constraints | ||
| pip install --no-cache-dir --upgrade pip | ||
| pip install --no-cache-dir uv==${UV_VERSION} | ||
| uv tool install hatch | ||
|
|
||
| cd "$(/stackable/patchable --images-repo-root=src checkout airflow ${PRODUCT_VERSION})" | ||
|
|
||
| if [ -d "./airflow-core" ]; then | ||
| # Airflow 3.x | ||
| cd airflow-core/src/airflow/ui | ||
|
|
||
| # build front-end assets | ||
| npm install -g [email protected] | ||
| pnpm install --frozen-lockfile | ||
| pnpm run build | ||
|
|
||
| # build airflow wheel from airflow root folder | ||
| # this picks up the UI assets from the pnpm build, and the dependencies from the root folder | ||
| cd ../../.. | ||
| /root/.local/bin/hatch build -t wheel | ||
| # First install the full apache-airflow package to get all dependencies including database drivers | ||
| uv pip install --no-cache-dir apache-airflow[${AIRFLOW_EXTRAS}]==${PRODUCT_VERSION} --constraint /tmp/constraints.txt --build-constraints /tmp/build-constraints.txt | ||
| # Then install the locally built core wheel to override the core package | ||
| uv pip install --no-cache-dir dist/apache_airflow_core-${PRODUCT_VERSION}-py3-none-any.whl[${AIRFLOW_EXTRAS}] --constraint /tmp/constraints.txt --build-constraints /tmp/build-constraints.txt | ||
| else | ||
| # Airflow 2.x | ||
| # build front-end assets | ||
| cd airflow/www | ||
| npm install -g [email protected] | ||
| yarn install --frozen-lockfile | ||
| yarn run build | ||
|
|
||
| # build airflow wheel from airflow root folder | ||
| cd ../.. | ||
| /root/.local/bin/hatch build -t wheel | ||
| # First install the full apache-airflow package to get all dependencies including database drivers | ||
| uv pip install --no-cache-dir apache-airflow[${AIRFLOW_EXTRAS}]==${PRODUCT_VERSION} --constraint /tmp/constraints.txt --build-constraints /tmp/build-constraints.txt | ||
| # Then install the locally built wheel to override with patched version | ||
| uv pip install --no-cache-dir dist/apache_airflow-${PRODUCT_VERSION}-py3-none-any.whl[${AIRFLOW_EXTRAS}] --constraint /tmp/constraints.txt --build-constraints /tmp/build-constraints.txt | ||
| fi | ||
|
|
||
| uv pip install --no-cache-dir apache-airflow[${AIRFLOW_EXTRAS}]==${PRODUCT_VERSION} --constraint /tmp/constraints.txt --build-constraints /tmp/build-constraints.txt | ||
| # Needed for pandas S3 integration to e.g. write and read csv and parquet files to/from S3 | ||
| uv pip install --no-cache-dir s3fs==${S3FS_VERSION} cyclonedx-bom==${CYCLONEDX_BOM_VERSION} | ||
| # Needed for OIDC | ||
|
|
@@ -102,6 +147,7 @@ uv pip install --no-cache-dir /tmp/opa_auth_manager-0.1.0-py3-none-any.whl | |
| # Create the SBOM for Airflow | ||
| # Important: All `pip install` commands must be above this line, otherwise the SBOM will be incomplete | ||
| cyclonedx-py environment --schema-version 1.5 --outfile /tmp/sbom.json | ||
| uv pip uninstall cyclonedx-bom | ||
|
|
||
| # Break circular dependencies by removing the apache-airflow dependency from the providers | ||
| jq '.dependencies |= map(if .ref | test("^apache-airflow-providers-") then | ||
|
|
@@ -111,10 +157,6 @@ else | |
| end)' /tmp/sbom.json > /stackable/app/airflow-${PRODUCT_VERSION}.cdx.json | ||
| EOF | ||
|
|
||
| COPY --from=statsd_exporter-builder /statsd_exporter/statsd_exporter /stackable/statsd_exporter | ||
| COPY --from=statsd_exporter-builder /statsd_exporter/statsd_exporter-${SHARED_STATSD_EXPORTER_VERSION}.cdx.json /stackable/statsd_exporter-${SHARED_STATSD_EXPORTER_VERSION}.cdx.json | ||
| COPY --from=gitsync-image --chown=${STACKABLE_USER_UID}:0 /git-sync /stackable/git-sync | ||
|
|
||
| RUN <<EOF | ||
| mkdir -pv /stackable/airflow | ||
| mkdir -pv /stackable/airflow/dags | ||
|
|
@@ -130,6 +172,7 @@ ARG PYTHON_VERSION | |
| ARG RELEASE_VERSION | ||
| ARG TINI_VERSION | ||
| ARG TARGETARCH | ||
| ARG SHARED_STATSD_EXPORTER_VERSION | ||
| ARG STACKABLE_USER_UID | ||
|
|
||
| LABEL name="Apache Airflow" \ | ||
|
|
@@ -146,11 +189,14 @@ ENV PATH=$PATH:/bin:$HOME/app/bin | |
| ENV AIRFLOW_HOME=$HOME/airflow | ||
|
|
||
| COPY --from=airflow-build-image --chown=${STACKABLE_USER_UID}:0 /stackable/ ${HOME}/ | ||
| COPY --from=airflow-build-image --chown=${STACKABLE_USER_UID}:0 /stackable/git-sync ${HOME}/git-sync | ||
|
|
||
| COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/entrypoint.sh /entrypoint.sh | ||
| COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/run-airflow.sh /run-airflow.sh | ||
|
|
||
| COPY --from=statsd_exporter-builder --chown=${STACKABLE_USER_UID}:0 /statsd_exporter/statsd_exporter /stackable/statsd_exporter | ||
| COPY --from=statsd_exporter-builder --chown=${STACKABLE_USER_UID}:0 /statsd_exporter/statsd_exporter-${SHARED_STATSD_EXPORTER_VERSION}.cdx.json /stackable/statsd_exporter-${SHARED_STATSD_EXPORTER_VERSION}.cdx.json | ||
| COPY --from=gitsync-image --chown=${STACKABLE_USER_UID}:0 /git-sync /stackable/git-sync | ||
|
|
||
| COPY airflow/licenses /licenses | ||
|
|
||
| # Update image and install needed packages | ||
|
|
@@ -185,6 +231,7 @@ curl -o /usr/bin/tini "https://repo.stackable.tech/repository/packages/tini/tini | |
| chmod a+x /entrypoint.sh | ||
| chmod a+x /run-airflow.sh | ||
| chmod +x /usr/bin/tini | ||
| chmod g=u /stackable/statsd_exporter /stackable/statsd_exporter-${SHARED_STATSD_EXPORTER_VERSION}.cdx.json /stackable/git-sync | ||
| EOF | ||
|
|
||
| # ---------------------------------------- | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| mirror = "https://github.com/stackabletech/airflow.git" | ||
| base = "b93c3db6b1641b0840bd15ac7d05bc58ff2cccbf" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| mirror = "https://github.com/stackabletech/airflow.git" | ||
| base = "81845de9d95a733b4eb7826aaabe23ba9813eba3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| mirror = "https://github.com/stackabletech/airflow.git" | ||
| base = "4ecebc2973587ebaa2cb12482de82e93d15c092f" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| mirror = "https://github.com/stackabletech/airflow.git" | ||
| base = "e965c2e676d85ced65a485d4b2601addc2fd3e97" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| upstream = "https://github.com/apache/airflow.git" | ||
| default-mirror = "https://github.com/stackabletech/airflow.git" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.