Skip to content

[git] - Fixing issue for alpine installation from source and updating tests#1679

Merged
abdurriq merged 3 commits into
devcontainers:mainfrom
Kaniska244:git-alpine-base-issue
Jun 30, 2026
Merged

[git] - Fixing issue for alpine installation from source and updating tests#1679
abdurriq merged 3 commits into
devcontainers:mainfrom
Kaniska244:git-alpine-base-issue

Conversation

@Kaniska244

@Kaniska244 Kaniska244 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes CI failure. This PR fixes a build failure when installing Git from source on Alpine by adding the missing linux-headers dependency, and hardens the install script to fail loudly if the build doesn't succeed (instead of silently reporting "Done!"). It also overhauls the git feature's test matrix — adding a "version-is-latest" assertion, replacing the obsolete CentOS 7 test with Debian Bookworm/Trixie scenarios, and bumping the feature version to 1.3.7.

Key changes

1. The core fix — src/git/install.sh

  • Adds linux-headers to the Alpine build dependencies (the missing package that caused the source build to fail).
  • Adds make to the RHEL dependency list.
  • Captures the make build result and exits with an error + message if the build fails, rather than always printing Done!:
make -s "${git_options[@]}" all && make -s "${git_options[@]}" install 2>&1
build_result=$?
rm -rf /tmp/git-${GIT_VERSION}
clean_up
if [ "${build_result}" -ne 0 ]; then
    echo "(!) Failed to build and install git ${GIT_VERSION}." >&2
    exit 1
fi
echo "Done!"

2. Version bump — src/git/devcontainer-feature.json

  • 1.3.61.3.7.

3. Test improvements (install_git_from_src*.sh for default, alpine, noble)

  • Adds two helper functions: get_latest_git_version (queries the GitHub tags API) and check_git_is_latest_version, plus a new version-is-latest check to assert the installed Git matches the latest stable release.

4. Test scenario matrix — test/git/scenarios.json

  • Removes the obsolete install_git_from_src_centos-7 scenario (and deletes install_git_from_src_centos-7.sh).
  • Adds install_git_from_src_bookworm (debian:bookworm) and install_git_from_src_trixie (debian:trixie) scenarios, with the new test files symlinking to install_git_from_src.sh.
  • Changes the default scenario image from ubuntu:noble to ubuntu:resolute.

Test Coverage

New assertions added

  • A version-is-latest check is added to the default, alpine, and noble source-install tests. It resolves the latest stable Git tag from the GitHub API and asserts the installed binary matches:
# Resolves the latest stable git version from GitHub
get_latest_git_version() {
    curl -sSL -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/git/git/tags" \
        | grep -oP '"name":\s*"v\K[0-9]+\.[0-9]+\.[0-9]+(?=")' \
        | sort -rV \
        | head -n 1
}

# Verifies the installed git version matches the latest stable version on GitHub
check_git_is_latest_version() {
    local latest_version installed_version
    latest_version="$(get_latest_git_version)"
    installed_version="$(git --version | awk '{print $3}')"
    [ -n "$latest_version" ] && [ "$installed_version" = "$latest_version" ]
}

check "version-is-latest" check_git_is_latest_version

Scenario / platform coverage changes

Scenario Before After Change
install_git_from_src (default) ubuntu:noble ubuntu:resolute Base image updated
install_git_from_src_centos-7 centos:centos7 ❌ Removed (EOL)
install_git_from_src_bookworm debian:bookworm ✅ Added
install_git_from_src_trixie debian:trixie ✅ Added
install_git_from_src_alpine unchanged unchanged + version-is-latest check
install_git_from_src_noble unchanged unchanged + latest version check

Coverage assessment

  • Directly validates the fix path — the Alpine source-build scenario now also asserts the resulting Git version, so a broken/incomplete Alpine build would surface.
  • Modernizes the Debian matrix — Bookworm + Trixie replace EOL CentOS 7, keeping tested distros current.
  • ⚠️ Network-dependentcheck_git_is_latest_version makes an unauthenticated GitHub API call, which can hit rate limits in CI and cause flaky failures.
@Kaniska244 Kaniska244 force-pushed the git-alpine-base-issue branch from 2dc4bba to f2ed09e Compare June 30, 2026 14:57
@Kaniska244 Kaniska244 marked this pull request as ready for review June 30, 2026 15:54
@Kaniska244 Kaniska244 requested a review from a team as a code owner June 30, 2026 15:54
Comment thread test/git/install_git_from_src.sh Outdated
abdurriq
abdurriq previously approved these changes Jun 30, 2026
@abdurriq abdurriq merged commit 8431b2d into devcontainers:main Jun 30, 2026
12 checks passed
@Kaniska244 Kaniska244 deleted the git-alpine-base-issue branch June 30, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants