Commit Graph

9 Commits

Author SHA1 Message Date
MarcoFalke
fae612424b contrib: Remove confusing and redundant encoding from IO
The encoding arg is confusing, because it is not applied consistently
for all IO.

Also, it is useless, as the majority of files are ASCII encoded, which
are fine to encode and decode with any mode.

Moreover, UTF-8 is already required for most scripts to work properly,
so setting the encoding twice is redundant.

So remove the encoding from most IO. It would be fine to remove from all
IO, however I kept it for two files:

* contrib/asmap/asmap-tool.py: This specifically looks for utf-8
  encoding errors, so it makes sense to sepecify the utf-8 encoding
  explicitly.
* test/functional/test_framework/test_node.py: Reading the debug log in
  text mode specifically counts the utf-8 characters (not bytes), so it
  makes sense to specify the utf-8 encoding explicitly.
2025-11-26 11:31:16 +01:00
MarcoFalke
5555bce994 ci: Document why IN_GETOPT_BIN env var is needed on macOS
This was added in commit b705bade44, but I
keep forgetting the background that this is needed for the retry Bash
script. So document it.
2025-10-24 13:11:25 +02:00
MarcoFalke
fabe516440 ci: Export the container id in python script
This refactor does not change behavior, but it has a few benefits:

* The shellcheck SC2086 warning is disabled for the whole command, but
  is only needed for the CI_CONTAINER_CAP env var. So in Python, only
  pass this one env var to shlex.split() for proper word splitting.
* Future logic improvements can be implemented in Python.

The comments are moved, which can be checked via the git options:
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2025-10-24 13:11:17 +02:00
MarcoFalke
fa6aa9f42f ci: Retry image building once on failure
The build scripts inside the image retry after a failure. However, there
may be some rare network failures inside the container engine. For
example, when pulling the underlying base image, or when pulling the
docker cache.

Thus, retry after a failure once, which should hopefully fix
https://github.com/bitcoin/bitcoin/issues/33640.
2025-10-22 14:12:25 +02:00
MarcoFalke
fa4dbe04d7 ci: Allow overwriting check option in run() helper
The bool is forced to check=True, but some commands may want to
explicitly use kwargs to disable it.

This refactor is needed for the next commit.
2025-10-22 14:12:20 +02:00
MarcoFalke
fa8e4de5c3 ci: Use os.environ[key] access when value must be set
The other code in this file is using this pattern to throw when a key is
unset, instead of silently returning a None when using os.getenv(key)
with no default value specified.

So use the pattern here as well. As the env vars are always set, this
should be a refactor that does not change the behavior.
2025-10-22 14:12:18 +02:00
MarcoFalke
fab64a5d6f ci: Move buildx command to python script
This has a few benefits:

* The shellcheck SC2086 warning is disabled for the whole command, but
  is only needed for the DOCKER_BUILD_CACHE_ARG env var.  So in Python,
  only pass this one env var to shlex.split() for proper word splitting.
* Future logic improvements can be implemented in Python.

The comments are moved, which can be checked via the git options:
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2025-10-21 15:42:50 +02:00
MarcoFalke
fa1d2f6380 ci: Pass CI_FAILFAST_TEST_LEAVE_DANGLING into container 2025-08-05 18:59:43 +02:00
MarcoFalke
3333d3f75f ci: Only pass documented env vars 2025-07-30 15:38:03 +02:00