You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Laszlo Gaal (Code Review)" <ge...@cloudera.org> on 2025/03/05 22:43:58 UTC

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Laszlo Gaal has uploaded this change for review. ( http://gerrit.cloudera.org:8080/22583


Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................

IMPALA-13825: Extend Docker container build to custom base images

Downstream system vendors, users and customers have lately expressed
interest in consuming Impala in containerized forms, taking advantage of
various specialized, hardened container base image offerings, like
container offerings based on the Wolfi project by Chainguard;
see: https://github.com/wolfi-dev.

This patch enables Impala container images to be built on top of custom
base images, and adds an implementation example that uses the publicly
available Wolfi base image.

Building a customized Docker image follows a hybrid approach. Instead of
replicating the complete Impala build process inside a Wolfi container
for a fully native binary build, it relies on an existing build platform
that is compatible with the binary packages available inside the custom
container image. For Wolfi the Impala binaries are supplied by the
Red Hat 9 build of Impala. This is made possible by the fact that major
library dependencies of Impala have the same versions on Wolfi OS and
Red Hat 9, so binaries built on Red Hat 9 can be run on Wolfi
with no changes.

The binaries produced by the regular build process are then installed
into a Docker image built on top of an explicitly specified custom base
image. The selection of a custom base image is controlled by two
environment variables:
- USE_HARDENED_IMPALA_BASE_IMAGE:
  If set to 'true', triggers the use of  the custom image.
  When set to 'false' or left unspecified, the Docker base image is
  selected by the existing logic of matching the build platform's
  operating system.
- IMPALA_HARDENED_DOCKER_BASE: specifies the URI of the base image

These environment variables can be overridden from the environment. They
are reported at the end of bin/impala-config.sh where important
environment variables are listed. They are also added to the list of
variables explicitly preserved during Dockerised minicluster testing to
ensure that they work in the context of Jenkins jobs running the
dockerised tests.

The unified script that installs Impala's required dependencies into the
container image is extended for Wolfi (or other environments that use
APK packages).

A new script is added to install Bash in the Docker image if it is
missing. Impala build scripts (including the scripts used during Docker
image builds) as well as container startup scripts require Bash,
but minimal container base images usually omit it, favoring a smaller
alternative.

To improve the debugging experience for a containerized Impala
minicluster, the minicluster starter script bin/start-impala-cluster.py
is extended with the following features:
- mounts /etc/localtime from the host into each launched container to
  ensure that the host and all containers share the same local time and
  timezone.
- sets up a directory for each container to collect the Java VMs error
  files (hs_err_pidNNNN.log) from the containers.
- adds the --mount_sources command line parameter, which mounts the
  complete $IMPALA_HOME subtree into the container at
  /opt/impala/sources to make source code available inside the container
  for easier debugging.

Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
---
M bin/impala-config.sh
M bin/jenkins/dockerized-impala-bootstrap-and-test.sh
M bin/start-impala-cluster.py
M docker/CMakeLists.txt
M docker/daemon_entrypoint.sh
M docker/docker-build.sh
M docker/impala_base/Dockerfile
M docker/impala_profile_tool/Dockerfile
A docker/install_bash_if_needed.sh
M docker/install_os_packages.sh
M docker/setup_build_context.py
11 files changed, 219 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/83/22583/1
-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 1
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 6:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/18674/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Mon, 24 Mar 2025 18:17:00 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Laszlo Gaal has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 2:

(8 comments)

http://gerrit.cloudera.org:8080/#/c/22583/1//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/22583/1//COMMIT_MSG@33
PS1, Line 33: - USE_CUSTOM_IMPALA_BASE_IMAGE (boolean):
            :   If set to 'true', triggers the use of  the custom image.
            :   When set to 'false' or left unspecified, the Docker base image is
            :   selected by the existing logic of matching the build platform's
            :   operating system.
            : - IMPALA_CUSTOM_DOCKER_BASE (string): specifies the URI of the bas
> Thanks for spotting; these were the original names of the environment varia
Done


http://gerrit.cloudera.org:8080/#/c/22583/1/bin/impala-config.sh
File bin/impala-config.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/bin/impala-config.sh@302
PS1, Line 302: # The following environment variables allow a specific base image to be specified
> Ack
Done


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh
File docker/daemon_entrypoint.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh@176
PS1, Line 176: else
             :   echo "ERROR: en_US.utf8 locale is not present."
> Ack
Done


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh@194
PS1, Line 194: exec "$@"
> Hmmm..... great catch; might be an earlier copy-paste (or maybe rebase/merg
Done


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_base/Dockerfile
File docker/impala_base/Dockerfile:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_base/Dockerfile@33
PS1, Line 33: ADD --chown=root:root --chmod=755 helper/install_os_packages.sh /root/
            : 
> Ack
Done


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_profile_tool/Dockerfile
File docker/impala_profile_tool/Dockerfile:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_profile_tool/Dockerfile@34
PS1, Line 34: ADD --chown=root:root --chmod=755 helper/install_os_packages.sh /root/
            : 
> Ack,
Done


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh
File docker/install_os_packages.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh@128
PS1, Line 128: fi
             : 
> I've decided to remove the extra check for apk: better to be conservative o
Done


http://gerrit.cloudera.org:8080/#/c/22583/2/docker/install_os_packages.sh
File docker/install_os_packages.sh:

http://gerrit.cloudera.org:8080/#/c/22583/2/docker/install_os_packages.sh@132
PS2, Line 132: echo "Only Ubuntu and Redhat-based distributions, or Chainguard/Wolfi base images are supported."
forgot to shorten this



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 2
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 07 Mar 2025 00:07:10 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Laszlo Gaal has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 6: Code-Review+1

Carry +1 from Michael


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Tue, 25 Mar 2025 16:37:48 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Hello Daniel Vanko, Csaba Ringhofer, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/22583

to look at the new patch set (#3).

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................

IMPALA-13825: Extend Docker container build to custom base images

Downstream system vendors, users and customers have lately expressed
interest in consuming Impala in containerized forms, taking advantage of
various specialized, hardened container base image offerings, like
container offerings based on the Wolfi project by Chainguard;
see: https://github.com/wolfi-dev.

This patch enables Impala container images to be built on top of custom
base images, and adds an implementation example that uses the publicly
available Wolfi base image.

Building a customized Docker image follows a hybrid approach. Instead of
replicating the complete Impala build process inside a Wolfi container
for a fully native binary build, it relies on an existing build platform
that is compatible with the binary packages available inside the custom
container image. For Wolfi the Impala binaries are supplied by the
Red Hat 9 build of Impala. This is made possible by the fact that major
library dependencies of Impala have the same versions on Wolfi OS and
Red Hat 9, so binaries built on Red Hat 9 can be run on Wolfi
with no changes.

The binaries produced by the regular build process are then installed
into a Docker image built on top of an explicitly specified custom base
image. The selection of a custom base image is controlled by two
environment variables:
- USE_CUSTOM_IMPALA_BASE_IMAGE (boolean):
  If set to 'true', triggers the use of  the custom image.
  When set to 'false' or left unspecified, the Docker base image is
  selected by the existing logic of matching the build platform's
  operating system.
- IMPALA_CUSTOM_DOCKER_BASE (string): specifies the URI of the base image

These environment variables can be overridden from the environment,
from impala-config-branch.sh, or impala-config-local.sh.
They are reported at the end of bin/impala-config.sh where important
environment variables are listed. They are also added to the list of
variables in bin/jenkins/dockerized-impala-preserve-vars.py to ensure
that they can be used in the context of Jenkins jobs as well.

The unified script that installs Impala's required dependencies into the
container image is extended for Wolfi to handle APK packages.

A new script is added to install Bash in the Docker image if it is
missing. Impala build scripts (including the scripts used during Docker
image builds) as well as container startup scripts require Bash,
but minimal container base images usually omit it, favoring a smaller
alternative.

To improve the debugging experience for a containerized Impala
minicluster, the minicluster starter script bin/start-impala-cluster.py
is extended with the following features:
- synchronizes every launched  container's timezone to the host.
  This is done primarily by injecting the TZ environment variable into
  the container with the name of the timezone used on the host. This is
  taken either from the host's TZ variable (if set), or from the host's
  /etc/localtime symlink, checking the name of the timezone file it
  points to. In case /etc/localtime is not a symlink (and TZ is not set
  on the host), the host's /etc/localtime file is mounted into the
  container.
- sets up a directory for each container to collect the Java VMs error
  files (hs_err_pidNNNN.log) from the containers.
- adds the --mount_sources command line parameter, which mounts the
  complete $IMPALA_HOME subtree into the container at
  /opt/impala/sources to make source code available inside the container
  for easier debugging.

Tested by running core-mode tests in the following environments:
- Regular run (impalad running natively on the platform) on Ubuntu 20.04
- Regular run on Rocky Linux 9.2
- Dockerised run (impalad instances running in their individual
  containers) using Ubuntu 20.04 containers
- Dockerised run (impalad instances running in their individual
  containers) using Rocky Linux 9.2 containers
- Dockerised run (impalad instances running in their individual
  containers) using Wolfi's wolfi-base containers

Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
---
M bin/impala-config.sh
M bin/jenkins/dockerized-impala-bootstrap-and-test.sh
M bin/start-impala-cluster.py
M docker/CMakeLists.txt
M docker/daemon_entrypoint.sh
M docker/docker-build.sh
M docker/impala_base/Dockerfile
M docker/impala_profile_tool/Dockerfile
A docker/install_bash_if_needed.sh
M docker/install_os_packages.sh
M docker/setup_build_context.py
M tests/common/impala_connection.py
12 files changed, 295 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/83/22583/3
-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 3
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 3:

(2 comments)

gerrit-auto-critic failed. You can reproduce it locally using command:

  python3 bin/jenkins/critique-gerrit-review.py --dryrun

To run it, you might need a virtual env with Python3's venv installed.

http://gerrit.cloudera.org:8080/#/c/22583/3/bin/impala-config.sh
File bin/impala-config.sh:

http://gerrit.cloudera.org:8080/#/c/22583/3/bin/impala-config.sh@307
PS3, Line 307: export IMPALA_CUSTOM_DOCKER_BASE=${IMPALA_CUSTOM_DOCKER_BASE:-"cgr.dev/chainguard/wolfi-base:latest"}
line too long (101 > 90)


http://gerrit.cloudera.org:8080/#/c/22583/3/bin/start-impala-cluster.py
File bin/start-impala-cluster.py:

http://gerrit.cloudera.org:8080/#/c/22583/3/bin/start-impala-cluster.py@1029
PS3, Line 1029: O
flake8: F821 undefined name 'OSException'



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 3
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Mar 2025 00:10:21 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Csaba Ringhofer (Code Review)" <ge...@cloudera.org>.
Csaba Ringhofer has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 6: Code-Review+1


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Wed, 26 Mar 2025 13:26:36 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Csaba Ringhofer (Code Review)" <ge...@cloudera.org>.
Csaba Ringhofer has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 1:

(5 comments)

http://gerrit.cloudera.org:8080/#/c/22583/1//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/22583/1//COMMIT_MSG@33
PS1, Line 33: - USE_HARDENED_IMPALA_BASE_IMAGE:
            :   If set to 'true', triggers the use of  the custom image.
            :   When set to 'false' or left unspecified, the Docker base image is
            :   selected by the existing logic of matching the build platform's
            :   operating system.
            : - IMPALA_HARDENED_DOCKER_BASE: specifies the URI of the base image
I didn't see these env vars in the patch - maybe these are from a different version?


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh
File docker/daemon_entrypoint.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh@194
PS1, Line 194: export LC_ALL=C.UTF-8
Is this intentional? It overrides the setting from previous block.


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_base/Dockerfile
File docker/impala_base/Dockerfile:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_base/Dockerfile@33
PS1, Line 33: # RUN --mount=type=bind,source=helper/install_os_packages.sh,target=/root/os_packages.sh \
            : #     /root/os_packages.sh ${INSTALL_OS_PACKAGES_ARGS}
is this left here by mistake?


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_profile_tool/Dockerfile
File docker/impala_profile_tool/Dockerfile:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_profile_tool/Dockerfile@34
PS1, Line 34: # RUN --mount=type=bind,source=helper/install_os_packages.sh,target=/root/os_packages.sh \
            : #     /root/os_packages.sh ${INSTALL_OS_PACKAGES_ARGS}
?


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh
File docker/install_os_packages.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh@128
PS1, Line 128: elif [[ -f /sbin/apk && -x /sbin/apk ]]; then
             :     echo "Indentified Wolfi-based system."
Why does this indicate Chainguard? Is it the only system with apk? The log message could indicate this.



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 1
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 06 Mar 2025 12:40:30 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Laszlo Gaal has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 6:

(3 comments)

http://gerrit.cloudera.org:8080/#/c/22583/5//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/22583/5//COMMIT_MSG@59
PS5, Line 59: 
> nit: double space
Added an explanation to the commit message.


http://gerrit.cloudera.org:8080/#/c/22583/5/docker/daemon_entrypoint.sh
File docker/daemon_entrypoint.sh:

http://gerrit.cloudera.org:8080/#/c/22583/5/docker/daemon_entrypoint.sh@88
PS5, Line 88: elif [[ $DISTRIBUTION == Chainguard ]]; then
> nit: this logic could probably be shared with Ubuntu. But not a big deal.
I'd prefer to keep it separate for now:
I think it's a bit more readable this way, and I am not sure that similarity between Ubuntu and Wolfi (which is mostly, but not completely based on Alpine) is a conscious design choice.
Keeping the variants separate feels more maintainable to me (and future breaks perhaps more easily discoverable), but I don't feel to strongly about it either.


http://gerrit.cloudera.org:8080/#/c/22583/5/docker/setup_build_context.py
File docker/setup_build_context.py:

http://gerrit.cloudera.org:8080/#/c/22583/5/docker/setup_build_context.py@182
PS5, Line 182: # Add script for installing Bash: Impala scripts need it, but some minimal base images
> This comment seems like it should differ from line 186, mention bash in par
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Mon, 24 Mar 2025 17:55:23 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Laszlo Gaal has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................

IMPALA-13825: Extend Docker container build to custom base images

Downstream system vendors, users and customers have lately expressed
interest in consuming Impala in containerized forms, taking advantage of
various specialized, hardened container base image offerings, like
container offerings based on the Wolfi project by Chainguard;
see: https://github.com/wolfi-dev.

This patch enables Impala container images to be built on top of custom
base images, and adds an implementation example that uses the publicly
available Wolfi base image.

Building a customized Docker image follows a hybrid approach. Instead of
replicating the complete Impala build process inside a Wolfi container
for a fully native binary build, it relies on an existing build platform
that is compatible with the binary packages available inside the custom
container image. For Wolfi the Impala binaries are supplied by the
Red Hat 9 build of Impala. This is made possible by the fact that major
library dependencies of Impala have the same versions on Wolfi OS and
Red Hat 9, so binaries built on Red Hat 9 can be run on Wolfi
with no changes.

The binaries produced by the regular build process are then installed
into a Docker image built on top of an explicitly specified custom base
image. The selection of a custom base image is controlled by two
environment variables:
- USE_CUSTOM_IMPALA_BASE_IMAGE (boolean):
  If set to 'true', triggers the use of  the custom image.
  When set to 'false' or left unspecified, the Docker base image is
  selected by the existing logic of matching the build platform's
  operating system.
- IMPALA_CUSTOM_DOCKER_BASE (string): specifies the URI of the base image

These environment variables can be overridden from the environment,
from impala-config-branch.sh, or impala-config-local.sh.
They are reported at the end of bin/impala-config.sh where important
environment variables are listed. They are also added to the list of
variables in bin/jenkins/dockerized-impala-preserve-vars.py to ensure
that they can be used in the context of Jenkins jobs as well.

The unified script that installs Impala's required dependencies into the
container image is extended for Wolfi to handle APK packages.

A new script is added to install Bash in the Docker image if it is
missing. Impala build scripts (including the scripts used during Docker
image builds) as well as container startup scripts require Bash,
but minimal container base images usually omit it, favoring a smaller
alternative.

To improve the debugging experience for a containerized Impala
minicluster, the minicluster starter script bin/start-impala-cluster.py
is extended with the following features:

- synchronizes every launched container's timezone to the host.
  This is needed for Iceberg time-travel test, which create timestamped
  Iceberg metadata items in the impalad context inside a container, but
  check creation/modification times of the same items in the test scripts
  running on the host, outside the containers. The tests scripts have
  the implicit expectation that the same local time is shared across
  all these contexts, but this is not necessarily true if the host,
  where tests are running is set to a timezone other than UTC.

  Time sycnhronization is achieved by injecting the TZ environment
  variable into the container, holding the name of the timezone used
  on the host. The timezone name is taken either from the host's TZ
  variable (if set), or from the host's /etc/localtime symlink,
  checking the name of the timezone file it points to.
  In case /etc/localtime is not a symlink (and TZ is not set on the
  host), the host's /etc/localtime file is mounted into the container.

- sets up a directory for each container to collect the Java VMs error
  files (hs_err_pidNNNN.log) from the containers.

- adds the --mount_sources command line parameter, which mounts the
  complete $IMPALA_HOME subtree into the container at
  /opt/impala/sources to make source code available inside the container
  for easier debugging.

Tested by running core-mode tests in the following environments:
- Regular run (impalad running natively on the platform) on Ubuntu 20.04
- Regular run on Rocky Linux 9.2
- Dockerised run (impalad instances running in their individual
  containers) using Ubuntu 20.04 containers
- Dockerised run (impalad instances running in their individual
  containers) using Rocky Linux 9.2 containers
- Dockerised run (impalad instances running in their individual
  containers) using Wolfi's wolfi-base containers

Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Reviewed-on: http://gerrit.cloudera.org:8080/22583
Reviewed-by: Laszlo Gaal <la...@cloudera.com>
Reviewed-by: Csaba Ringhofer <cs...@cloudera.com>
Reviewed-by: Jason Fehr <jf...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
M bin/impala-config.sh
M bin/jenkins/dockerized-impala-bootstrap-and-test.sh
M bin/start-impala-cluster.py
M docker/CMakeLists.txt
M docker/daemon_entrypoint.sh
M docker/docker-build.sh
M docker/impala_base/Dockerfile
M docker/impala_profile_tool/Dockerfile
A docker/install_bash_if_needed.sh
M docker/install_os_packages.sh
M docker/setup_build_context.py
M tests/common/impala_connection.py
12 files changed, 298 insertions(+), 39 deletions(-)

Approvals:
  Laszlo Gaal: Looks good to me, but someone else must approve
  Csaba Ringhofer: Looks good to me, but someone else must approve
  Jason Fehr: Looks good to me, approved
  Impala Public Jenkins: Verified

-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 7
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Jason Fehr <jf...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Daniel Vanko (Code Review)" <ge...@cloudera.org>.
Daniel Vanko has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh
File docker/daemon_entrypoint.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh@176
PS1, Line 176:   else
             :     echo "ERROR: en_US.utf8 locale is not present."
I don't think this extra indentation makes sense.



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 1
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 06 Mar 2025 14:01:59 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Jason Fehr (Code Review)" <ge...@cloudera.org>.
Jason Fehr has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 6: Code-Review+2

(1 comment)

http://gerrit.cloudera.org:8080/#/c/22583/6/bin/start-impala-cluster.py
File bin/start-impala-cluster.py:

http://gerrit.cloudera.org:8080/#/c/22583/6/bin/start-impala-cluster.py@1034
PS6, Line 1034:       env_args += ["-e", "TZ={0}".format(timezone_string)]
Is it possible to directly mount os.path.realpath("/etc/localtime") into the container as the /etc/localtime file?



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Jason Fehr <jf...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Wed, 26 Mar 2025 21:44:18 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Laszlo Gaal has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 6:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/22583/6/bin/start-impala-cluster.py
File bin/start-impala-cluster.py:

http://gerrit.cloudera.org:8080/#/c/22583/6/bin/start-impala-cluster.py@1034
PS6, Line 1034:       env_args += ["-e", "TZ={0}".format(timezone_string)]
> Is it possible to directly mount os.path.realpath("/etc/localtime") into th
I tried it, but it runs into the same sequencing problem inside the container as I experienced on the host:
- /etc/localtime is a symlink defined inside the container, pointing to /usr/share/zoneinfo/UTC, setting up a default timezone
- when the mount happens, the symlink reference is resolved first, then the resolved path is passed in to the mount() call
- the result is that the passed-in timezone file gets bind-mounted over /usr/share/zoneinfo/UTC, effectively overwriting timezone data for UTC, while /etc/localtime remains a symlink pointing to it
- this can be seen in /proc/mounts (showing just the relevant line):

/dev/nvme0n1p4 /usr/share/zoneinfo/UTC xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

In the end this causes various tests to fail with symptoms pointing to time zone desynchronization between the host and the container.

I'd be happy to explore this, but I'd prefer to do that in a follow-up patch: this works now with various base containers and with various host timezones (UTC, America/Los_Angeles and Europe/Budapest were tested).



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Jason Fehr <jf...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Thu, 27 Mar 2025 21:40:19 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 3:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/18602/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 3
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Mar 2025 00:37:33 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 2:

(2 comments)

gerrit-auto-critic failed. You can reproduce it locally using command:

  python3 bin/jenkins/critique-gerrit-review.py --dryrun

To run it, you might need a virtual env with Python3's venv installed.

http://gerrit.cloudera.org:8080/#/c/22583/2/bin/impala-config.sh
File bin/impala-config.sh:

http://gerrit.cloudera.org:8080/#/c/22583/2/bin/impala-config.sh@307
PS2, Line 307: export IMPALA_CUSTOM_DOCKER_BASE=${IMPALA_CUSTOM_DOCKER_BASE:-"cgr.dev/chainguard/wolfi-base:latest"}
line too long (101 > 90)


http://gerrit.cloudera.org:8080/#/c/22583/2/docker/install_os_packages.sh
File docker/install_os_packages.sh:

http://gerrit.cloudera.org:8080/#/c/22583/2/docker/install_os_packages.sh@132
PS2, Line 132:   echo "Only Ubuntu and Redhat-based distributions, or Chainguard/Wolfi base images are supported."
line too long (99 > 90)



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 2
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 07 Mar 2025 00:10:21 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 5:

(1 comment)

gerrit-auto-critic failed. You can reproduce it locally using command:

  python3 bin/jenkins/critique-gerrit-review.py --dryrun

To run it, you might need a virtual env with Python3's venv installed.

http://gerrit.cloudera.org:8080/#/c/22583/5/bin/impala-config.sh
File bin/impala-config.sh:

http://gerrit.cloudera.org:8080/#/c/22583/5/bin/impala-config.sh@307
PS5, Line 307: export IMPALA_CUSTOM_DOCKER_BASE=${IMPALA_CUSTOM_DOCKER_BASE:-"cgr.dev/chainguard/wolfi-base:latest"}
line too long (101 > 90)



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 5
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Mar 2025 01:03:53 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Laszlo Gaal has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 5:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/22583/3/bin/start-impala-cluster.py
File bin/start-impala-cluster.py:

http://gerrit.cloudera.org:8080/#/c/22583/3/bin/start-impala-cluster.py@1029
PS3, Line 1029: O
> flake8: F821 undefined name 'OSException'
Done


http://gerrit.cloudera.org:8080/#/c/22583/2/docker/install_os_packages.sh
File docker/install_os_packages.sh:

http://gerrit.cloudera.org:8080/#/c/22583/2/docker/install_os_packages.sh@132
PS2, Line 132: echo "Only Ubuntu, Red Hat (or related), or Wolfi base images are supported."
> forgot to shorten this
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 5
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Mar 2025 01:10:07 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 5:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/18605/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 5
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Mar 2025 01:28:45 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 5: Verified+1


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 5
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Mar 2025 17:36:41 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 5:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/11621/ DRY_RUN=true


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 5
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Mar 2025 12:04:42 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Laszlo Gaal has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 1:

(9 comments)

http://gerrit.cloudera.org:8080/#/c/22583/1//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/22583/1//COMMIT_MSG@33
PS1, Line 33: - USE_HARDENED_IMPALA_BASE_IMAGE:
            :   If set to 'true', triggers the use of  the custom image.
            :   When set to 'false' or left unspecified, the Docker base image is
            :   selected by the existing logic of matching the build platform's
            :   operating system.
            : - IMPALA_HARDENED_DOCKER_BASE: specifies the URI of the base image
> I didn't see these env vars in the patch - maybe these are from a different
Thanks for spotting; these were the original names of the environment variables, which were then renamed to more neutral terms.
I'll update the commit message.


http://gerrit.cloudera.org:8080/#/c/22583/1/bin/impala-config.sh
File bin/impala-config.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/bin/impala-config.sh@302
PS1, Line 302: # The following environment variables allow a specific base image to be specified directly,
> line too long (91 > 90)
Ack


http://gerrit.cloudera.org:8080/#/c/22583/1/bin/impala-config.sh@306
PS1, Line 306: export IMPALA_CUSTOM_DOCKER_BASE=${IMPALA_CUSTOM_DOCKER_BASE:-"cgr.dev/chainguard/wolfi-base:latest"}
> line too long (101 > 90)
Ack


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh
File docker/daemon_entrypoint.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh@176
PS1, Line 176:   else
             :     echo "ERROR: en_US.utf8 locale is not present."
> I don't think this extra indentation makes sense.
Ack


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/daemon_entrypoint.sh@194
PS1, Line 194: export LC_ALL=C.UTF-8
> Is this intentional? It overrides the setting from previous block.
Hmmm..... great catch; might be an earlier copy-paste (or maybe rebase/merge) error. I'll double-check, but you're probably right.


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_base/Dockerfile
File docker/impala_base/Dockerfile:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_base/Dockerfile@33
PS1, Line 33: # RUN --mount=type=bind,source=helper/install_os_packages.sh,target=/root/os_packages.sh \
            : #     /root/os_packages.sh ${INSTALL_OS_PACKAGES_ARGS}
> is this left here by mistake?
Ack


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_profile_tool/Dockerfile
File docker/impala_profile_tool/Dockerfile:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/impala_profile_tool/Dockerfile@34
PS1, Line 34: # RUN --mount=type=bind,source=helper/install_os_packages.sh,target=/root/os_packages.sh \
            : #     /root/os_packages.sh ${INSTALL_OS_PACKAGES_ARGS}
> ?
Ack,

the same remnant of an earlier attempt.


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_bash_if_needed.sh
File docker/install_bash_if_needed.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_bash_if_needed.sh@55
PS1, Line 55:   echo "Only ChainGuard/Wolfi, Ubuntu, or Redhat (or derivative) base images are supported."
> line too long (92 > 90)
Ack


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh
File docker/install_os_packages.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh@128
PS1, Line 128: elif [[ -f /sbin/apk && -x /sbin/apk ]]; then
             :     echo "Indentified Wolfi-based system."
> Why does this indicate Chainguard? Is it the only system with apk? The log 
It was essentially a compromise.
The other option was using two different qualifiers, one for Chainguard/Wolfi, the other for generic APK-based systems. This would have required a longer check for $DISTRIBUTION in the form of
    if [[ $DISTRIBUTION == Chainguard || $DISTRIBUTION == ApkBased ]]; then ....
which is a bit longer to read and a bit easier to mess up.
Also, I didn't want to imply that Impala supports APK-based distros in general, as these would mostly be based on Alpine, where you can easily have `musl` as the LIBC implementation instead of `glibc`, and `musl` has known problems in several areas critical to Impala.

I'll ponder this, but I'm not sure that I can come up with a good phrase for this; suggestions are welcome :)



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 1
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Thu, 06 Mar 2025 15:51:04 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Hello Csaba Ringhofer, Michael Smith, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/22583

to look at the new patch set (#6).

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................

IMPALA-13825: Extend Docker container build to custom base images

Downstream system vendors, users and customers have lately expressed
interest in consuming Impala in containerized forms, taking advantage of
various specialized, hardened container base image offerings, like
container offerings based on the Wolfi project by Chainguard;
see: https://github.com/wolfi-dev.

This patch enables Impala container images to be built on top of custom
base images, and adds an implementation example that uses the publicly
available Wolfi base image.

Building a customized Docker image follows a hybrid approach. Instead of
replicating the complete Impala build process inside a Wolfi container
for a fully native binary build, it relies on an existing build platform
that is compatible with the binary packages available inside the custom
container image. For Wolfi the Impala binaries are supplied by the
Red Hat 9 build of Impala. This is made possible by the fact that major
library dependencies of Impala have the same versions on Wolfi OS and
Red Hat 9, so binaries built on Red Hat 9 can be run on Wolfi
with no changes.

The binaries produced by the regular build process are then installed
into a Docker image built on top of an explicitly specified custom base
image. The selection of a custom base image is controlled by two
environment variables:
- USE_CUSTOM_IMPALA_BASE_IMAGE (boolean):
  If set to 'true', triggers the use of  the custom image.
  When set to 'false' or left unspecified, the Docker base image is
  selected by the existing logic of matching the build platform's
  operating system.
- IMPALA_CUSTOM_DOCKER_BASE (string): specifies the URI of the base image

These environment variables can be overridden from the environment,
from impala-config-branch.sh, or impala-config-local.sh.
They are reported at the end of bin/impala-config.sh where important
environment variables are listed. They are also added to the list of
variables in bin/jenkins/dockerized-impala-preserve-vars.py to ensure
that they can be used in the context of Jenkins jobs as well.

The unified script that installs Impala's required dependencies into the
container image is extended for Wolfi to handle APK packages.

A new script is added to install Bash in the Docker image if it is
missing. Impala build scripts (including the scripts used during Docker
image builds) as well as container startup scripts require Bash,
but minimal container base images usually omit it, favoring a smaller
alternative.

To improve the debugging experience for a containerized Impala
minicluster, the minicluster starter script bin/start-impala-cluster.py
is extended with the following features:

- synchronizes every launched container's timezone to the host.
  This is needed for Iceberg time-travel test, which create timestamped
  Iceberg metadata items in the impalad context inside a container, but
  check creation/modification times of the same items in the test scripts
  running on the host, outside the containers. The tests scripts have
  the implicit expectation that the same local time is shared across
  all these contexts, but this is not necessarily true if the host,
  where tests are running is set to a timezone other than UTC.

  Time sycnhronization is achieved by injecting the TZ environment
  variable into the container, holding the name of the timezone used
  on the host. The timezone name is taken either from the host's TZ
  variable (if set), or from the host's /etc/localtime symlink,
  checking the name of the timezone file it points to.
  In case /etc/localtime is not a symlink (and TZ is not set on the
  host), the host's /etc/localtime file is mounted into the container.

- sets up a directory for each container to collect the Java VMs error
  files (hs_err_pidNNNN.log) from the containers.

- adds the --mount_sources command line parameter, which mounts the
  complete $IMPALA_HOME subtree into the container at
  /opt/impala/sources to make source code available inside the container
  for easier debugging.

Tested by running core-mode tests in the following environments:
- Regular run (impalad running natively on the platform) on Ubuntu 20.04
- Regular run on Rocky Linux 9.2
- Dockerised run (impalad instances running in their individual
  containers) using Ubuntu 20.04 containers
- Dockerised run (impalad instances running in their individual
  containers) using Rocky Linux 9.2 containers
- Dockerised run (impalad instances running in their individual
  containers) using Wolfi's wolfi-base containers

Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
---
M bin/impala-config.sh
M bin/jenkins/dockerized-impala-bootstrap-and-test.sh
M bin/start-impala-cluster.py
M docker/CMakeLists.txt
M docker/daemon_entrypoint.sh
M docker/docker-build.sh
M docker/impala_base/Dockerfile
M docker/impala_profile_tool/Dockerfile
A docker/install_bash_if_needed.sh
M docker/install_os_packages.sh
M docker/setup_build_context.py
M tests/common/impala_connection.py
12 files changed, 298 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/83/22583/6
-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 6:

(1 comment)

gerrit-auto-critic failed. You can reproduce it locally using command:

  python3 bin/jenkins/critique-gerrit-review.py --dryrun

To run it, you might need a virtual env with Python3's venv installed.

http://gerrit.cloudera.org:8080/#/c/22583/6/bin/impala-config.sh
File bin/impala-config.sh:

http://gerrit.cloudera.org:8080/#/c/22583/6/bin/impala-config.sh@307
PS6, Line 307: export IMPALA_CUSTOM_DOCKER_BASE=${IMPALA_CUSTOM_DOCKER_BASE:-"cgr.dev/chainguard/wolfi-base:latest"}
line too long (101 > 90)



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Mon, 24 Mar 2025 17:49:10 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Hello Daniel Vanko, Csaba Ringhofer, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/22583

to look at the new patch set (#2).

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................

IMPALA-13825: Extend Docker container build to custom base images

Downstream system vendors, users and customers have lately expressed
interest in consuming Impala in containerized forms, taking advantage of
various specialized, hardened container base image offerings, like
container offerings based on the Wolfi project by Chainguard;
see: https://github.com/wolfi-dev.

This patch enables Impala container images to be built on top of custom
base images, and adds an implementation example that uses the publicly
available Wolfi base image.

Building a customized Docker image follows a hybrid approach. Instead of
replicating the complete Impala build process inside a Wolfi container
for a fully native binary build, it relies on an existing build platform
that is compatible with the binary packages available inside the custom
container image. For Wolfi the Impala binaries are supplied by the
Red Hat 9 build of Impala. This is made possible by the fact that major
library dependencies of Impala have the same versions on Wolfi OS and
Red Hat 9, so binaries built on Red Hat 9 can be run on Wolfi
with no changes.

The binaries produced by the regular build process are then installed
into a Docker image built on top of an explicitly specified custom base
image. The selection of a custom base image is controlled by two
environment variables:
- USE_CUSTOM_IMPALA_BASE_IMAGE (boolean):
  If set to 'true', triggers the use of  the custom image.
  When set to 'false' or left unspecified, the Docker base image is
  selected by the existing logic of matching the build platform's
  operating system.
- IMPALA_CUSTOM_DOCKER_BASE (string): specifies the URI of the base image

These environment variables can be overridden from the environment,
from impala-config-branch.sh, or impala-config-local.sh.
They are reported at the end of bin/impala-config.sh where important
environment variables are listed. They are also added to the list of
variables in bin/jenkins/dockerized-impala-preserve-vars.py to ensure
that they can be used in the context of Jenkins jobs as well.

The unified script that installs Impala's required dependencies into the
container image is extended for Wolfi to handle APK packages.

A new script is added to install Bash in the Docker image if it is
missing. Impala build scripts (including the scripts used during Docker
image builds) as well as container startup scripts require Bash,
but minimal container base images usually omit it, favoring a smaller
alternative.

To improve the debugging experience for a containerized Impala
minicluster, the minicluster starter script bin/start-impala-cluster.py
is extended with the following features:
- mounts /etc/localtime from the host into each launched container to
  ensure that the host and all containers share the same local time and
  timezone.
- sets up a directory for each container to collect the Java VMs error
  files (hs_err_pidNNNN.log) from the containers.
- adds the --mount_sources command line parameter, which mounts the
  complete $IMPALA_HOME subtree into the container at
  /opt/impala/sources to make source code available inside the container
  for easier debugging.

Tested by running core-mode tests in the following environments:
- Regular run (impalad running natively on the platform) on Ubuntu 20.04
- Regular run on Rocky Linux 9.2
- Dockerised run (impalad instances running in their individual
  containers) using Ubuntu 20.04 containers
- Dockerised run (impalad instances running in their individual
  containers) using Rocky Linux 9.2 containers
- Dockerised run (impalad instances running in their individual
  containers) using Wolfi's wolfi-base containers

Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
---
M bin/impala-config.sh
M bin/jenkins/dockerized-impala-bootstrap-and-test.sh
M bin/start-impala-cluster.py
M docker/CMakeLists.txt
M docker/daemon_entrypoint.sh
M docker/docker-build.sh
M docker/impala_base/Dockerfile
M docker/impala_profile_tool/Dockerfile
A docker/install_bash_if_needed.sh
M docker/install_os_packages.sh
M docker/setup_build_context.py
11 files changed, 240 insertions(+), 35 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/83/22583/2
-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 2
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 2:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/18501/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 2
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Fri, 07 Mar 2025 00:31:23 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 1:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/18481/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 1
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Wed, 05 Mar 2025 23:14:16 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Michael Smith (Code Review)" <ge...@cloudera.org>.
Michael Smith has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 5: Code-Review+1

(3 comments)

http://gerrit.cloudera.org:8080/#/c/22583/5//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/22583/5//COMMIT_MSG@59
PS5, Line 59: - synchronizes every launched  container's timezone to the host.
nit: double space

Also why is this important?


http://gerrit.cloudera.org:8080/#/c/22583/5/docker/daemon_entrypoint.sh
File docker/daemon_entrypoint.sh:

http://gerrit.cloudera.org:8080/#/c/22583/5/docker/daemon_entrypoint.sh@88
PS5, Line 88: elif [[ $DISTRIBUTION == Chainguard ]]; then
nit: this logic could probably be shared with Ubuntu. But not a big deal.


http://gerrit.cloudera.org:8080/#/c/22583/5/docker/setup_build_context.py
File docker/setup_build_context.py:

http://gerrit.cloudera.org:8080/#/c/22583/5/docker/setup_build_context.py@182
PS5, Line 182: # Add script for installing OS packages
This comment seems like it should differ from line 186, mention bash in particular.



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 5
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Sat, 22 Mar 2025 04:41:58 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Hello Daniel Vanko, Csaba Ringhofer, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/22583

to look at the new patch set (#5).

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................

IMPALA-13825: Extend Docker container build to custom base images

Downstream system vendors, users and customers have lately expressed
interest in consuming Impala in containerized forms, taking advantage of
various specialized, hardened container base image offerings, like
container offerings based on the Wolfi project by Chainguard;
see: https://github.com/wolfi-dev.

This patch enables Impala container images to be built on top of custom
base images, and adds an implementation example that uses the publicly
available Wolfi base image.

Building a customized Docker image follows a hybrid approach. Instead of
replicating the complete Impala build process inside a Wolfi container
for a fully native binary build, it relies on an existing build platform
that is compatible with the binary packages available inside the custom
container image. For Wolfi the Impala binaries are supplied by the
Red Hat 9 build of Impala. This is made possible by the fact that major
library dependencies of Impala have the same versions on Wolfi OS and
Red Hat 9, so binaries built on Red Hat 9 can be run on Wolfi
with no changes.

The binaries produced by the regular build process are then installed
into a Docker image built on top of an explicitly specified custom base
image. The selection of a custom base image is controlled by two
environment variables:
- USE_CUSTOM_IMPALA_BASE_IMAGE (boolean):
  If set to 'true', triggers the use of  the custom image.
  When set to 'false' or left unspecified, the Docker base image is
  selected by the existing logic of matching the build platform's
  operating system.
- IMPALA_CUSTOM_DOCKER_BASE (string): specifies the URI of the base image

These environment variables can be overridden from the environment,
from impala-config-branch.sh, or impala-config-local.sh.
They are reported at the end of bin/impala-config.sh where important
environment variables are listed. They are also added to the list of
variables in bin/jenkins/dockerized-impala-preserve-vars.py to ensure
that they can be used in the context of Jenkins jobs as well.

The unified script that installs Impala's required dependencies into the
container image is extended for Wolfi to handle APK packages.

A new script is added to install Bash in the Docker image if it is
missing. Impala build scripts (including the scripts used during Docker
image builds) as well as container startup scripts require Bash,
but minimal container base images usually omit it, favoring a smaller
alternative.

To improve the debugging experience for a containerized Impala
minicluster, the minicluster starter script bin/start-impala-cluster.py
is extended with the following features:
- synchronizes every launched  container's timezone to the host.
  This is done primarily by injecting the TZ environment variable into
  the container with the name of the timezone used on the host. This is
  taken either from the host's TZ variable (if set), or from the host's
  /etc/localtime symlink, checking the name of the timezone file it
  points to. In case /etc/localtime is not a symlink (and TZ is not set
  on the host), the host's /etc/localtime file is mounted into the
  container.
- sets up a directory for each container to collect the Java VMs error
  files (hs_err_pidNNNN.log) from the containers.
- adds the --mount_sources command line parameter, which mounts the
  complete $IMPALA_HOME subtree into the container at
  /opt/impala/sources to make source code available inside the container
  for easier debugging.

Tested by running core-mode tests in the following environments:
- Regular run (impalad running natively on the platform) on Ubuntu 20.04
- Regular run on Rocky Linux 9.2
- Dockerised run (impalad instances running in their individual
  containers) using Ubuntu 20.04 containers
- Dockerised run (impalad instances running in their individual
  containers) using Rocky Linux 9.2 containers
- Dockerised run (impalad instances running in their individual
  containers) using Wolfi's wolfi-base containers

Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
---
M bin/impala-config.sh
M bin/jenkins/dockerized-impala-bootstrap-and-test.sh
M bin/start-impala-cluster.py
M docker/CMakeLists.txt
M docker/daemon_entrypoint.sh
M docker/docker-build.sh
M docker/impala_base/Dockerfile
M docker/impala_profile_tool/Dockerfile
A docker/install_bash_if_needed.sh
M docker/install_os_packages.sh
M docker/setup_build_context.py
M tests/common/impala_connection.py
12 files changed, 297 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/83/22583/5
-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 5
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 6: Verified+1


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Jason Fehr <jf...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Fri, 28 Mar 2025 02:34:02 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 6:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/11658/ DRY_RUN=false


-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 6
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Jason Fehr <jf...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Thu, 27 Mar 2025 21:07:03 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Laszlo Gaal (Code Review)" <ge...@cloudera.org>.
Laszlo Gaal has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 1:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh
File docker/install_os_packages.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh@128
PS1, Line 128: elif [[ -f /sbin/apk && -x /sbin/apk ]]; then
             :     echo "Indentified Wolfi-based system."
> It was essentially a compromise.
I've decided to remove the extra check for apk: better to be conservative on which images are accepted as base images.


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh@135
PS1, Line 135:   echo "Only Ubuntu and Redhat-based distributions, or Chainguard/Wolfi base images are supported."
> line too long (99 > 90)
Ack



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 1
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Daniel Vanko <dv...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Laszlo Gaal <la...@cloudera.com>
Gerrit-Comment-Date: Thu, 06 Mar 2025 20:35:36 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-13825: Extend Docker container build to custom base images

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22583 )

Change subject: IMPALA-13825: Extend Docker container build to custom base images
......................................................................


Patch Set 1:

(4 comments)

gerrit-auto-critic failed. You can reproduce it locally using command:

  python3 bin/jenkins/critique-gerrit-review.py --dryrun

To run it, you might need a virtual env with Python3's venv installed.

http://gerrit.cloudera.org:8080/#/c/22583/1/bin/impala-config.sh
File bin/impala-config.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/bin/impala-config.sh@302
PS1, Line 302: # The following environment variables allow a specific base image to be specified directly,
line too long (91 > 90)


http://gerrit.cloudera.org:8080/#/c/22583/1/bin/impala-config.sh@306
PS1, Line 306: export IMPALA_CUSTOM_DOCKER_BASE=${IMPALA_CUSTOM_DOCKER_BASE:-"cgr.dev/chainguard/wolfi-base:latest"}
line too long (101 > 90)


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_bash_if_needed.sh
File docker/install_bash_if_needed.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_bash_if_needed.sh@55
PS1, Line 55:   echo "Only ChainGuard/Wolfi, Ubuntu, or Redhat (or derivative) base images are supported."
line too long (92 > 90)


http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh
File docker/install_os_packages.sh:

http://gerrit.cloudera.org:8080/#/c/22583/1/docker/install_os_packages.sh@135
PS1, Line 135:   echo "Only Ubuntu and Redhat-based distributions, or Chainguard/Wolfi base images are supported."
line too long (99 > 90)



-- 
To view, visit http://gerrit.cloudera.org:8080/22583
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5e39f399664fe66f3774caa316ed5d4df24befc
Gerrit-Change-Number: 22583
Gerrit-PatchSet: 1
Gerrit-Owner: Laszlo Gaal <la...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Wed, 05 Mar 2025 22:48:53 +0000
Gerrit-HasComments: Yes