Unverified Commit f8e7e275 authored by Mathiyarasy's avatar Mathiyarasy Committed by GitHub

Oryx Issue (#1181)

Universal Image Latest Version: Caused issue in a Pipeline
Azure DevOps Pipeline generate-kitchensink-automated Failed

This PR aims to do things:

The pinned dotnet version now is 8.0.202 : Oryx: Unpin .NET version 8.0.101
Publish oryx app with --self-contained true tag . Without this tag oryx fails to launch stating compatible .net runtime version not found
parent 9a463940
{ {
"id": "oryx", "id": "oryx",
"version": "1.3.6", "version": "1.3.7",
"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",
......
...@@ -149,6 +149,7 @@ DOTNET_BINARY="" ...@@ -149,6 +149,7 @@ DOTNET_BINARY=""
if dotnet --version > /dev/null ; then if dotnet --version > /dev/null ; then
DOTNET_BINARY=$(which dotnet) DOTNET_BINARY=$(which dotnet)
RUNTIME_VERSIONS=$(dotnet --list-runtimes | awk '{print $2}' | sort | uniq)
fi fi
MAJOR_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 1) MAJOR_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 1)
...@@ -156,20 +157,17 @@ PATCH_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 3) ...@@ -156,20 +157,17 @@ PATCH_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 3)
PINNED_SDK_VERSION="" PINNED_SDK_VERSION=""
# Oryx needs to be built with .NET 8 # Oryx needs to be built with .NET 8
if [[ "${DOTNET_BINARY}" = "" ]] || [[ $MAJOR_VERSION_ID != "8" ]] || [[ $MAJOR_VERSION_ID = "8" && ${PATCH_VERSION_ID} -ge "101" ]] ; then if [[ "${DOTNET_BINARY}" = "" ]] || [[ $MAJOR_VERSION_ID != "8" ]] || [[ $MAJOR_VERSION_ID = "8" && ${PATCH_VERSION_ID} -ne "202" ]] ; 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."
# The oryx build fails with .Net 8.0.201, see https://github.com/devcontainers/images/issues/974 # 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 # Pinning it to a working version until the upstream Oryx repo updates the dependency
# install_dotnet_using_apt # install_dotnet_using_apt
PINNED_SDK_VERSION="8.0.101" PINNED_SDK_VERSION="8.0.202"
install_dotnet_with_script ${PINNED_SDK_VERSION} 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
fi fi
BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen
...@@ -192,8 +190,8 @@ echo "Building solution '$SOLUTION_FILE_NAME'..." ...@@ -192,8 +190,8 @@ echo "Building solution '$SOLUTION_FILE_NAME'..."
cd $GIT_ORYX cd $GIT_ORYX
${DOTNET_BINARY} build "$SOLUTION_FILE_NAME" -c Debug ${DOTNET_BINARY} build "$SOLUTION_FILE_NAME" -c Debug
${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj ${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj --self-contained true
${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildServer/BuildServer.csproj ${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildServer/BuildServer.csproj --self-contained true
chmod a+x ${BUILD_SCRIPT_GENERATOR}/GenerateBuildScript chmod a+x ${BUILD_SCRIPT_GENERATOR}/GenerateBuildScript
...@@ -236,12 +234,15 @@ fi ...@@ -236,12 +234,15 @@ fi
if [[ "${PINNED_SDK_VERSION}" != "" ]]; then if [[ "${PINNED_SDK_VERSION}" != "" ]]; then
rm -f ${GIT_ORYX}/global.json rm -f ${GIT_ORYX}/global.json
rm -rf /usr/share/dotnet/sdk/$PINNED_SDK_VERSION rm -rf /usr/share/dotnet/sdk/$PINNED_SDK_VERSION
NEW_RUNTIME_VERSIONS=$(dotnet --list-runtimes | awk '{print $2}' | sort | uniq)
# Extract the major, minor version and the first digit of the patch version if [ -n "${RUNTIME_VERSIONS:-}" ]; then
MAJOR_MINOR_PATCH1_VERSION=${PINNED_SDK_VERSION%??} SDK_INSTALLED_RUNTIME=$(echo "$NEW_RUNTIME_VERSIONS" | grep -vxFf <(echo "$RUNTIME_VERSIONS"))
rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$MAJOR_MINOR_PATCH1_VERSION else
rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$MAJOR_MINOR_PATCH1_VERSION SDK_INSTALLED_RUNTIME="$NEW_RUNTIME_VERSIONS"
rm -rf /usr/share/dotnet/templates/$MAJOR_MINOR_PATCH1_VERSION fi
rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$SDK_INSTALLED_RUNTIME
rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$SDK_INSTALLED_RUNTIME
rm -rf /usr/share/dotnet/templates/$SDK_INSTALLED_RUNTIME
fi fi
......
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