ci: sanitize python path before quality setup
Some checks failed
CI/CD Pipeline / Manual Action Help (push) Has been skipped
CI/CD Pipeline / Start Dev Containers in Dokploy (push) Has been skipped
CI/CD Pipeline / Drop and Recreate Dev Database (push) Has been skipped
CI/CD Pipeline / Quality Gate (push) Failing after 2s
CI/CD Pipeline / Build and Push Images (push) Has been skipped
CI/CD Pipeline / Deploy Dev in Dokploy (push) Has been skipped
CI/CD Pipeline / Internal Notify (push) Successful in 1s
Some checks failed
CI/CD Pipeline / Manual Action Help (push) Has been skipped
CI/CD Pipeline / Start Dev Containers in Dokploy (push) Has been skipped
CI/CD Pipeline / Drop and Recreate Dev Database (push) Has been skipped
CI/CD Pipeline / Quality Gate (push) Failing after 2s
CI/CD Pipeline / Build and Push Images (push) Has been skipped
CI/CD Pipeline / Deploy Dev in Dokploy (push) Has been skipped
CI/CD Pipeline / Internal Notify (push) Successful in 1s
This commit is contained in:
@@ -85,8 +85,27 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf .venv .ci-python-env
|
||||
CLEAN_PATH=""
|
||||
IFS=: read -r -a PATH_PARTS <<< "${PATH}"
|
||||
for path_part in "${PATH_PARTS[@]}"; do
|
||||
case "${path_part}" in
|
||||
.venv/bin|*/.venv/bin)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
CLEAN_PATH="${CLEAN_PATH:+${CLEAN_PATH}:}${path_part}"
|
||||
done
|
||||
export PATH="${CLEAN_PATH}"
|
||||
hash -r
|
||||
PROJECT_PYTHON_VERSION="$(cat .python-version 2>/dev/null || printf '%s' "${PYTHON_VERSION}")"
|
||||
PYTHON_BIN="$(./scripts/ensure-ci-python.sh "${PROJECT_PYTHON_VERSION}")"
|
||||
case "${PYTHON_BIN}" in
|
||||
.venv/*|*/.venv/*)
|
||||
echo "Refusing to use project virtualenv as base Python: ${PYTHON_BIN}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
"${PYTHON_BIN}" --version
|
||||
|
||||
printf 'PYTHON_BIN=%s\n' "${PYTHON_BIN}" > .ci-python-env
|
||||
|
||||
@@ -94,6 +113,12 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
. ./.ci-python-env
|
||||
case "${PYTHON_BIN}" in
|
||||
.venv/*|*/.venv/*)
|
||||
echo "Refusing to create venv from project virtualenv: ${PYTHON_BIN}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
"${PYTHON_BIN}" -m venv .venv
|
||||
. .venv/bin/activate
|
||||
python -m pip install "uv==${UV_VERSION}"
|
||||
|
||||
@@ -34,7 +34,7 @@ python_has_venv() {
|
||||
print_if_usable() {
|
||||
local candidate="$1"
|
||||
case "${candidate}" in
|
||||
"${PWD}/.venv/"*)
|
||||
.venv/*|*/.venv/*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user