Skip to content

Commit f8e7e27

Browse files
authored
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
1 parent 9a46394 commit f8e7e27

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/oryx/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "oryx",
3-
"version": "1.3.6",
3+
"version": "1.3.7",
44
"name": "Oryx",
55
"description": "Installs the oryx CLI",
66
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx",

src/oryx/install.sh

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,25 @@ DOTNET_BINARY=""
149149

150150
if dotnet --version > /dev/null ; then
151151
DOTNET_BINARY=$(which dotnet)
152+
RUNTIME_VERSIONS=$(dotnet --list-runtimes | awk '{print $2}' | sort | uniq)
152153
fi
153154

154155
MAJOR_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 1)
155156
PATCH_VERSION_ID=$(echo $(dotnet --version) | cut -d . -f 3)
156157

157158
PINNED_SDK_VERSION=""
158159
# Oryx needs to be built with .NET 8
159-
if [[ "${DOTNET_BINARY}" = "" ]] || [[ $MAJOR_VERSION_ID != "8" ]] || [[ $MAJOR_VERSION_ID = "8" && ${PATCH_VERSION_ID} -ge "101" ]] ; then
160+
if [[ "${DOTNET_BINARY}" = "" ]] || [[ $MAJOR_VERSION_ID != "8" ]] || [[ $MAJOR_VERSION_ID = "8" && ${PATCH_VERSION_ID} -ne "202" ]] ; then
160161
echo "'dotnet 8' was not detected. Attempting to install .NET 8 to build oryx."
161-
162162
# The oryx build fails with .Net 8.0.201, see https://github.com/devcontainers/images/issues/974
163163
# Pinning it to a working version until the upstream Oryx repo updates the dependency
164164
# install_dotnet_using_apt
165-
PINNED_SDK_VERSION="8.0.101"
165+
PINNED_SDK_VERSION="8.0.202"
166166
install_dotnet_with_script ${PINNED_SDK_VERSION}
167-
168167
if ! dotnet --version > /dev/null ; then
169168
echo "(!) Please install Dotnet before installing Oryx"
170169
exit 1
171170
fi
172-
173171
fi
174172

175173
BUILD_SCRIPT_GENERATOR=/usr/local/buildscriptgen
@@ -192,8 +190,8 @@ echo "Building solution '$SOLUTION_FILE_NAME'..."
192190
cd $GIT_ORYX
193191
${DOTNET_BINARY} build "$SOLUTION_FILE_NAME" -c Debug
194192

195-
${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj
196-
${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildServer/BuildServer.csproj
193+
${DOTNET_BINARY} publish -property:ValidateExecutableReferencesMatchSelfContained=false -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildScriptGeneratorCli/BuildScriptGeneratorCli.csproj --self-contained true
194+
${DOTNET_BINARY} publish -r linux-x64 -o ${BUILD_SCRIPT_GENERATOR} -c Release $GIT_ORYX/src/BuildServer/BuildServer.csproj --self-contained true
197195

198196
chmod a+x ${BUILD_SCRIPT_GENERATOR}/GenerateBuildScript
199197

@@ -236,16 +234,19 @@ fi
236234
if [[ "${PINNED_SDK_VERSION}" != "" ]]; then
237235
rm -f ${GIT_ORYX}/global.json
238236
rm -rf /usr/share/dotnet/sdk/$PINNED_SDK_VERSION
239-
240-
# Extract the major, minor version and the first digit of the patch version
241-
MAJOR_MINOR_PATCH1_VERSION=${PINNED_SDK_VERSION%??}
242-
rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$MAJOR_MINOR_PATCH1_VERSION
243-
rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$MAJOR_MINOR_PATCH1_VERSION
244-
rm -rf /usr/share/dotnet/templates/$MAJOR_MINOR_PATCH1_VERSION
237+
NEW_RUNTIME_VERSIONS=$(dotnet --list-runtimes | awk '{print $2}' | sort | uniq)
238+
if [ -n "${RUNTIME_VERSIONS:-}" ]; then
239+
SDK_INSTALLED_RUNTIME=$(echo "$NEW_RUNTIME_VERSIONS" | grep -vxFf <(echo "$RUNTIME_VERSIONS"))
240+
else
241+
SDK_INSTALLED_RUNTIME="$NEW_RUNTIME_VERSIONS"
242+
fi
243+
rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$SDK_INSTALLED_RUNTIME
244+
rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$SDK_INSTALLED_RUNTIME
245+
rm -rf /usr/share/dotnet/templates/$SDK_INSTALLED_RUNTIME
245246
fi
246247

247248

248249
# Clean up
249250
rm -rf /var/lib/apt/lists/*
250251

251-
echo "Done!"
252+
echo "Done!"

0 commit comments

Comments
 (0)