Skip to content
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
11 changes: 10 additions & 1 deletion src/julia/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Julia (via Juliaup)",
"id": "julia",
"version": "1.1.1",
"version": "1.2.0",
"description": "Install the Julia programming language",
"documentationURL": "https://github.com/JuliaLang/devcontainer-features/tree/main/src/julia",
"options": {
Expand All @@ -13,6 +13,15 @@
],
"default": "release",
"description": "Select a Juliaup channel"
},
"additionalChannels": {
"type": "string",
"default": "",
"description": "Additional Juliaup channels to install, separated by commas (e.g., 'nightly,1.10')",
"proposals": [
"nightly",
"lts,nightly"
]
}
},
"installsAfter": [
Expand Down
17 changes: 16 additions & 1 deletion src/julia/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

CHANNEL=${CHANNEL:-"release"}

IFS=',' read -ra channels <<< ${ADDITIONALCHANNELS:-""}
USERNAME=${USERNAME:-${_REMOTE_USER:-"automatic"}}

set -e
Expand All @@ -28,6 +28,13 @@ elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" >/dev/null 2>&1; then
USERNAME=root
fi

# Determine the home directory of the user
if [ "${USERNAME}" = "root" ]; then
REMOTE_USER_HOME=${_REMOTE_USER_HOME:-"/root"}
else
REMOTE_USER_HOME=${_REMOTE_USER_HOME:-"/home/${USERNAME}"}
fi

cleanup_apt() {
# shellcheck source=/dev/null
source /etc/os-release
Expand All @@ -54,6 +61,14 @@ check_packages curl ca-certificates

su "${USERNAME}" -c "curl -fsSL https://install.julialang.org | sh -s -- --yes --default-channel ${CHANNEL}"

for channel in "${channels[@]}"; do
# if channel is not empty and not equal to the default channel...
if [ "${channel}" != "" ] && [ "${channel}" != "${CHANNEL}" ]; then
echo "Adding additional Julia channel: ${channel}";
su "${USERNAME}" -c "${REMOTE_USER_HOME}/.juliaup/bin/juliaup add ${channel}";
fi
done

# Clean up
cleanup_apt

Expand Down
20 changes: 20 additions & 0 deletions test/julia/multiple.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -e

# shellcheck source=/dev/null
source dev-container-features-test-lib

# helper function (lts and release should be installed)
check_version_count() {
local count
count=$(juliaup status | awk 'NR > 2 { print $(NF-1) }' | wc -l)
[ "$count" -eq 4 ] # matches number in scenarios.json
}

# Feature-specific tests
check "version" julia --version
check "version-count" check_version_count

# Report result
reportResults
9 changes: 9 additions & 0 deletions test/julia/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,14 @@
"channel": "lts"
}
}
},
"multiple": {
"image": "debian:stable-slim",
"features": {
"julia": {
"channel": "lts",
"additionalChannels": "1.6, 1.7,1.8"
}
}
}
}