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

[rstudio-server] add a option to prevent reinstallation #182

Merged
merged 3 commits into from
Sep 2, 2023
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
5 changes: 5 additions & 0 deletions src/rstudio-server/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
"default": "stable",
"description": "Select version of the RStudio Server, if not stable."
},
"allowReinstall": {
"type": "boolean",
"default": true,
"description": "Reinstall in case RStudio Server is already installed."
},
"singleUser": {
"type": "boolean",
"default": true,
Expand Down
29 changes: 17 additions & 12 deletions src/rstudio-server/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

RS_VERSION=${VERSION:-"stable"}
ALLOW_REINSTALL=${ALLOWREINSTALL:-"false"}
SINGLE_USER=${SINGLEUSER:-"true"}

RSTUDIO_DATA_DIR=${RSTUDIODATADIR:-"/usr/local/share/rocker-devcontainer-features/rstudio-server/data"}
Expand Down Expand Up @@ -147,22 +148,26 @@ EOF

export DEBIAN_FRONTEND=noninteractive

check_packages curl ca-certificates gdebi-core
check_r
if [ "${ALLOW_REINSTALL}" = "true" ] || [ ! -x "$(command -v rstudio-server)" ]; then
check_packages curl ca-certificates gdebi-core
check_r

# Soft version matching
# If RS_VERSION contains `daily` like `2023.09.0-daily+310`, the check will be skipped.
if [[ "${RS_VERSION}" != "stable" ]] && [[ "${RS_VERSION}" != "preview" ]] && [[ "${RS_VERSION}" != *"daily"* ]]; then
if [ ! -x "$(command -v git)" ]; then
check_packages git
# Soft version matching
# If RS_VERSION contains `daily` like `2023.09.0-daily+310`, the check will be skipped.
if [[ "${RS_VERSION}" != "stable" ]] && [[ "${RS_VERSION}" != "preview" ]] && [[ "${RS_VERSION}" != *"daily"* ]]; then
if [ ! -x "$(command -v git)" ]; then
check_packages git
fi
find_version_from_git_tags RS_VERSION "https://github.com/rstudio/rstudio"
fi
find_version_from_git_tags RS_VERSION "https://github.com/rstudio/rstudio"
fi

# Install the RStudio Server
echo "Downloading RStudio Server..."
# Install the RStudio Server
echo "Downloading RStudio Server..."

install_rstudio "${RS_VERSION}"
install_rstudio "${RS_VERSION}"
else
echo "RStudio Server is already installed. Skip installation..."
fi

if [ "${SINGLE_USER}" = "true" ]; then
echo "Setting up RStudio Server for single user mode..."
Expand Down
2 changes: 1 addition & 1 deletion test/rstudio-server/daily.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
source dev-container-features-test-lib

# Feature-specific tests
check "version" bash -c 'rstudio-server version'
check "version" bash -c 'rstudio-server version | grep daily'

# Report result
reportResults
13 changes: 11 additions & 2 deletions test/rstudio-server/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@
}
},
"daily": {
"image": "rocker/r-ver",
"image": "rocker/rstudio",
"features": {
"rstudio-server": {
"version": "daily"
}
}
},
"skip-install": {
"image": "rocker/rstudio",
"features": {
"rstudio-server": {
"version": "daily",
"allowReinstall": false
}
}
},
"version-daily-specific": {
"image": "rocker/r-ver",
"features": {
Expand All @@ -37,7 +46,7 @@
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "jq"
},
"rstudio-server":{}
"rstudio-server": {}
}
}
}
12 changes: 12 additions & 0 deletions test/rstudio-server/skip-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -e

# Optional: Import test library bundled with the devcontainer CLI
source dev-container-features-test-lib

# Feature-specific tests
check "version" bash -c "rstudio-server version | grep ${RSTUDIO_VERSION}"

# Report result
reportResults