Skip to content
Closed
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
33 changes: 33 additions & 0 deletions src/oryx/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,39 @@ mkdir -p ${ORYX}

git clone --depth=1 https://github.com/microsoft/Oryx $GIT_ORYX

# Patch MemorySourceRepo to implement ISourceRepo.GetFileSize method
# This fixes a breaking interface change introduced in upstream Oryx
# See: https://github.com/microsoft/Oryx/commit/21c559437d69cb43fd9b34f01f68c43ea4bce318
MEMORY_SOURCE_REPO_FILE="$GIT_ORYX/tests/Detector.Tests/MemorySourceRepo.cs"
if [ -f "$MEMORY_SOURCE_REPO_FILE" ]; then
# Check if GetFileSize is already implemented
if ! grep -q "GetFileSize" "$MEMORY_SOURCE_REPO_FILE"; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Are we expecting the Oryx team to add GetFileSize implementation to their tests/Detector.Tests/MemorySourceRepo.cs ?

I think this null implementation sounds good as a temporary solution. But is the root solution not for Oryx to implement this on their side? Perhaps i'm missing something

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like they've spotted the bug and fixed this now too, so perhaps we need to pull this microsoft/Oryx#2765

echo "Patching MemorySourceRepo to add GetFileSize implementation..."
# Add GetFileSize implementation before the GetGitCommitId method
sed -i '/public string GetGitCommitId()/i\
public long? GetFileSize(params string[] paths)\
{\
var path = Path.Combine(paths);\
if (!pathsToFiles.ContainsKey(path))\
{\
return null;\
}\
var content = pathsToFiles[path];\
return content?.Length;\
}\
' "$MEMORY_SOURCE_REPO_FILE"

# Verify the patch was applied
if grep -q "GetFileSize" "$MEMORY_SOURCE_REPO_FILE"; then
echo "Successfully patched MemorySourceRepo"
else
echo "Warning: Failed to patch MemorySourceRepo - build may fail"
fi
else
echo "MemorySourceRepo already has GetFileSize implementation, skipping patch"
fi
fi

if [[ "${PINNED_SDK_VERSION}" != "" ]]; then
cd $GIT_ORYX
dotnet new globaljson --sdk-version ${PINNED_SDK_VERSION}
Expand Down