Skip to content

Commit 566b8ea

Browse files
Add IS_GIT_PROJECT variable and write to smus-storage-metadata.json (#730)
1 parent 7a33185 commit 566b8ea

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

template/v2/dirs/etc/sagemaker-ui/sagemaker_ui_post_startup.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ is_s3_storage
158158
is_s3_storage_flag=$? # 0 if S3 storage, 1 if Git
159159

160160
if [ "$is_s3_storage_flag" -eq 0 ]; then
161+
export IS_GIT_PROJECT=false
161162
export SMUS_PROJECT_DIR="$HOME/shared"
162163
echo "Project is using S3 storage, project directory set to: $SMUS_PROJECT_DIR"
163164
else
165+
export IS_GIT_PROJECT=true
164166
export SMUS_PROJECT_DIR="$HOME/src"
165167
echo "Project is using Git storage, project directory set to: $SMUS_PROJECT_DIR"
166168
fi
@@ -173,9 +175,14 @@ else
173175
fi
174176

175177
# Write SMUS_PROJECT_DIR to a JSON file to be accessed by JupyterLab Extensions
178+
mkdir -p "$HOME/.config" # Create config directory if it doesn't exist
176179
jq -n \
177180
--arg smusProjectDirectory "$SMUS_PROJECT_DIR" \
178-
'{ smusProjectDirectory: $smusProjectDirectory }' > $HOME/.config/smus-storage-metadata.json
181+
--arg isGitProject "$IS_GIT_PROJECT" \
182+
'{
183+
smusProjectDirectory: $smusProjectDirectory,
184+
isGitProject: ($isGitProject == "true")
185+
}' > "$HOME/.config/smus-storage-metadata.json"
179186

180187
if [ $is_s3_storage_flag -ne 0 ]; then
181188
# Creating a directory where the repository will be cloned

template/v3/dirs/etc/sagemaker-ui/sagemaker_ui_post_startup.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ is_s3_storage
158158
is_s3_storage_flag=$? # 0 if S3 storage, 1 if Git
159159

160160
if [ "$is_s3_storage_flag" -eq 0 ]; then
161+
export IS_GIT_PROJECT=false
161162
export SMUS_PROJECT_DIR="$HOME/shared"
162163
echo "Project is using S3 storage, project directory set to: $SMUS_PROJECT_DIR"
163164
else
165+
export IS_GIT_PROJECT=true
164166
export SMUS_PROJECT_DIR="$HOME/src"
165167
echo "Project is using Git storage, project directory set to: $SMUS_PROJECT_DIR"
166168
fi
@@ -173,9 +175,14 @@ else
173175
fi
174176

175177
# Write SMUS_PROJECT_DIR to a JSON file to be accessed by JupyterLab Extensions
178+
mkdir -p "$HOME/.config" # Create config directory if it doesn't exist
176179
jq -n \
177180
--arg smusProjectDirectory "$SMUS_PROJECT_DIR" \
178-
'{ smusProjectDirectory: $smusProjectDirectory }' > $HOME/.config/smus-storage-metadata.json
181+
--arg isGitProject "$IS_GIT_PROJECT" \
182+
'{
183+
smusProjectDirectory: $smusProjectDirectory,
184+
isGitProject: ($isGitProject == "true")
185+
}' > "$HOME/.config/smus-storage-metadata.json"
179186

180187
if [ $is_s3_storage_flag -ne 0 ]; then
181188
# Creating a directory where the repository will be cloned

0 commit comments

Comments
 (0)