Skip to content

Commit 5d91053

Browse files
authored
Ensure pre-commit can be found via $PATH (#98)
* Ensure pre-commit can be found via $PATH there were more and more cases popping up, where pre-commit was not in $PATH. Instead of applying the same fix again and again, fix it centrally. * Test CODEQL_HOME exists
1 parent d8e4b31 commit 5d91053

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/s-core-devcontainer/.devcontainer/s-core-local/enable_pre_commit_hooks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PRE_COMMIT_CONFIG_FILE=".pre-commit-config.yaml"
1919
if [[ -f "${PRE_COMMIT_CONFIG_FILE}" ]]
2020
then
2121
echo "Pre-commit configuration found (${PRE_COMMIT_CONFIG_FILE})"
22-
"${PIPX_BIN_DIR}/pre-commit" install
22+
pre-commit install
2323
else
2424
echo "No pre-commit configuration found (${PRE_COMMIT_CONFIG_FILE})"
2525
echo "Skipping pre-commit hook's installation"

src/s-core-devcontainer/.devcontainer/s-core-local/install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ download_and_extract_from_github() {
8484
rm "${temp_file}"
8585
}
8686

87+
# always add PIPX_BIN_DIR to path
88+
PIPX_BIN_DIR_EXPORT="$(grep "export PIPX_BIN_DIR" /etc/bash.bashrc)"
89+
eval "${PIPX_BIN_DIR_EXPORT}"
90+
echo -e "PATH=\"${PIPX_BIN_DIR}:\$PATH\"\nexport PATH" >> /etc/profile.d/pipx_bin_dir.sh
91+
8792
apt-get update
8893

8994
# Unminimize the image to include standard packages like man pages

src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ KERNEL=$(uname -s)
2323
. /devcontainer/features/s-core-local/versions.sh /devcontainer/features/s-core-local/versions.yaml
2424

2525
# pre-commit, it is available via $PATH in login shells, but not in non-login shells
26-
check "validate pre-commit is working and has the correct version" bash -c "${PIPX_BIN_DIR}/pre-commit --version | grep '4.5.1'"
26+
check "validate pre-commit is working and has the correct version" bash -c "pre-commit --version | grep '4.5.1'"
2727

2828
# Common tooling
2929
check "validate shellcheck is working and has the correct version" bash -c "shellcheck --version | grep '${shellcheck_version}'"
@@ -75,6 +75,7 @@ check "validate gh is working and has the correct version" bash -c "gh --version
7575
check "validate valgrind is working and has the correct version" bash -c "valgrind --version | grep '${valgrind_version}'"
7676
if [ "${ARCHITECTURE}" = "amd64" ] || { [ "${ARCHITECTURE}" = "arm64" ] && [ "${KERNEL}" = "Darwin" ]; }; then
7777
check "validate codeql is working and has the correct version" bash -c "codeql --version | grep '${codeql_version}'"
78+
check "validate CODEQL_HOME is set correctly" bash -c "echo ${CODEQL_HOME} | grep \"/usr/local/codeql\""
7879
fi
7980

8081
# Qemu target-related tools

0 commit comments

Comments
 (0)