Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35754. ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
| uv pip install --python /python_env --requirements /ci/lint/requirements.txt | ||
|
|
||
| case "$(uname --machine)" in | ||
| x86_64) SHELLCHECK_SHA256="8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198" MLC_SHA256="7a72a93d5b3ee8a554cb840abdfe90aefb709418f225461b52021e3a058238a2" ;; |
There was a problem hiding this comment.
The pip deps aren't pinned, so I wonder why those two should be pinned?
There was a problem hiding this comment.
I'm not familiar with how to pin the pip requirements but I'll investigate.
There was a problem hiding this comment.
I can provide a patch to pin the dependencies using uv.lock, which would be the recommended approach to take when using uv.
There was a problem hiding this comment.
This commit shows how to use uv.lock to lock pip deps, feel free to cherry-pick here, or I can open seperately:
by using a pyproject "group", we can also make this ~ natively compatible with pip >= 25.1, as this knows how to install "groups" of dependencies outside of having a main application to install, as we are configured.
| ${CI_RETRY_EXE} apt-get update | ||
| ${CI_RETRY_EXE} apt-get install curl -y | ||
| curl "https://apt.llvm.org/llvm-snapshot.gpg.key" | tee "/etc/apt/trusted.gpg.d/apt.llvm.org.asc" | ||
| sha256sum -c <<<"8b2a587ffd672c4687e7581dad4b2f6c1bb2ad6b480cd9771ba2ff48e0b8c75d /etc/apt/trusted.gpg.d/apt.llvm.org.asc" |
There was a problem hiding this comment.
Is this meant to be const? The CI will break the next time a signature is added or the expiry is extended?
There was a problem hiding this comment.
You suggest dropping it? How often do these change? Shouldn't we know about it?
There was a problem hiding this comment.
Well, what is the goal here? If someone controlled this key, they could push arbitrarily different llvm code to the ppa, even when the key is pinned to a hash.
There was a problem hiding this comment.
We also don't know how that key is managed, so if llvm.org is compromised, we don't know if the key is still safe. And if we trust the domain, we should just trust whatever key it gives us.
There was a problem hiding this comment.
My goal was to know when any of these change so that we at least have the possibility to review and approve them. With LLMs we can even do a quick check to see if we agree and update the hash if we do (sure, that's also not 100% safe, but a lot safer than what we have now).
What I don't like is when these things just suddenly change between runs like #35202
And if we trust the domain, we should just trust whatever key it gives us
Maybe, but I still think it should be a deliberate choice where we have the option to intervene. We should decide when the CI state should change, not outsiders.
There was a problem hiding this comment.
What I don't like is when these things just suddenly change between runs like #35202
The CI generally assumes that any container engine should work. Sure, it is annoying when a failure comes when the underlying engine changes, but I don't think this can be avoided: It is up to the host system (e.g. GHA) to provide the container engine and I don't think we can or want to pin it.
If we really wanted to pin the dependencies in the CI, we'd probably have to use nix and compile clang from LLVM ourselves?
There was a problem hiding this comment.
we'd probably have to use nix and compile clang from LLVM ourselves?
I accepted your reasoning here and removed the unpinnable dependency.
But the rest provide explicit pinning capability, so I think we should harden them. As you can see it's quite cheap and can avoid some surprises.
|
@l0rinc can you elaborate in the PR description what you're actually checking and trusting? I'm skeptical this is going to very useful if we simply set these hashes based on the current value and blindly update them every time CI breaks due to a mismatch. In the case of #35754 (comment) the trust assumption seems to be circular. But there might be a subset of checks that are useful. |
| if [ ! -f "$OSX_SDK_PATH" ]; then | ||
| ${CI_RETRY_EXE} curl --location --fail "${SDK_URL}/${OSX_SDK_FILENAME}" -o "$OSX_SDK_PATH" | ||
| fi | ||
| sha256sum -c <<<"9600fa93644df674ee916b5e2c8a6ba8dacf631996a65dc922d003b98b5ea3b1 ${OSX_SDK_PATH}" |
There was a problem hiding this comment.
4955328: this matches contrib/macdeploy/README.md so it makes sense to check and should be easy to keep in sync.
| if [ ! -f "$FREEBSD_SDK_PATH" ]; then | ||
| ${CI_RETRY_EXE} curl --location --fail "https://download.freebsd.org/releases/amd64/${FREEBSD_VERSION}-RELEASE/base.txz" -o "$FREEBSD_SDK_PATH" | ||
| fi | ||
| sha256sum -c <<<"3768988b151c20f965679062b065c63a977d6bbb9f47fd83695ec2c40790c18f ${FREEBSD_SDK_PATH}" |
There was a problem hiding this comment.
4955328: I would either:
- download the signed hashes file, pgp verify against a hardcoded key, and then check the file hash; or
- at least put this
FREEBSD_SDK_HASHinstead of in the middle of the CI file
8e8572e to
5f82a13
Compare
Updated the description to distinguish the pinned inputs from the package repositories, LLVM PPA, and hosted runner images that CI still trusts.
Dropped the LLVM signing-key hash.
Moved each SDK digest beside its version, extended verification to NetBSD and OpenBSD, and moved the OpenBSD symlink creation after both archives are extracted, when all link targets are present.
Cherry-picked Will's Will's commit compared with the local versiongit range-diff 9b86a2969118693a5511042ef524f424c7c0a0ee^! 8ba28acb872a8c7e880924a03006ac69067e74a5^!Also added hash-checked requirements for |
5f82a13 to
49cc4e8
Compare
|
|
||
| export CONTAINER_NAME=ci_freebsd_cross | ||
| export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" | ||
| export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04@sha256:3131b4cc82a783df6c9df078f86e01819a13594b865c2cad47bd1bca2b7063bb" |
There was a problem hiding this comment.
I don't see the point here. Sure, the container image is pinned, but this is Ubuntu, so the apt install will just pick the latest version anyway, in which case this pin here is just a verbose no-op.
There was a problem hiding this comment.
I remember having a surprise at another company when we found out Docker image tags weren't deterministic.
The point of this PR is to minimize surprises - sure, we can follow up with pinning apt install if you want, but first let's make sure the OS is what we think it is.
There was a problem hiding this comment.
Yes, it may be surprising if unknown, but I don't think this change is reducing the surprise. In fact, it may be increasing it, because the line seems to imply this is somehow pinned to a deterministic hash, but the outcome will still be non-deterministic.
Also, I don't think it is possible to pin apt install, or at least, if we'd try, it would be easier to just use nix.
Finally, apart from being a verbose no-op, and possibly increasing surprises, this is also tedious to maintain.
I suspect this will attract a flood of dependabot-style PRs to bump the hash to "fix CVEs", so before this is done, we should have a crew of reviewers to sign up to review those. (I won't be signing up)
| id: warp | ||
| if: ${{ inputs.provider == 'warp' }} | ||
| uses: WarpBuilds/cache/restore@v1 | ||
| uses: WarpBuilds/cache/restore@6ab98e7fdd65255995acec1de229a0bf2a40fe37 # v1 |
There was a problem hiding this comment.
Same here: Adding hashes seems mostly like a corporate check-list item. Since, the hash doesn't cover transitive actions, nor does it cover the warpbuild infra. If the cache provider was compromised, they could still ship wrong stuff via transitive actions or by corrupting the cache or the cache logic in their infra, even with a pinned hash here.
No objection, just leaving a comment.
There was a problem hiding this comment.
The concern is that the input can change without our knowledge, even if the replacement is correct.
|
It is good to have a large pull to cover all topics here and explain what is changed and what is not changed. It seems there are some good changes, like checking the hash after a raw However, for other stuff, it is unclear what the goal is, or rather the stated goal is not achieved and will also lead to other problems. (#35754 (comment)). |
Agree with maflcko here. Beyond that, I also like using Re this excerpt in your description:
What is this meant to imply? That we have reviewed the cloned tools in complete up to that point? |
Just that we minimize the changes that can happen without our explicit knowledge/approval. |
|
|
||
| if [[ ${BARE_METAL_RISCV} == "true" ]]; then | ||
| ${CI_RETRY_EXE} git clone --depth=1 https://github.com/riscv-collab/riscv-gnu-toolchain -b 2026.06.06 /riscv/gcc | ||
| ${CI_RETRY_EXE} git clone --depth=1 --revision=81bb1f89664aad156df3d2773195177c92dedc3a https://github.com/riscv-collab/riscv-gnu-toolchain /riscv/gcc # 2026.06.06 |
There was a problem hiding this comment.
Same here. Pinning doesn't achieve anything, because the real pulls will be unpinned (possibly from the master branch):
/riscv/gcc# cat .gitmodules
[submodule "binutils"]
path = binutils
url = https://sourceware.org/git/binutils-gdb.git
branch = binutils-2_46-branch
shallow = true
[submodule "gcc"]
path = gcc
url = https://github.com/gcc-mirror/gcc.git
branch = releases/gcc-16
shallow = true
[submodule "glibc"]
path = glibc
url = https://sourceware.org/git/glibc.git
shallow = true
[submodule "dejagnu"]
path = dejagnu
url = https://git.savannah.gnu.org/git/dejagnu.git
branch = master
shallow = false
[submodule "newlib"]
path = newlib
url = https://sourceware.org/git/newlib-cygwin.git
branch = master
shallow = true
[submodule "gdb"]
path = gdb
url = https://sourceware.org/git/binutils-gdb.git
branch = gdb-16-branch
shallow = true
[submodule "qemu"]
path = qemu
url = https://gitlab.com/qemu-project/qemu.git
shallow = true
[submodule "musl"]
path = musl
url = https://git.musl-libc.org/git/musl
branch = master
shallow = true
[submodule "spike"]
path = spike
url = https://github.com/riscv-software-src/riscv-isa-sim.git
branch = master
shallow = true
[submodule "pk"]
path = pk
url = https://github.com/riscv-software-src/riscv-pk.git
branch = master
shallow = true
[submodule "llvm"]
path = llvm
url = https://github.com/llvm/llvm-project.git
branch = release/20.x
shallow = true
[submodule "uclibc-ng"]
path = uclibc-ng
url = https://github.com/wbx-github/uclibc-ng.git
shallow = true
There was a problem hiding this comment.
Same as with other cases, it doesn't cover all possible scenarios - but once they start hardening their supply chain, we just have to update the pin here.
Do you suggest completely removing this pin here, or opening an issue so they also pin?
|
Tend towards NACK, because:
Maybe the manual steps can be automated by an LLM (and then devs and reviewers just trust the LLM to do the update and the verification of the mapping), but this seems just extra steps for no benefit, when most places are inherently impossible to pin. If we want to make the CI more deterministic, we'd have to replace apt with guix/nix (or so) from the ground up. I left an idea in bitcoin-core/libmultiprocess#318 (comment), but I don't know how easy that would be. |
|
I don't understand the pushback here - why would we leave all of these external dependencies completely unchecked? |
It is for the SDKs, because the version is exactly pinned and any version update can go hand-in-hand with a hash update. So commit 3751aa3 is perfectly fine, as explained in #35754 (comment). It will check for e.g. bit-flips on the host server. However, other tools such as Moreover, pinning the container images, when neither the container engine, nor the package manager inside the image is pinned, seems confusing at best? Also, attracting a weekly dependabot-style bump of the ci container images doesn't seem useful either. |
|
Leaving my two cents here too: I have also wondered about out CI in this way of this PR before (mainly from wondering if we should not have a nightly docker image build (external to this repo) which our runs in here pull and use). I sort of came to the conclusion that we "like" these images being somewhat floating/freely-updating, as it helps us catch "nightly" breakages seen in common os tools/compiler versions/other assorted packages, whilst we still pin things like SDK versions, python deps, and a few other things which "make sense" (vague I know). For the 100% pinned-reproducible case we have guix builds (I think we should add a guix CI job and am working on a guix-substitute server which I think can make this a reality). Therefore despite this being a well-intentioned PR, and the NACK-rationale feeling pretty iffy (I agree!) I'm not convinced full pinning is exactly what we are after in our CI. On my side, I think using For the same reason I don't have much opinion of github actions pinning; I think it's fine either way. The WarpBuilds/cache action doesn't look like it's rebased on actions/cache since about 2024, but they do add their own fixes every week or so. There seems little benefit beyond pinning to a major version to avoid breaking changes. As with many things, it might benefit us to have some kind of spec or developer note describing what we want/need pinned and why. based on my own current understanding, this might read something like:
I understand there is still pushback to be had here: lint tools are part of the "linting test contract" for example and currently un-hash-checked... |
This pull is adding a locking mechanism for uv, and also a separate one for pip. What is the goal here? Add ones for Poetry, Pipenv, Hatch, etc as well? I am not sure, ideally zero are added, or at most one. |
49cc4e8 to
d452df5
Compare
| @@ -12,6 +12,9 @@ export APT_LLVM_V="22" | |||
| export HOST=x86_64-unknown-netbsd | |||
| export NETBSD_VERSION=11.0_RC6 | |||
There was a problem hiding this comment.
#11 17.01 + retry curl --location --fail https://cdn.netbsd.org/pub/NetBSD/NetBSD-11.0_RC6/amd64/binary/sets/base.tar.xz -o /home/runner/work/_temp/depends/sdk-sources/base.tar.xz
#11 17.02 % Total % Received % Xferd Average Speed Time Time Time Current
#11 17.02 Dload Upload Total Spent Left Speed
#11 17.02
0 0 0 0 0 0 0 0 0
#11 17.23 curl: (22) The requested URL returned error: 404
Looks like this needs to be bumped?
Maybe the first commit can be split up, along with such a sdk bump?
There was a problem hiding this comment.
Split the NetBSD SDK update into a separate first commit, bumped it to 11.0, and verified both archive URLs and hashes.
There was a problem hiding this comment.
I moved the CI bugfixes to #35875, to unbreak the CI.
I kept your exact commit IDs, so I hope it is fine.
The uv stuff can then be reviewed by itself on its own pace.
|
I reduced the PR to the two changes where there seems to be some agreement.
Kept the SDK archive verification commit.
Kept Will’s |
The NetBSD 11.0_RC6 archives are no longer available from cdn.netbsd.org. Update the cross-build SDK to the final 11.0 release.
The macOS and BSD cross-build jobs extract SDK archives fetched at runtime without checking their content. Keep each expected digest beside the corresponding SDK version and verify every archive before extraction. Create the OpenBSD library symlinks once after both archives are extracted, when all link targets are present.
`uv.lock` hash-locks Python dependencies. Running `uv sync --project /ci/lint --locked --only-group lint` in the container will fail if `pyproject.toml` does not match `uv.lock`. `.python-version` sets the Python version canonically, and `uv sync --locked` will fail if it does not satisfy `requires-python` in `pyproject.toml`.
d452df5 to
84ac1aa
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
|
Sorry, if the discussion was a bit heated here, but I think it was useful to have. Also commit 873550b is merged, which is nice.
Just checking in here again. I think nightly/bleeding-edge stuff should mostly sit outside this repo. We already have enough CI failures in the non-nightly part, and having all possible bleeding-nightly CI failures would likely mark every pull red. So having major version pins, where it makes sense, is useful.
Yeah, could make sense to add a short note to the ci/README.md about pins. Maybe something like: Container and GitHub Action pins are not done, because they:
- delay normal and security updates until someone bumps the pin;
- require recurring manual maintenance;
- are not recursive, so they can create false confidence about reproducibilityAbout the others:
|
Problem: The NetBSD cross-build job references a release candidate that is no longer available from its configured CDN.
The macOS and BSD cross-build jobs extract downloaded SDK archives without verifying their contents.
The lint image pins its direct Python dependencies, but resolves their transitive dependencies again whenever the image is rebuilt.
Fix: Update the NetBSD SDK, verify downloaded SDK archives against committed hashes, and lock the lint Python dependencies.
Verification