CTM-414: Fix RStudio image detection when JUPYTER_HOME is also present#4907
Open
CTM-414: Fix RStudio image detection when JUPYTER_HOME is also present#4907
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4907 +/- ##
========================================
Coverage 74.08% 74.08%
========================================
Files 131 131
Lines 11100 11100
Branches 895 895
========================================
Hits 8223 8223
Misses 2877 2877
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
aednichols
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira ticket: https://broadworkbench.atlassian.net/browse/CTM-413
Problem
Custom RStudio environments built on a Jupyter base image fail to launch because Leonardo misclassifies them as Jupyter runtimes.
Leonardo's
HttpDockerDAO.detectTool()determines the image type by scanning the container's env vars for eitherJUPYTER_HOME(Jupyter) orRSTUDIO_HOME(RStudio). The lookup usedMap(Jupyter -> "JUPYTER_HOME", RStudio -> "RSTUDIO_HOME")with.find, which in Scala 2.13 iterates in insertion order — meaning Jupyter was always checked first.When an image inherits
JUPYTER_HOMEfrom a Jupyter base image and definesRSTUDIO_HOMEin its own Dockerfile, the old code classified it as Jupyter. The misclassified image type was persisted to the DB at creation time, sostartup.shreceived a populatedJUPYTER_DOCKER_IMAGEand an emptyRSTUDIO_DOCKER_IMAGE, causing the Jupyter launch path to run against an image that isn't a Jupyter image — resulting in a timeout.Fix
Change
clusterToolEnvfrom aMapto an orderedListwith RStudio first. This makes the priority explicit and independent of anyMapimplementation details: if both env vars are present, RStudio wins as the more specific signal.