ci: Skip read-write of default env vars #31678

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2501-ci-skip changing 1 files +1 −3
  1. maflcko commented at 12:13 pm on January 17, 2025: member

    If they remain unset, they use the default anyway. Except for USER, but this seems unused anyway.

    Can be checked via:

    0sh-5.2# touch /tmp/empty_env
    1sh-5.2# podman run --rm --env-file /tmp/empty_env 'ubuntu:24.04' env
    2PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    3container=podman
    4HOME=/root
    5HOSTNAME=19ece5c9e052
    
  2. DrahtBot commented at 12:13 pm on January 17, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31678.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK Prabhat1308, 0xB10C

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    No conflicts as of last run.

  3. DrahtBot added the label Tests on Jan 17, 2025
  4. 0xB10C commented at 12:37 pm on January 17, 2025: contributor

    Concept ACK

    I want to check if this helps #30852 (comment) when used with #31545 by not having to keep the base images around anymore.

  5. in ci/test/02_run_container.sh:15 in fa8401f2cb outdated
    11+set -o errexit -o pipefail -o xtrace
    12 
    13 if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
    14   # Export all env vars to avoid missing some.
    15   # Though, exclude those with newlines to avoid parsing problems.
    16   python3 -c 'import os; [print(f"{key}={value}") for key, value in os.environ.items() if "\n" not in value and "HOME" != key and "PATH" != key and "USER" != key]' | tee "/tmp/env-$USER-$CONTAINER_NAME"
    


    maflcko commented at 2:20 pm on January 17, 2025:

    For reference, the exclusion is still needed to avoid the error from #27739 (comment). Diff to reproduce the error:

     0diff --git a/ci/test/02_run_container.sh b/ci/test/02_run_container.sh
     1index 4181e68..168ab51 100755
     2--- a/ci/test/02_run_container.sh
     3+++ b/ci/test/02_run_container.sh
     4@@ -12,7 +12,7 @@ set -o errexit -o pipefail -o xtrace
     5 if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
     6   # Export all env vars to avoid missing some.
     7   # Though, exclude those with newlines to avoid parsing problems.
     8-  python3 -c 'import os; [print(f"{key}={value}") for key, value in os.environ.items() if "\n" not in value and "HOME" != key and "PATH" != key and "USER" != key]' | tee "/tmp/env-$USER-$CONTAINER_NAME"
     9+  python3 -c 'import os; [print(f"{key}={value}") for key, value in os.environ.items() if "\n" not in value]' | tee "/tmp/env-$USER-$CONTAINER_NAME"
    10 
    11   # Env vars during the build can not be changed. For example, a modified
    12   # $MAKEJOBS is ignored in the build process. Use --cpuset-cpus as an
    

    CMD: env -i HOME="$HOME" PATH="$PATH" USER="$USER" MAKEJOBS="-j$( nproc )" FILE_ENV="./ci/test/00_setup_env_native_tidy.sh" ./ci/test_run_all.sh

  6. ci: Skip read-write of default env vars
    Also, set pipefail while touching the script.
    fa952acdb6
  7. DrahtBot added the label Needs rebase on Jan 20, 2025
  8. maflcko force-pushed on Jan 20, 2025
  9. DrahtBot removed the label Needs rebase on Jan 20, 2025
  10. Prabhat1308 commented at 10:31 am on January 28, 2025: none
    utACK fa952ac
  11. DrahtBot requested review from 0xB10C on Jan 28, 2025
  12. maflcko commented at 9:30 am on February 11, 2025: member

    I want to check if this helps #30852 (comment) when used with #31545 by not having to keep the base images around anymore. @0xB10C Are you waiting for me to rebase this once more? I’ve held back, because there is already one review, but I am happy to rebase.

  13. 0xB10C commented at 1:40 pm on February 11, 2025: contributor

    I want to check if this helps #30852 (comment) when used with #31545 by not having to keep the base images around anymore.

    @0xB10C Are you waiting for me to rebase this once more? I’ve held back, because there is already one review, but I am happy to rebase.

    Thanks for the reminder. I played around with this a bit and it does indeed help:

    When using #31545, the base image (e.g. docker:22.04) is stored as part of the docker build-cache. Previously, I needed to keep it around as docker:22.04 image explictily, as docker run doesn’t use the docker build-cache. Without docker run, there is no need to keep the image outside of the build cache.

  14. 0xB10C commented at 1:43 pm on February 11, 2025: contributor
    My understanding is that #28138 was only needed for DANGER_RUN_CI_ON_HOST. That’s why removing it here isn’t a regression to pre 28138, correct?
  15. maflcko commented at 1:52 pm on February 11, 2025: member

    My understanding is that #28138 was only needed for DANGER_RUN_CI_ON_HOST. That’s why removing it here isn’t a regression to pre 28138, correct?

    I do not know if they were ever needed to be set inside the CI pod, given that they fall back to the default anyway (see pull description). This may have just been added out of caution, as on the outside the pod, they are required sometimes to be set, see the docs:

    https://github.com/bitcoin/bitcoin/blame/86528937e5c4da2e12c46085fc41e87ed759258e/ci/README.md#L46

  16. 0xB10C commented at 1:58 pm on February 11, 2025: contributor

    Makes sense, thanks.

    ACK fa952acdb6ef1b07b7927202d1373fa7479fd5e4

  17. fanquake merged this on Feb 12, 2025
  18. fanquake closed this on Feb 12, 2025

  19. maflcko deleted the branch on Feb 12, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-02-22 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me