Skip to content

Commit

Permalink
[RStudio] fixing the test failure for 2.0 ubuntu images. (#1191)
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-cs committed Jun 28, 2024
1 parent f28f0c9 commit f5816e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions integration_tests/dataproc_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class DataprocTestCase(parameterized.TestCase):
COMPONENT = None
INIT_ACTIONS = None
INIT_ACTIONS_REPO = None
IMAGE_VERSION_2_2 = ['2.2-debian12', '2.2-ubuntu22', '2.2-rocky9']

@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -114,6 +115,8 @@ def createCluster(self,
args.append("--image={}".format(FLAGS.image))
elif FLAGS.image_version:
args.append("--image-version={}".format(FLAGS.image_version))
if FLAGS.image_version in self.IMAGE_VERSION_2_2:
args.append("--public-ip-address")

if optional_components:
args.append("--optional-components={}".format(
Expand Down
16 changes: 15 additions & 1 deletion rstudio/rstudio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ function run_with_retries() {
"${cmd[@]}"
}

function install_package() {
local LIBDEFLATE0_URL="http://archive.ubuntu.com/ubuntu/pool/universe/libd/libdeflate/libdeflate0_1.5-3_amd64.deb"
local LIBDEFLATE_DEV_URL="http://archive.ubuntu.com/ubuntu/pool/universe/libd/libdeflate/libdeflate-dev_1.5-3_amd64.deb"
TMP_DIR=$(mktemp -d)
wget -q -P "${TMP_DIR}" "${LIBDEFLATE0_URL}"
dpkg -i "${TMP_DIR}/$(basename "${LIBDEFLATE0_URL}")"
wget -q -P "${TMP_DIR}" "${LIBDEFLATE_DEV_URL}"
dpkg -i "${TMP_DIR}/$(basename "${LIBDEFLATE_DEV_URL}")"
rm -rf "${TMP_DIR}"
}

if [[ "${ROLE}" == 'Master' ]]; then
if [[ ${OS_ID} == debian ]] && [[ $(echo "${DATAPROC_IMAGE_VERSION} <= 2.1" | bc -l) == 1 ]]; then
remove_old_backports
Expand All @@ -129,6 +140,9 @@ if [[ "${ROLE}" == 'Master' ]]; then
fi
apt-get install -y software-properties-common
add-apt-repository "deb http://cran.r-project.org/bin/linux/${OS_ID} ${OS_CODE}-cran40/"
if [[ ${OS_ID} == ubuntu ]] && [[ $(echo "${DATAPROC_IMAGE_VERSION} == 2.0" | bc -l) == 1 ]]; then
install_package
fi
update_apt_get
apt-get install -y r-base r-base-dev gdebi-core

Expand All @@ -147,7 +161,7 @@ if [[ "${ROLE}" == 'Master' ]]; then
fi
if [[ -z "${USER_PASSWORD}" ]]; then
service_file=/etc/systemd/system/rstudio-server.service
if [[ "${OS_CODE}" == "bookworm" ]];then
if [[ "${OS_CODE}" == "bookworm" ]] || [[ "${OS_CODE}" == "jammy" ]];then
service_file=/lib/systemd/system/rstudio-server.service
fi
sed -i 's:ExecStart=\(.*\):Environment=USER=rstudio\nExecStart=\1 --auth-none 1:1' "$service_file"
Expand Down

0 comments on commit f5816e0

Please sign in to comment.