From c072f470c37da7a9fcaf52c2d29a0e228123ee1e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 19:14:32 +0000 Subject: [PATCH 1/7] Initial plan From 7e1dda5f0dab95fb3daf835927079b4cd465a4d5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 19:16:16 +0000 Subject: [PATCH 2/7] Add RHEL8 support with multi-distro package manager detection Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com> --- README.md | 8 ++++++- action.yml | 65 +++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 8708295..b5b1d38 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ This GitHub Action installs [buildcache](https://gitlab.com/bits-n-bites/buildca ## Features - ๐Ÿš€ Supports both Linux and Windows runners +- ๐Ÿง Multi-distro Linux support (Ubuntu, Debian, RHEL, CentOS, Rocky Linux, AlmaLinux, Fedora) - ๐Ÿ”ง Optional version specification (uses latest by default) - โœ… Automatically adds buildcache to PATH - ๐Ÿงน Cleans up temporary files after installation @@ -69,9 +70,14 @@ jobs: ## Supported Platforms -- โœ… Linux (ubuntu-latest, ubuntu-22.04, ubuntu-20.04) +- โœ… Linux (ubuntu-latest, ubuntu-22.04, ubuntu-20.04, RHEL 8, CentOS 8, Rocky Linux 8, AlmaLinux 8) - โœ… Windows (windows-latest, windows-2022, windows-2019) +The action automatically detects the Linux distribution and uses the appropriate package manager: +- **Debian-based systems** (Ubuntu, Debian): Uses `apt-get` to install `libssl1.1` +- **RHEL-based systems** (RHEL, CentOS, Rocky Linux, AlmaLinux): Uses `dnf`/`yum` to install `openssl-libs` and `compat-openssl11` if needed +- **Fedora**: Uses `dnf` to install `openssl-libs` + ## Download URL Compatibility The action automatically handles different download URL formats based on the buildcache version: diff --git a/action.yml b/action.yml index 25a4278..d7422e8 100644 --- a/action.yml +++ b/action.yml @@ -42,18 +42,63 @@ runs: VERSION="${{ steps.version.outputs.version }}" echo "Installing buildcache $VERSION for Linux..." - # Install required dependencies - echo "Installing required dependencies..." - sudo apt-get update -qq - # Install OpenSSL 1.1 libraries (buildcache requires libcrypto.so.1.1) - if ! sudo apt-get install -y libssl1.1; then - echo "libssl1.1 not available in default repos, adding focal repo for compatibility..." - echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 - sudo apt-get update -qq - sudo apt-get install -y libssl1.1 + # Detect Linux distribution + if [ -f /etc/os-release ]; then + . /etc/os-release + DISTRO_ID=$ID + echo "Detected Linux distribution: $NAME ($DISTRO_ID)" + else + echo "Warning: Cannot detect distribution, assuming Debian-based" + DISTRO_ID="debian" fi + # Install required dependencies based on distribution + echo "Installing required dependencies..." + case "$DISTRO_ID" in + ubuntu|debian) + # Debian-based systems + sudo apt-get update -qq + # Install OpenSSL 1.1 libraries (buildcache requires libcrypto.so.1.1) + if ! sudo apt-get install -y libssl1.1; then + echo "libssl1.1 not available in default repos, adding focal repo for compatibility..." + echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 + sudo apt-get update -qq + sudo apt-get install -y libssl1.1 + fi + ;; + rhel|centos|rocky|almalinux) + # RHEL-based systems (RHEL 8, CentOS 8, Rocky Linux 8, AlmaLinux 8) + # Check if dnf is available (RHEL 8+), otherwise use yum + if command -v dnf &> /dev/null; then + PKG_MGR="dnf" + else + PKG_MGR="yum" + fi + echo "Using package manager: $PKG_MGR" + + # Install OpenSSL libraries (buildcache requires OpenSSL 1.1) + sudo $PKG_MGR install -y openssl-libs || true + + # For RHEL 8, we may need compat-openssl11 package for older buildcache versions + if ! ldconfig -p | grep -q libcrypto.so.1.1; then + echo "OpenSSL 1.1 not found, trying to install compat-openssl11..." + if ! sudo $PKG_MGR install -y compat-openssl11; then + echo "Warning: compat-openssl11 not available. Buildcache may require OpenSSL 1.1 compatibility libraries." + echo "You may need to enable PowerTools/CodeReady repository or install OpenSSL 1.1 manually." + fi + fi + ;; + fedora) + # Fedora systems + sudo dnf install -y openssl-libs + ;; + *) + echo "Warning: Unsupported distribution '$DISTRO_ID'. Attempting to continue without dependency installation." + echo "Buildcache may require OpenSSL 1.1 libraries to be installed manually." + ;; + esac + # Determine download URL based on version # v0.31.4+ uses buildcache-linux-amd64.tar.gz # v0.31.3 and earlier use buildcache-linux.tar.gz From fb51c30172e281e07bbde91b0e6776f34b09e9e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 19:17:40 +0000 Subject: [PATCH 3/7] Update documentation for RHEL8 support and troubleshooting Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com> --- CLAUDE.md | 20 +++++++++++++++++++- README.md | 15 ++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5556993..9b4cb42 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,11 +5,29 @@ This is a GitHub Action that installs [buildcache](https://gitlab.com/bits-n-bit ## Project Overview **Purpose**: Automated installation of buildcache (a compilation caching tool) in GitHub Actions workflows -**Platforms**: Linux (Ubuntu) and Windows +**Platforms**: Linux (Ubuntu, Debian, RHEL, CentOS, Rocky Linux, AlmaLinux, Fedora) and Windows **Language**: GitHub Actions YAML with Bash and PowerShell scripts ## Key Architecture +### Multi-Distribution Linux Support +The action automatically detects the Linux distribution and uses the appropriate package manager: + +**Distribution Detection:** +- Uses `/etc/os-release` to identify the distribution +- Falls back to Debian-based behavior if detection fails + +**Package Management:** +- **Debian-based** (Ubuntu, Debian): Uses `apt-get` to install `libssl1.1` +- **RHEL-based** (RHEL 8, CentOS 8, Rocky Linux 8, AlmaLinux 8): Uses `dnf`/`yum` to install `openssl-libs` and `compat-openssl11` +- **Fedora**: Uses `dnf` to install `openssl-libs` +- **Unsupported**: Continues without dependency installation with a warning + +**OpenSSL Requirements:** +- buildcache requires OpenSSL 1.1 libraries (libcrypto.so.1.1) +- Ubuntu 24.04+ requires adding focal repository for libssl1.1 +- RHEL 8 requires `compat-openssl11` package from PowerTools/CodeReady repository + ### Download URL Handling The action intelligently handles different download URL formats based on buildcache version: diff --git a/README.md b/README.md index b5b1d38..79b0ef5 100644 --- a/README.md +++ b/README.md @@ -159,9 +159,22 @@ buildcache version 0.28.1 If you specify a version that doesn't exist, the action will fail. Check the [releases page](https://gitlab.com/bits-n-bites/buildcache/-/releases) for available versions. +### OpenSSL libraries on RHEL 8 + +On RHEL 8 systems, buildcache requires OpenSSL 1.1 compatibility libraries. The action will automatically attempt to install `compat-openssl11`. If this fails, you may need to enable the PowerTools (RHEL 8) or CodeReady Builder (CentOS 8) repository: + +```bash +# RHEL 8 +sudo subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms + +# CentOS 8 / Rocky Linux 8 / AlmaLinux 8 +sudo dnf config-manager --set-enabled powertools # CentOS 8 +sudo dnf config-manager --set-enabled PowerTools # Rocky/Alma Linux 8 +``` + ### Permission errors on Linux -The action uses `sudo` to install buildcache to `/usr/local/bin` on Linux. This should work on GitHub-hosted runners by default. +The action uses `sudo` to install dependencies on Linux. This should work on GitHub-hosted runners by default. ## Testing From 8810e69793407908371ae1f584c7948c496a3a78 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 19:19:32 +0000 Subject: [PATCH 4/7] Fix: Rename VERSION to BUILDCACHE_VERSION to avoid conflict with os-release Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com> --- action.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/action.yml b/action.yml index d7422e8..bbcc8eb 100644 --- a/action.yml +++ b/action.yml @@ -39,14 +39,15 @@ runs: if: runner.os == 'Linux' shell: bash run: | - VERSION="${{ steps.version.outputs.version }}" - echo "Installing buildcache $VERSION for Linux..." + BUILDCACHE_VERSION="${{ steps.version.outputs.version }}" + echo "Installing buildcache $BUILDCACHE_VERSION for Linux..." # Detect Linux distribution if [ -f /etc/os-release ]; then . /etc/os-release DISTRO_ID=$ID - echo "Detected Linux distribution: $NAME ($DISTRO_ID)" + DISTRO_NAME=$NAME + echo "Detected Linux distribution: $DISTRO_NAME ($DISTRO_ID)" else echo "Warning: Cannot detect distribution, assuming Debian-based" DISTRO_ID="debian" @@ -102,34 +103,34 @@ runs: # Determine download URL based on version # v0.31.4+ uses buildcache-linux-amd64.tar.gz # v0.31.3 and earlier use buildcache-linux.tar.gz - VERSION_NUM=${VERSION#v} + VERSION_NUM=${BUILDCACHE_VERSION#v} MAJOR=$(echo $VERSION_NUM | cut -d. -f1) MINOR=$(echo $VERSION_NUM | cut -d. -f2) PATCH=$(echo $VERSION_NUM | cut -d. -f3) if [[ $MAJOR -eq 0 && $MINOR -lt 30 ]]; then # v0.29.x and earlier use GitLab package registry - DOWNLOAD_URL="https://gitlab.com/api/v4/projects/49153623/packages/generic/releases/$VERSION/buildcache-linux.tar.gz" - echo "Using package registry URL for $VERSION (โ‰คv0.29.x)" + DOWNLOAD_URL="https://gitlab.com/api/v4/projects/49153623/packages/generic/releases/$BUILDCACHE_VERSION/buildcache-linux.tar.gz" + echo "Using package registry URL for $BUILDCACHE_VERSION (โ‰คv0.29.x)" elif [[ $MAJOR -gt 0 ]] || [[ $MAJOR -eq 0 && $MINOR -gt 31 ]] || [[ $MAJOR -eq 0 && $MINOR -eq 31 && $PATCH -ge 4 ]]; then # v0.31.4+ uses buildcache-linux-amd64.tar.gz - DOWNLOAD_URL="https://gitlab.com/bits-n-bites/buildcache/-/releases/$VERSION/downloads/buildcache-linux-amd64.tar.gz" - echo "Using new URL format for $VERSION (v0.31.4+)" + DOWNLOAD_URL="https://gitlab.com/bits-n-bites/buildcache/-/releases/$BUILDCACHE_VERSION/downloads/buildcache-linux-amd64.tar.gz" + echo "Using new URL format for $BUILDCACHE_VERSION (v0.31.4+)" else # v0.30.0 to v0.31.3 use buildcache-linux.tar.gz - DOWNLOAD_URL="https://gitlab.com/bits-n-bites/buildcache/-/releases/$VERSION/downloads/buildcache-linux.tar.gz" - echo "Using legacy URL format for $VERSION (v0.30.0-v0.31.3)" + DOWNLOAD_URL="https://gitlab.com/bits-n-bites/buildcache/-/releases/$BUILDCACHE_VERSION/downloads/buildcache-linux.tar.gz" + echo "Using legacy URL format for $BUILDCACHE_VERSION (v0.30.0-v0.31.3)" fi # Download with error handling if ! curl -L "$DOWNLOAD_URL" -o buildcache.tar.gz --fail; then - echo "Error: Failed to download buildcache $VERSION. Please check if this version exists." + echo "Error: Failed to download buildcache $BUILDCACHE_VERSION. Please check if this version exists." echo "Available releases: https://gitlab.com/bits-n-bites/buildcache/-/releases" exit 1 fi # Create installation directory - INSTALL_DIR="$HOME/.local/buildcache-$VERSION" + INSTALL_DIR="$HOME/.local/buildcache-$BUILDCACHE_VERSION" mkdir -p "$INSTALL_DIR" # Extract with error handling @@ -174,7 +175,7 @@ runs: # Show where buildcache was installed INSTALLED_PATH=$(which buildcache) - echo "buildcache $VERSION installed successfully on Linux" + echo "buildcache $BUILDCACHE_VERSION installed successfully on Linux" echo "Binary location: $INSTALLED_PATH" echo "Installation directory: $BINARY_PATH" From 5af497d06ad01e1b1561c72620b7b7f9983dcad4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 19:21:29 +0000 Subject: [PATCH 5/7] Improve OpenSSL library detection using find instead of ldconfig Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com> --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index bbcc8eb..dd06a44 100644 --- a/action.yml +++ b/action.yml @@ -82,7 +82,8 @@ runs: sudo $PKG_MGR install -y openssl-libs || true # For RHEL 8, we may need compat-openssl11 package for older buildcache versions - if ! ldconfig -p | grep -q libcrypto.so.1.1; then + # Check if OpenSSL 1.1 libraries are available + if ! find /usr/lib* /lib* -name 'libcrypto.so.1.1' 2>/dev/null | grep -q .; then echo "OpenSSL 1.1 not found, trying to install compat-openssl11..." if ! sudo $PKG_MGR install -y compat-openssl11; then echo "Warning: compat-openssl11 not available. Buildcache may require OpenSSL 1.1 compatibility libraries." From cc5b361e46aeee03cfa929860a1251f2bb19e40b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 19:22:25 +0000 Subject: [PATCH 6/7] Refine OpenSSL detection and repository instructions Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com> --- action.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index dd06a44..5cfb6e8 100644 --- a/action.yml +++ b/action.yml @@ -83,11 +83,14 @@ runs: # For RHEL 8, we may need compat-openssl11 package for older buildcache versions # Check if OpenSSL 1.1 libraries are available - if ! find /usr/lib* /lib* -name 'libcrypto.so.1.1' 2>/dev/null | grep -q .; then + if ! find /usr/lib /usr/lib64 /lib /lib64 -name 'libcrypto.so.1.1' 2>/dev/null | grep -q .; then echo "OpenSSL 1.1 not found, trying to install compat-openssl11..." if ! sudo $PKG_MGR install -y compat-openssl11; then echo "Warning: compat-openssl11 not available. Buildcache may require OpenSSL 1.1 compatibility libraries." - echo "You may need to enable PowerTools/CodeReady repository or install OpenSSL 1.1 manually." + echo "Enable the appropriate repository:" + echo " RHEL 8: sudo subscription-manager repos --enable codeready-builder-for-rhel-8-\$(arch)-rpms" + echo " CentOS 8: sudo dnf config-manager --set-enabled powertools" + echo " Rocky/AlmaLinux 8: sudo dnf config-manager --set-enabled PowerTools" fi fi ;; From 352a1f5af4e5b02aa530c83d5a677c08a0ee326d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 16 Feb 2026 08:09:47 +0100 Subject: [PATCH 7/7] Add RHEL8 compatibility test using Rocky Linux 8 container --- .github/workflows/test.yml | 51 +++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 05ac2b2..d7c9a64 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -279,9 +279,52 @@ jobs: echo "Latest version from API: $LATEST_VERSION" echo "โœ… jq parsing works correctly" + test-rhel8: + name: Test RHEL8 compatibility + runs-on: ubuntu-latest + container: + image: rockylinux:8 + steps: + - name: Install required tools + run: | + dnf install -y git curl jq tar gzip findutils which + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Test setup buildcache on RHEL8 + uses: ./ + + - name: Verify buildcache is in PATH + shell: bash + run: | + if ! command -v buildcache &> /dev/null; then + echo "Error: buildcache not found in PATH" + exit 1 + fi + echo "buildcache found in PATH" + + - name: Verify buildcache version + shell: bash + run: | + VERSION=$(buildcache --version) + echo "Installed version: $VERSION" + if [[ ! "$VERSION" =~ BuildCache.*version.*[0-9]+\.[0-9]+\.[0-9]+ ]]; then + echo "Error: Invalid version format: $VERSION" + exit 1 + fi + echo "Version format is valid" + + - name: Test buildcache basic functionality + shell: bash + run: | + buildcache -s + buildcache -z + echo "Basic buildcache commands work on RHEL8" + test-summary: name: Test Summary - needs: [test-latest-version, test-specific-version, test-invalid-version, test-installation-paths, test-multiple-installations, test-url-formats, test-api-availability] + needs: [test-latest-version, test-specific-version, test-invalid-version, test-installation-paths, test-multiple-installations, test-url-formats, test-api-availability, test-rhel8] runs-on: ubuntu-latest if: always() steps: @@ -293,7 +336,8 @@ jobs: [[ "${{ needs.test-installation-paths.result }}" != "success" ]] || \ [[ "${{ needs.test-multiple-installations.result }}" != "success" ]] || \ [[ "${{ needs.test-url-formats.result }}" != "success" ]] || \ - [[ "${{ needs.test-api-availability.result }}" != "success" ]]; then + [[ "${{ needs.test-api-availability.result }}" != "success" ]] || \ + [[ "${{ needs.test-rhel8.result }}" != "success" ]]; then echo "โŒ Some tests failed" exit 1 fi @@ -310,4 +354,5 @@ jobs: echo "| Installation Paths | ${{ needs.test-installation-paths.result == 'success' && 'โœ… PASS' || 'โŒ FAIL' }} |" >> $GITHUB_STEP_SUMMARY echo "| Multiple Installations | ${{ needs.test-multiple-installations.result == 'success' && 'โœ… PASS' || 'โŒ FAIL' }} |" >> $GITHUB_STEP_SUMMARY echo "| URL Format Compatibility | ${{ needs.test-url-formats.result == 'success' && 'โœ… PASS' || 'โŒ FAIL' }} |" >> $GITHUB_STEP_SUMMARY - echo "| API Availability | ${{ needs.test-api-availability.result == 'success' && 'โœ… PASS' || 'โŒ FAIL' }} |" >> $GITHUB_STEP_SUMMARY \ No newline at end of file + echo "| API Availability | ${{ needs.test-api-availability.result == 'success' && 'โœ… PASS' || 'โŒ FAIL' }} |" >> $GITHUB_STEP_SUMMARY + echo "| RHEL8 Compatibility | ${{ needs.test-rhel8.result == 'success' && 'โœ… PASS' || 'โŒ FAIL' }} |" >> $GITHUB_STEP_SUMMARY \ No newline at end of file