Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set -e should not be set after conda environment is sourced #1409

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion repo2docker/buildpacks/conda/activate-conda.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# enable conda and activate the notebook environment
set -ex
set -e
eval $(micromamba shell hook -s posix -r ${CONDA_DIR})
for name in conda mamba; do
CONDA_PROFILE="${CONDA_DIR}/etc/profile.d/${name}.sh"
Expand All @@ -21,3 +21,5 @@ if [[ "${KERNEL_PYTHON_PREFIX}" != "${NB_PYTHON_PREFIX}" ]]; then
else
mamba activate ${NB_PYTHON_PREFIX}
fi

set +e
2 changes: 2 additions & 0 deletions tests/venv/start/postBuild/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ postBuild and start

This test checks that we can use a postBuild and start script
at the same time.

It also checks that exit on error (set -e) has not leaked into the main shell.
7 changes: 6 additions & 1 deletion tests/venv/start/postBuild/verify
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash
#!/bin/bash -il
# Run this as an interactive login shell so that the conda profile is sourced

# Test that `set -e` isn't incorrectly set in a profile
false

set -euo pipefail
grep 'Done!' $HOME/postbuild.txt
# set value of TEST_START_VAR to empty string when it is not defined
Expand Down