Skip to content

Commit

Permalink
Disable auto update for CodeEditor extensions (#492)
Browse files Browse the repository at this point in the history
Co-authored-by: Zuoyuan Huang <[email protected]>
  • Loading branch information
zuoyuanh and Zuoyuan Huang authored Oct 25, 2024
1 parent 082d271 commit eb32561
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
3 changes: 2 additions & 1 deletion template/v1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ RUN \
sagemaker-code-editor --install-extension "${ext}" --extensions-dir "${extensionloc}" --server-data-dir /opt/amazon/sagemaker/sagemaker-code-editor-server-data --user-data-dir /opt/amazon/sagemaker/sagemaker-code-editor-user-data; \
done \
# Copy the settings
&& cp /etc/code-editor/code_editor_machine_settings.json /opt/amazon/sagemaker/sagemaker-code-editor-server-data/data/Machine/settings.json
&& cp /etc/code-editor/code_editor_machine_settings.json /opt/amazon/sagemaker/sagemaker-code-editor-server-data/data/Machine/settings.json \
&& cp /etc/code-editor/code_editor_user_settings.json /opt/amazon/sagemaker/sagemaker-code-editor-server-data/data/User/settings.json

# Install glue kernels, and move to shared directory
# Also patching base kernel so Studio background code doesn't start session silently
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extensions.autoUpdate": false
}
1 change: 1 addition & 0 deletions template/v2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ RUN if [[ -z $ARG_BASED_ENV_IN_FILENAME ]] ; \
done \
# Copy the settings
&& cp /etc/code-editor/code_editor_machine_settings.json /opt/amazon/sagemaker/sagemaker-code-editor-server-data/data/Machine/settings.json && \
&& cp /etc/code-editor/code_editor_user_settings.json /opt/amazon/sagemaker/sagemaker-code-editor-server-data/data/User/settings.json && \
# Install glue kernels, and move to shared directory
# Also patching base kernel so Studio background code doesn't start session silently
install-glue-kernels && \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extensions.autoUpdate": false
}
13 changes: 11 additions & 2 deletions test/test_artifacts/v1/scripts/run_sagemaker_code_editor_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,23 @@ for extension in "${installed_extensions[@]}"; do
done
echo "Verified that all extension folders are present in $extensions_base_dir."

# Check that settings file is copied
# Check that machine settings file is copied
MACHINE_SETTINGS_FILE_PATH="/opt/amazon/sagemaker/sagemaker-code-editor-server-data/data/Machine/settings.json"
if [ ! -f "$MACHINE_SETTINGS_FILE_PATH" ]; then
echo "Error: Settings file does not exist at $MACHINE_SETTINGS_FILE_PATH."
exit 1
fi

echo "Settings file exists at $FILE_PATH."
echo "Machine Settings file exists at $MACHINE_SETTINGS_FILE_PATH."

# Check that user settings file is copied
USER_SETTINGS_FILE_PATH="/opt/amazon/sagemaker/sagemaker-code-editor-server-data/data/User/settings.json"
if [ ! -f "$USER_SETTINGS_FILE_PATH" ]; then
echo "Error: Settings file does not exist at $USER_SETTINGS_FILE_PATH."
exit 1
fi

echo "User Settings file exists at $USER_SETTINGS_FILE_PATH."

# Check that code-editor artifacts folder is deleted
ARTIFACTS_DIR="/etc/code-editor"
Expand Down
13 changes: 11 additions & 2 deletions test/test_artifacts/v2/scripts/run_sagemaker_code_editor_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,23 @@ for extension in "${installed_extensions[@]}"; do
done
echo "Verified that all extension folders are present in $extensions_base_dir."

# Check that settings file is copied
# Check that machine settings file is copied
MACHINE_SETTINGS_FILE_PATH="/opt/amazon/sagemaker/sagemaker-code-editor-server-data/data/Machine/settings.json"
if [ ! -f "$MACHINE_SETTINGS_FILE_PATH" ]; then
echo "Error: Settings file does not exist at $MACHINE_SETTINGS_FILE_PATH."
exit 1
fi

echo "Settings file exists at $FILE_PATH."
echo "Machine Settings file exists at $MACHINE_SETTINGS_FILE_PATH."

# Check that user settings file is copied
USER_SETTINGS_FILE_PATH="/opt/amazon/sagemaker/sagemaker-code-editor-server-data/data/User/settings.json"
if [ ! -f "$USER_SETTINGS_FILE_PATH" ]; then
echo "Error: Settings file does not exist at $USER_SETTINGS_FILE_PATH."
exit 1
fi

echo "User Settings file exists at $USER_SETTINGS_FILE_PATH."

# Check that code-editor artifacts folder is deleted
ARTIFACTS_DIR="/etc/code-editor"
Expand Down

0 comments on commit eb32561

Please sign in to comment.