Merge bitcoin/bitcoin#34427: lint: Flatten lint image entry points

faba426b3b lint: Flatten lint image entry points (MarcoFalke)
1111fff91c lint: Add missing --platform=linux to docker build command (MarcoFalke)

Pull request description:

  Two fixups to the lint container:

  * Add a missing `--platform=linux` to avoid running a non-native arch, like s390x, which happens with podman if such a container was most recently used.
  * Flatten the entry points to remove the bash-based one:

  Previously, an additional entry point into the container that spawned a bash was supported. The bash had an alias `lint` to run all lint scripts. However, such a use-case seems limited (because it only runs inside the container), inflexible (because it only allows running all lint scripts), and possibly brittle (because it can miss re-building the image when the cache is stale). So remove it and just offer the single entry point via the `./ci/lint.py` script.

  If there is a use-case to skip the image building, it should be trivial to add an env var setting the the lint Python script like `DANGER_SKIP_IMAGE_RE_BUILD=1` (or so) in the future.

ACKs for top commit:
  willcl-ark:
    ACK faba426b3b

Tree-SHA512: 9afda16723c215602c6c42fa3a286d1828c887c8f6ff9512c8ec162ec8997789695f0c464d389cae94e67acf8b5e0f1a55e2ee0d60131a2eee091cf281f91514
This commit is contained in:
merge-script
2026-02-12 09:43:29 +00:00
5 changed files with 9 additions and 23 deletions

View File

@@ -44,6 +44,7 @@ def main():
"docker",
"buildx",
"build",
"--platform=linux",
f"--tag={container}",
*shlex.split(os.environ.get("DOCKER_BUILD_CACHE_ARG", "")),
f"--file={repo_root}/ci/lint_imagefile",
@@ -72,6 +73,7 @@ def main():
*get_worktree_mounts(repo_root),
*([] if is_ci else ["-it"]),
container,
"./ci/lint/06_script.sh",
*sys.argv[1:],
]
)

View File

@@ -8,6 +8,7 @@ export LC_ALL=C
set -o errexit -o pipefail -o xtrace
export DEBIAN_FRONTEND=noninteractive
export CI_RETRY_EXE="/ci_retry"
pushd "/"

View File

@@ -8,6 +8,12 @@ export LC_ALL=C
set -o errexit -o pipefail -o xtrace
# Fixes permission issues when there is a container UID/GID mismatch with the owner
# of the mounted bitcoin src dir.
git config --global --add safe.directory /bitcoin
export PATH="/python_build/bin:${PATH}"
if [ -n "${LINT_CI_IS_PR}" ]; then
export COMMIT_RANGE="HEAD~..HEAD"
if [ "$(git rev-list -1 HEAD)" != "$(git rev-list -1 --merges HEAD)" ]; then

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
#
# Copyright (c) The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
export LC_ALL=C
# Fixes permission issues when there is a container UID/GID mismatch with the owner
# of the mounted bitcoin src dir.
git config --global --add safe.directory /bitcoin
export PATH="/python_build/bin:${PATH}"
./ci/lint/06_script.sh "$@"

View File

@@ -6,19 +6,11 @@
FROM mirror.gcr.io/ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
COPY ./ci/retry/retry /ci_retry
COPY ./.python-version /.python-version
COPY ./ci/lint/container-entrypoint.sh /entrypoint.sh
COPY ./ci/lint/01_install.sh /install.sh
RUN /install.sh && \
echo 'alias lint="./ci/lint/06_script.sh"' >> ~/.bashrc && \
chmod 755 /entrypoint.sh && \
rm -rf /var/lib/apt/lists/*
WORKDIR /bitcoin
ENTRYPOINT ["/entrypoint.sh"]