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

DM-30833: Allow eups tags for exact conda env deployment. #143

Merged
merged 2 commits into from
Jul 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 46 additions & 2 deletions scripts/newinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,29 @@ n8l::miniconda::config_channels() {
$cmd conda config --env --show
}

n8l::get_tagged_env() {
eups_root=https://eups.lsst.codes/stack
env_version=$($CURL "${CURL_OPTS[@]}" -L "$eups_root/src/tags/$1.list" \
| grep '^#CONDA_ENV=' | cut -d= -f2) \
|| fail "Unable to determine conda env"
platform="$(uname -s)"
case "$platform" in
Linux)
eups_platform="redhat/el7/conda-system/miniconda3-${LSST_MINICONDA_VERSION}-$env_version"
;;
Darwin)
eups_platform="osx/10.9/conda-system/miniconda3-${LSST_MINICONDA_VERSION}-$env_version"
;;
*)
fail "Unknown platform: $platform"
;;
esac

$CURL "${CURL_OPTS[@]}" -O "$eups_root/$eups_platform/env/$1.env" \
|| fail "Unable to download environment spec for tag $1"
echo "$env_version"
}

# Install packages on which the stack is known to depend
n8l::miniconda::lsst_env() {
local ref=${1?lsstsw git ref is required}
Expand All @@ -495,11 +518,29 @@ n8l::miniconda::lsst_env() {
fi

for c in $conda_channels; do
args+=("-c $c")
args+=("-c" "$c")
done
args+=("rubin-env=${ref}")
if [[ "$ref" == [dsvw]* ]]; then
args+=("--file" "${ref}.env")
else
args+=("rubin-env=${ref}")
fi

$cmd conda "${args[@]}"

# Update rubin-env to latest build of specified version
if [[ "$ref" == [dsvw]* ]]; then
args=("install" "-y")
args+=("--no-update-deps" "--strict-channel-priority")
args+=("-n" "$LSST_CONDA_ENV_NAME")
for c in $conda_channels; do
args+=("-c" "$c")
done
args+=("rubin-env==$LSST_SPLENV_REF")
$cmd conda "${args[@]}"
rm -f "${ref}.env"
fi

echo "Cleaning conda environment..."
conda clean -y -a > /dev/null
echo "done"
Expand Down Expand Up @@ -635,6 +676,9 @@ n8l::miniconda::bootstrap() {
fi

if [[ -n $splenv_ref ]]; then
if [[ "$splenv_ref" == [dsvw]* ]]; then
LSST_SPLENV_REF=$(n8l::get_tagged_env "$splenv_ref")
fi
n8l::miniconda::lsst_env "$splenv_ref" "$miniconda_path" "$conda_channels"
fi

Expand Down