diff --git a/src/microsoft-git/NOTES.md b/src/microsoft-git/NOTES.md index 54b0549..dfaf7b3 100644 --- a/src/microsoft-git/NOTES.md +++ b/src/microsoft-git/NOTES.md @@ -4,4 +4,10 @@ Scalar and support for GVFS protocol. ## OS Support -This feature is tested on base images for Debian/Ubuntu and Mariner-CBL 2.0 \ No newline at end of file +This feature is tested on base images for Debian/Ubuntu and Mariner-CBL 2.0 + +On Debian/Ubuntu, the installer supports current +`microsoft-git__linux_.deb` release assets and older +`microsoft-git__.deb` assets. Legacy +`microsoft-git_.deb` assets are supported on amd64 only; they are not +architecture-independent packages. diff --git a/src/microsoft-git/devcontainer-feature.json b/src/microsoft-git/devcontainer-feature.json index ff77ebd..15ecab9 100644 --- a/src/microsoft-git/devcontainer-feature.json +++ b/src/microsoft-git/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "Microsoft Git for monorepo with GVFS support", "id": "microsoft-git", - "version": "1.0.10", + "version": "1.0.11", "description": "A fork of Git containing Microsoft-specific patches", "options": { "version": { diff --git a/src/microsoft-git/install.sh b/src/microsoft-git/install.sh index 1adee9a..917172c 100755 --- a/src/microsoft-git/install.sh +++ b/src/microsoft-git/install.sh @@ -72,7 +72,7 @@ echo "Downloading Microsoft Git ${GIT_VERSION}..." if command -v tdnf >/dev/null 2>&1; then # We need to build Git from source release on Mariner - tdnf install -y wget tar git pcre2 binutils build-essential openssl-devel expat-devel curl-devel python3-devel gettext asciidoc xmlto cronie + tdnf install -y wget tar git pcre2 binutils build-essential rust openssl-devel expat-devel curl-devel python3-devel gettext asciidoc xmlto cronie wget -q https://github.com/microsoft/git/archive/refs/tags/v${GIT_VERSION}.tar.gz tar xvf v${GIT_VERSION}.tar.gz -C /usr rm v${GIT_VERSION}.tar.gz @@ -87,21 +87,32 @@ fi # Install for Debian/Ubuntu check_packages wget git -# Detect host architecture for arch-specific .deb packages (added in v2.52.0.vfs.0.5+) +# Support current Linux names, older arch-specific names, and legacy amd64 packages. ARCH="$(dpkg --print-architecture)" -DEB_URL="https://github.com/microsoft/git/releases/download/v${GIT_VERSION}/microsoft-git_${GIT_VERSION}_${ARCH}.deb" -DEB_FILE="microsoft-git_${GIT_VERSION}_${ARCH}.deb" - -# Try arch-specific .deb first, fall back to legacy amd64 .deb for older releases -if ! wget -q "${DEB_URL}" -O "${DEB_FILE}" 2>/dev/null; then - if [ "${ARCH}" != "amd64" ]; then - echo "Could not download Microsoft Git ${GIT_VERSION} package for architecture ${ARCH}." >&2 - echo "Older Microsoft Git releases only published legacy amd64 Debian package assets." >&2 - exit 1 +DEB_FILES=( + "microsoft-git_${GIT_VERSION}_linux_${ARCH}.deb" + "microsoft-git_${GIT_VERSION}_${ARCH}.deb" +) +if [ "${ARCH}" = "amd64" ]; then + DEB_FILES+=("microsoft-git_${GIT_VERSION}.deb") +fi + +DEB_FILE="" +for candidate in "${DEB_FILES[@]}"; do + DEB_URL="https://github.com/microsoft/git/releases/download/v${GIT_VERSION}/${candidate}" + echo "Trying ${DEB_URL}..." + if wget -q "${DEB_URL}" -O "${candidate}" 2>/dev/null; then + DEB_FILE="${candidate}" + break fi - DEB_URL="https://github.com/microsoft/git/releases/download/v${GIT_VERSION}/microsoft-git_${GIT_VERSION}.deb" - DEB_FILE="microsoft-git_${GIT_VERSION}.deb" - wget -q "${DEB_URL}" -O "${DEB_FILE}" + rm -f "${candidate}" +done + +if [ -z "${DEB_FILE}" ]; then + echo "Could not download Microsoft Git ${GIT_VERSION} package for architecture ${ARCH}." >&2 + echo "Attempted Debian package assets: ${DEB_FILES[*]}" >&2 + echo "Legacy packages without an architecture suffix are only supported on amd64." >&2 + exit 1 fi dpkg -i "${DEB_FILE}" diff --git a/test/microsoft-git/linux_named_deb.sh b/test/microsoft-git/linux_named_deb.sh new file mode 100755 index 0000000..c3d82a9 --- /dev/null +++ b/test/microsoft-git/linux_named_deb.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +source dev-container-features-test-lib + +check "git version" test "$(git --version)" = "git version 2.56.0.vfs.0.2" +check "scalar available" bash -c "command -v scalar && scalar version" + +reportResults diff --git a/test/microsoft-git/old_arch_deb.sh b/test/microsoft-git/old_arch_deb.sh new file mode 100755 index 0000000..15a5f36 --- /dev/null +++ b/test/microsoft-git/old_arch_deb.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +source dev-container-features-test-lib + +check "git version" test "$(git --version)" = "git version 2.55.0.vfs.0.10" +check "scalar available" bash -c "command -v scalar && scalar version" + +reportResults diff --git a/test/microsoft-git/scenarios.json b/test/microsoft-git/scenarios.json index c7cfe46..6716f4f 100644 --- a/test/microsoft-git/scenarios.json +++ b/test/microsoft-git/scenarios.json @@ -1,4 +1,20 @@ { + "linux_named_deb": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu24.04", + "features": { + "microsoft-git": { + "version": "2.56.0.vfs.0.2" + } + } + }, + "old_arch_deb": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu24.04", + "features": { + "microsoft-git": { + "version": "2.55.0.vfs.0.10" + } + } + }, "latest_stable": { "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": {