1 #!/usr/bin/env bash
2 #
3 # Copyright (c) 2018-present The Bitcoin Core developers
4 # Distributed under the MIT software license, see the accompanying
5 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 7 export LC_ALL=C
8 9 set -o errexit -o pipefail -o xtrace
10 11 # Fixes permission issues when there is a container UID/GID mismatch with the owner
12 # of the mounted bitcoin src dir.
13 git config --global --add safe.directory /bitcoin
14 15 export PATH="/python_env/bin:${PATH}"
16 17 if [ -n "${LINT_CI_IS_PR}" ]; then
18 export COMMIT_RANGE="HEAD~..HEAD"
19 if [ "$(git rev-list -1 HEAD)" != "$(git rev-list -1 --merges HEAD)" ]; then
20 echo "Error: The top commit must be a merge commit, usually the remote 'pull/<PR_NUMBER>/merge' branch."
21 false
22 fi
23 fi
24 25 RUST_BACKTRACE=1 cargo run --manifest-path "./test/lint/test_runner/Cargo.toml" -- "$@"
26 27 if [ "${LINT_CI_SANITY_CHECK_COMMIT_SIG}" = "1" ] ; then
28 # Sanity check only the last few commits to get notified of missing sigs,
29 # missing keys, or expired keys. Usually there is only one new merge commit
30 # per push on the master branch and a few commits on release branches, so
31 # sanity checking only a few (10) commits seems sufficient and cheap.
32 git log HEAD~10 -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
33 git log HEAD~10 -1 --format='%H' > ./contrib/verify-commits/trusted-git-root
34 mapfile -t KEYS < contrib/verify-commits/trusted-keys
35 git config user.email "ci@ci.ci"
36 git config user.name "ci"
37 ${CI_RETRY_EXE} gpg --keyserver hkps://keys.openpgp.org --recv-keys "${KEYS[@]}" &&
38 ./contrib/verify-commits/verify-commits.py;
39 fi
40