-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_vscode.sh
55 lines (41 loc) · 1.71 KB
/
start_vscode.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
echo "+-- START: AE5 VSCode Launcher ---"
OC=/opt/continuum
OCV=$OC/.vscode
OCA=$OC/anaconda
OCP=$OC/project
OCAB=$OCA/bin
OCLL=$OCA/envs/lab_launch
OCLB=$OCLL/bin
SETTINGS="/var/run/secrets/user_credentials/vscode_settings"
export CONDA_EXE=$OCA/bin/conda
export CONDA_DESIRED_ENV=$(cd $OCP && $OCLB/anaconda-project list-env-specs </dev/null | grep -A1 ^= | tail -1)
ENV_PREFIX="$ANACONDA_PROJECT_ENVS_PATH/$CONDA_DESIRED_ENV"
echo "| Prefix: $ENV_PREFIX"
sed -E -i 's@("python.pythonPath":\s*")[^"]*(")@\1'"$ENV_PREFIX/bin/python"'\2@' $OCV/project.code-workspace
echo "| Workspace Settings file $OCV/project.code-workspace:"
echo "|---"
sed 's@^@| @' $OCV/project.code-workspace
echo "|---"
sed -E -i 's@lab_launch@'"$CONDA_DESIRED_ENV"'@' $OCV/activate-env-spec.sh
python /opt/continuum/scripts/merge_vscode_settings.py $SETTINGS
export NODE_EXTRA_CA_CERTS=$OCLL/ssl/cacert.pem
export BOKEH_ALLOW_WS_ORIGIN=$TOOL_HOST ## allows bokeh apps to work with proxy
export XDG_DATA_HOME=$OCV ## implement last-visited in coder.json
## Git configs to allow push without arguments
git config push.default upstream
git branch -u origin/master
## configure pre-push hook to POST revision metadata
cp $OC/scripts/pre-push $OCP/.git/hooks
chmod 755 $OCP/.git/hooks/pre-push
## post-commit message to reminder user to tag and push
cp $OC/scripts/post-commit $OCP/.git/hooks
chmod 755 $OCP/.git/hooks/post-commit
args=($OCLB/code-server --auth none --user-data-dir $OCV)
args+=(--disable-telemetry)
[[ $TOOL_PORT ]] && args+=(--port $TOOL_PORT)
[[ $TOOL_ADDRESS ]] && args+=(--host $TOOL_ADDRESS)
echo "| Command line: ${args[@]}"
echo "+-- END: AE5 VSCode Launcher ---"
cd $OCP
exec "${args[@]}"