|
25 | 25 | - run: make release-github |
26 | 26 | env: |
27 | 27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + # Build a GLIBC 2.28-compatible RPM for RHEL 8 / EL8 customers. |
| 29 | + # The main goreleaser job builds inside goreleaser-cross (Ubuntu 24.04, |
| 30 | + # GLIBC 2.39) which produces binaries incompatible with RHEL 8. |
| 31 | + # This job compiles inside Rocky Linux 8 (GLIBC 2.28) to guarantee |
| 32 | + # compatibility. See: SECENG-13556, ESCALATION-2261 |
| 33 | + build-el8-rpm: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + needs: goreleaser # release must exist before we can upload assets |
| 36 | + container: |
| 37 | + image: rockylinux:8 |
| 38 | + steps: |
| 39 | + - name: Install system dependencies |
| 40 | + run: | |
| 41 | + dnf install -y gcc make libtool-ltdl-devel git findutils |
| 42 | +
|
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v6 |
| 45 | + with: |
| 46 | + fetch-depth: 0 |
| 47 | + |
| 48 | + - name: Fix git ownership |
| 49 | + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 50 | + |
| 51 | + - name: Install Go 1.24.1 |
| 52 | + run: | |
| 53 | + curl -sL https://go.dev/dl/go1.24.1.linux-amd64.tar.gz -o /tmp/go.tar.gz |
| 54 | + tar -C /usr/local -xzf /tmp/go.tar.gz |
| 55 | + rm /tmp/go.tar.gz |
| 56 | + # Make Go available for subsequent steps |
| 57 | + ln -s /usr/local/go/bin/go /usr/local/bin/go |
| 58 | + ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt |
| 59 | + go version |
| 60 | +
|
| 61 | + - name: Build gokeyless binary |
| 62 | + run: make build/usr/bin/gokeyless |
| 63 | + |
| 64 | + - name: Verify GLIBC compatibility |
| 65 | + run: | |
| 66 | + # Ensure the binary does not require GLIBC newer than 2.28 |
| 67 | + objdump -T build/usr/bin/gokeyless | grep -oP 'GLIBC_\d+\.\d+' | sort -uV | tail -1 |
| 68 | + MAX_GLIBC=$(objdump -T build/usr/bin/gokeyless | grep -oP 'GLIBC_\d+\.\d+' | sort -uV | tail -1) |
| 69 | + echo "Maximum GLIBC version required: $MAX_GLIBC" |
| 70 | + # Extract version number and compare |
| 71 | + MAX_VER=$(echo "$MAX_GLIBC" | grep -oP '\d+\.\d+') |
| 72 | + if [ "$(printf '%s\n' "2.28" "$MAX_VER" | sort -V | tail -1)" != "2.28" ]; then |
| 73 | + echo "ERROR: Binary requires $MAX_GLIBC which is newer than GLIBC 2.28 (RHEL 8)" |
| 74 | + exit 1 |
| 75 | + fi |
| 76 | + echo "OK: Binary is compatible with RHEL 8 (GLIBC 2.28)" |
| 77 | +
|
| 78 | + - name: Install nfpm |
| 79 | + run: | |
| 80 | + curl -sL https://github.com/goreleaser/nfpm/releases/download/v2.46.3/nfpm_2.46.3_Linux_x86_64.tar.gz -o /tmp/nfpm.tar.gz |
| 81 | + tar -C /usr/local/bin -xzf /tmp/nfpm.tar.gz nfpm |
| 82 | + rm /tmp/nfpm.tar.gz |
| 83 | +
|
| 84 | + - name: Determine version |
| 85 | + id: version |
| 86 | + run: | |
| 87 | + # Strip leading 'v' from the tag to get the version number |
| 88 | + VERSION="${GITHUB_REF_NAME#v}" |
| 89 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 90 | +
|
| 91 | + - name: Build el8 RPM |
| 92 | + run: | |
| 93 | + nfpm package \ |
| 94 | + --config nfpm-el8.yml \ |
| 95 | + --packager rpm \ |
| 96 | + --target "gokeyless-${VERSION}-1.el8.x86_64.rpm" |
| 97 | + env: |
| 98 | + VERSION: ${{ steps.version.outputs.version }} |
| 99 | + |
| 100 | + - name: Upload RPM to GitHub release |
| 101 | + run: | |
| 102 | + # Install gh CLI |
| 103 | + dnf install -y 'dnf-command(config-manager)' |
| 104 | + dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo |
| 105 | + dnf install -y gh |
| 106 | + # Upload the el8 RPM as a release asset |
| 107 | + gh release upload "$GITHUB_REF_NAME" gokeyless-*.el8.x86_64.rpm --clobber |
| 108 | + env: |
| 109 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 110 | + |
28 | 111 | build-and-push-image: |
29 | 112 | runs-on: ubuntu-latest |
30 | 113 | permissions: |
|
0 commit comments