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
2 changes: 1 addition & 1 deletion src/oryx/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "oryx",
"version": "1.0.11",
"version": "1.0.12",
"name": "Oryx",
"description": "Installs the oryx CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx",
Expand Down
20 changes: 13 additions & 7 deletions src/oryx/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ echo "Installing Oryx..."
# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive


# Install dependencies
check_packages git sudo curl ca-certificates apt-transport-https gnupg2 dirmngr libc-bin
check_packages git sudo curl ca-certificates apt-transport-https gnupg2 dirmngr libc-bin moreutils

if ! cat /etc/group | grep -e "^oryx:" > /dev/null 2>&1; then
groupadd -r oryx
Expand All @@ -127,16 +126,23 @@ usermod -a -G oryx "${USERNAME}"

# Required to decide if we want to clean up dotnet later.
DOTNET_INSTALLATION_PACKAGE=""
DOTNET_BINARY=""

if dotnet --version > /dev/null ; then
DOTNET_BINARY=$(which dotnet)
fi

# Install dotnet unless available
if ! dotnet --version > /dev/null ; then
echo "'dotnet' was not detected. Attempting to install the latest version of the dotnet sdk to build oryx."
# Oryx needs to be built with .NET 6
if [[ "${DOTNET_BINARY}" = "" ]] || [[ "$(dotnet --version)" != *"6"* ]] ; then
echo "'dotnet 6' was not detected. Attempting to install .NET 6 to build oryx."
install_dotnet_using_apt

if ! dotnet --version > /dev/null ; then
echo "(!) Please install Dotnet before installing Oryx"
exit 1
fi

DOTNET_BINARY="/usr/bin/dotnet"
fi

BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen
Expand All @@ -150,8 +156,8 @@ git clone --depth=1 https://github.com/microsoft/Oryx $GIT_ORYX

$GIT_ORYX/build/buildSln.sh

dotnet publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj
dotnet publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildServer/BuildServer.csproj
${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj
${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildServer/BuildServer.csproj

chmod a+x ${BUILD_SCRIPT_GENERATOR}/GenerateBuildScript

Expand Down
2 changes: 1 addition & 1 deletion src/python/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "python",
"version": "1.0.14",
"version": "1.0.15",
"name": "Python",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/python",
"description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.",
Expand Down
2 changes: 1 addition & 1 deletion src/python/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export PIPX_HOME=${PIPX_HOME:-"/usr/local/py-utils"}

USERNAME=${USERNAME:-"automatic"}
UPDATE_RC=${UPDATE_RC:-"true"}
USE_ORYX_IF_AVAILABLE=${USE_ORYX_IF_AVAILABLE:-"true"}
USE_ORYX_IF_AVAILABLE=${USEORYXIFAVAILABLE:-"true"}

INSTALL_JUPYTERLAB=${INSTALLJUPYTERLAB:-"false"}
CONFIGURE_JUPYTERLAB_ALLOW_ORIGIN=${CONFIGUREJUPYTERLABALLOWORIGIN:-""}
Expand Down
2 changes: 2 additions & 0 deletions test/oryx/sample-python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mpmath==1.2.1
sympy==1.11.1
12 changes: 12 additions & 0 deletions test/oryx/sample-python/src/solve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from sympy import Symbol, Eq, solve

x = Symbol("x")
y = Symbol("y")

equation_1 = Eq((x + y), 2)
equation_2 = Eq((x - y), 4)
print("Equation 1:", equation_1)
print("Equation 2:", equation_2)

solution = solve((equation_1, equation_2), (x, y))
print("Solution:", solution)
15 changes: 15 additions & 0 deletions test/oryx/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,20 @@
},
"oryx": {}
}
},
"test_python_project": {
"image": "ubuntu:focal",
"features": {
"python": {
"version": "3.10.4",
"additionalVersions": "3.9.7",
"useOryxIfAvailable": "false"
},
"dotnet": {
"version": "7",
"installUsingApt": "false"
},
"oryx": {}
}
}
}
32 changes: 32 additions & 0 deletions test/oryx/test_python_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

cd sample-python

# Replicates Oryx's behavior for universal image
DEBIAN_FLAVOR="focal-scm"
mkdir -p /opt/oryx && echo "vso-focal" > /opt/oryx/.imagetype
echo "DEBIAN|${DEBIAN_FLAVOR}" | tr '[a-z]' '[A-Z]' > /opt/oryx/.ostype

ln -snf /usr/local/oryx/* /opt/oryx

PYTHON_PATH="/home/codespace/.python/current"
mkdir -p /home/codespace/.python
ln -snf /usr/local/python/current $PYTHON_PATH
ln -snf /usr/local/python /opt/python

export PATH="/home/codespace/.python/current/bin:${PATH}"
which python

pythonVersion=$(python -V 2>&1 | grep -Po '(?<=Python )(.+)')
pythonSite=`python -m site --user-site`
check "oryx-build-python" oryx build --property python_version="${pythonVersion}" --property packagedir="${pythonSite}" ./
Comment thread
samruddhikhandale marked this conversation as resolved.
check "oryx-build-python-installed" python3 -m pip list | grep mpmath
check "oryx-build-python-result" python3 ./src/solve.py

# Report result
reportResults