Skip to content

Commit

Permalink
Detect containers, only use global config in them
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed May 4, 2024
1 parent 73525cb commit 39c913b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion ci-support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ else
PLATFORM=Windows
fi


if grep -sq 'docker\|lxc' /proc/1/cgroup; then
CI_SUPPORT_IS_DOCKER=1
else
CI_SUPPORT_IS_DOCKER=0
fi
if [[ $CI_SUPPORT_IS_DOCKER = 1 ]] || [[ $GITHUB_ACTIONS == "true" ]]; then
CI_SUPPORT_IS_CONTAINER=1
else
CI_SUPPORT_IS_CONTAINER=0
fi

if [[ $CI_SUPPORT_IS_CONTAINER = 0 ]] && [[ $CI == "true" ]]; then
# clean up the mess that someone may have made
rm -f "$HOME/.aksetup-defaults.py"
fi

if [ "$PY_EXE" == "" ]; then
if [ "$py_version" == "" ]; then
if [ "$PLATFORM" = "Windows" ]; then
Expand Down Expand Up @@ -298,14 +315,16 @@ install_conda_deps()
else
LIBRARY_PREFIX="$CONDA_PREFIX"
fi
cat >> ~/.aksetup-defaults.py <<EOF
if [[ $CI_SUPPORT_IS_CONTAINER == 1 ]]; then
cat >> ~/.aksetup-defaults.py <<EOF
CL_INC_DIR = ["$LIBRARY_PREFIX/include"]
CL_LIB_DIR = ["$LIBRARY_PREFIX/lib"]
# This matches the default on Linux and forces the use of the conda-installed
# ICD loader on macOS.
CL_LIBNAME = ["OpenCL"]
EOF
fi
fi
}
Expand Down

0 comments on commit 39c913b

Please sign in to comment.