Unverified Commit 0604e45e authored by Samruddhi Khandale's avatar Samruddhi Khandale Committed by GitHub

Oryx: Fix build failures ; pin to .NET 8.0.101 (#882)

* Oryx: Fix build failures ; pin to .NET 8.0.101

* fix build

* fix "install_dotnet_and_oryx"
parent 979c12bd
...@@ -25,6 +25,9 @@ jobs: ...@@ -25,6 +25,9 @@ jobs:
set -e set -e
echo "Start." echo "Start."
# Update dotnet-install for Oryx Feature as well
cp src/dotnet/scripts/vendor/dotnet-install.sh src/oryx/scripts/vendor/dotnet-install.sh
# Configure git and Push updates # Configure git and Push updates
git config --global user.email github-actions@github.com git config --global user.email github-actions@github.com
git config --global user.name github-actions git config --global user.name github-actions
...@@ -36,12 +39,18 @@ jobs: ...@@ -36,12 +39,18 @@ jobs:
# Add / update and commit # Add / update and commit
git add src/dotnet/scripts/vendor/dotnet-install.sh git add src/dotnet/scripts/vendor/dotnet-install.sh
git add src/dotnet/scripts/vendor/dotnet-install.sh
git commit -m 'Automated dotnet-install script update' || export NO_UPDATES=true git commit -m 'Automated dotnet-install script update' || export NO_UPDATES=true
# Bump version and push # Bump version and push
if [ "$NO_UPDATES" != "true" ] ; then if [ "$NO_UPDATES" != "true" ] ; then
echo "$(jq --indent 4 '.version = (.version | split(".") | map(tonumber) | .[2] += 1 | join("."))' src/dotnet/devcontainer-feature.json)" > src/dotnet/devcontainer-feature.json echo "$(jq --indent 4 '.version = (.version | split(".") | map(tonumber) | .[2] += 1 | join("."))' src/dotnet/devcontainer-feature.json)" > src/dotnet/devcontainer-feature.json
git add src/dotnet/devcontainer-feature.json git add src/dotnet/devcontainer-feature.json
echo "$(jq --indent 4 '.version = (.version | split(".") | map(tonumber) | .[2] += 1 | join("."))' src/oryx/devcontainer-feature.json)" > src/oryx/devcontainer-feature.json
git add src/oryx/devcontainer-feature.json
git commit -m 'Bump version' git commit -m 'Bump version'
git push origin "$branch" git push origin "$branch"
gh api \ gh api \
......
{ {
"id": "oryx", "id": "oryx",
"version": "1.2.0", "version": "1.3.0",
"name": "Oryx", "name": "Oryx",
"description": "Installs the oryx CLI", "description": "Installs the oryx CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx",
......
...@@ -70,6 +70,25 @@ check_packages() { ...@@ -70,6 +70,25 @@ check_packages() {
fi fi
} }
install_dotnet_with_script()
{
local version="$1"
CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}")
DOTNET_INSTALL_SCRIPT="$CURRENT_DIR/scripts/vendor/dotnet-install.sh"
DOTNET_INSTALL_DIR='/usr/share/dotnet'
check_packages icu-devtools
"$DOTNET_INSTALL_SCRIPT" \
--version "$version" \
--install-dir "$DOTNET_INSTALL_DIR" \
--no-path
DOTNET_BINARY="dotnet"
export PATH="${PATH}:/usr/share/dotnet"
DOTNET_BINARY_INSTALLATION="/usr/share/dotnet/sdk/${version}"
}
install_dotnet_using_apt() { install_dotnet_using_apt() {
echo "Attempting to auto-install dotnet..." echo "Attempting to auto-install dotnet..."
install_from_microsoft_feed=false install_from_microsoft_feed=false
...@@ -86,6 +105,7 @@ install_dotnet_using_apt() { ...@@ -86,6 +105,7 @@ install_dotnet_using_apt() {
DOTNET_SKIP_FIRST_TIME_EXPERIENCE="true" apt-get install -yq $DOTNET_INSTALLATION_PACKAGE DOTNET_SKIP_FIRST_TIME_EXPERIENCE="true" apt-get install -yq $DOTNET_INSTALLATION_PACKAGE
fi fi
DOTNET_BINARY="/usr/bin/dotnet"
echo -e "Finished attempt to install dotnet. Sdks installed:\n" echo -e "Finished attempt to install dotnet. Sdks installed:\n"
dotnet --list-sdks dotnet --list-sdks
...@@ -126,6 +146,7 @@ usermod -a -G oryx "${USERNAME}" ...@@ -126,6 +146,7 @@ usermod -a -G oryx "${USERNAME}"
# Required to decide if we want to clean up dotnet later. # Required to decide if we want to clean up dotnet later.
DOTNET_INSTALLATION_PACKAGE="" DOTNET_INSTALLATION_PACKAGE=""
DOTNET_BINARY_INSTALLATION=""
DOTNET_BINARY="" DOTNET_BINARY=""
if dotnet --version > /dev/null ; then if dotnet --version > /dev/null ; then
...@@ -133,18 +154,23 @@ if dotnet --version > /dev/null ; then ...@@ -133,18 +154,23 @@ if dotnet --version > /dev/null ; then
fi fi
MAJOR_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 1) MAJOR_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 1)
PATCH_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 3)
# Oryx needs to be built with .NET 8 # Oryx needs to be built with .NET 8
if [[ "${DOTNET_BINARY}" = "" ]] || [[ $MAJOR_VERSION_ID != "8" ]] ; then if [[ "${DOTNET_BINARY}" = "" ]] || [[ $MAJOR_VERSION_ID != "8" ]] || [[ $MAJOR_VERSION_ID = "8" && ${PATCH_VERSION_ID} -ge "101" ]] ; then
echo "'dotnet 8' was not detected. Attempting to install .NET 8 to build oryx." echo "'dotnet 8' was not detected. Attempting to install .NET 8 to build oryx."
install_dotnet_using_apt
# The oryx build fails with .Net 8.0.201, see https://github.com/devcontainers/images/issues/974
# Pinning it to a working version until the upstream Oryx repo updates the dependency
# install_dotnet_using_apt
PINNED_SDK_VERSION="8.0.101"
install_dotnet_with_script ${PINNED_SDK_VERSION}
if ! dotnet --version > /dev/null ; then if ! dotnet --version > /dev/null ; then
echo "(!) Please install Dotnet before installing Oryx" echo "(!) Please install Dotnet before installing Oryx"
exit 1 exit 1
fi fi
DOTNET_BINARY="/usr/bin/dotnet"
fi fi
BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen
...@@ -156,6 +182,11 @@ mkdir -p ${ORYX} ...@@ -156,6 +182,11 @@ mkdir -p ${ORYX}
git clone --depth=1 https://github.com/microsoft/Oryx $GIT_ORYX git clone --depth=1 https://github.com/microsoft/Oryx $GIT_ORYX
if [[ "${DOTNET_BINARY_INSTALLATION}" != "" ]]; then
cd $GIT_ORYX
dotnet new globaljson --sdk-version ${PINNED_SDK_VERSION}
fi
SOLUTION_FILE_NAME="Oryx.sln" SOLUTION_FILE_NAME="Oryx.sln"
echo "Building solution '$SOLUTION_FILE_NAME'..." echo "Building solution '$SOLUTION_FILE_NAME'..."
...@@ -203,6 +234,12 @@ if [[ "${DOTNET_INSTALLATION_PACKAGE}" != "" ]]; then ...@@ -203,6 +234,12 @@ if [[ "${DOTNET_INSTALLATION_PACKAGE}" != "" ]]; then
apt purge -yq $DOTNET_INSTALLATION_PACKAGE apt purge -yq $DOTNET_INSTALLATION_PACKAGE
fi fi
if [[ "${DOTNET_BINARY_INSTALLATION}" != "" ]]; then
rm -f ${GIT_ORYX}/global.json
rm -rf ${DOTNET_BINARY_INSTALLATION}
fi
# Clean up # Clean up
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
......
### **IMPORTANT NOTE**
Scripts in this directory are sourced externally and not maintained by the Dev Container spec maintainers. Do not make changes directly as they might be overwritten at any moment.
## dotnet-install.sh
`dotnet-install.sh` is a copy of <https://dot.net/v1/dotnet-install.sh>. ([Script reference](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script))
Quick options reminder for `dotnet-install.sh`:
- `--version`: `"latest"` (default) or an exact version in the form A.B.C like `"6.0.413"`
- `--channel`: `"LTS"` (default), `"STS"`, a two-part version in the form A.B like `"6.0"` or three-part form A.B.Cxx like `"6.0.1xx"`
- `--quality`: `"daily"`, `"preview"` or `"GA"`
- The channel option is only used when version is 'latest' because an exact version overrides the channel option
- The quality option is only used when channel is 'A.B' or 'A.B.Cxx' because it can't be used with STS or LTS
Examples
```
dotnet-install.sh [--version latest] [--channel LTS]
dotnet-install.sh [--version latest] --channel STS
dotnet-install.sh [--version latest] --channel 6.0 [--quality GA]
dotnet-install.sh [--version latest] --channel 6.0.4xx [--quality GA]
dotnet-install.sh [--version latest] --channel 8.0 --quality preview
dotnet-install.sh [--version latest] --channel 8.0 --quality daily
dotnet-install.sh --version 6.0.413
```
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment