GeezerVison is showing github.com — Run the Linux artifacts on Alpine in CI · netty/netty-tcnative@fac83c8
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/ci-build.yml +73Lines changed: 73 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -142,3 +142,76 @@ jobs: | 142 | 142 | path: | | 143 | 143 | **/target/surefire-reports/ | 144 | 144 | **/hs_err*.log | | 145 | +
| | 146 | + # Same verification as ci-pr.yml, plus the gcompat variants. Those are here rather than on every | | 147 | + # PR because their job is not to pass but to make a bare failure diagnostic: if bare fails and | | 148 | + # gcompat passes, the artifact has re-acquired a dependency on the compatibility shim, which is | | 149 | + # how 2.0.65 appeared to work. This workflow also runs on the weekly schedule, which is where | | 150 | + # the extra minutes belong. See docs/musl-compatibility.md. | | 151 | + musl-verify: | | 152 | + needs: build | | 153 | + strategy: | | 154 | + fail-fast: false | | 155 | + matrix: | | 156 | + include: | | 157 | + # Both runners are pinned: there is no ubuntu-latest-arm, so pairing ubuntu-latest with | | 158 | + # a pinned arm label would drift apart as soon as ubuntu-latest moves on. | | 159 | + - setup: alpine-x86_64 | | 160 | + os: ubuntu-24.04 | | 161 | + jars: build-centos6-x86_64-jars | | 162 | + variant: bare | | 163 | + extra-pkgs: "" | | 164 | + build-service: runtime-setup | | 165 | + run-service: verify | | 166 | + - setup: alpine-aarch64 | | 167 | + os: ubuntu-24.04-arm | | 168 | + jars: build-centos7-aarch64-jars | | 169 | + variant: bare | | 170 | + extra-pkgs: "" | | 171 | + build-service: runtime-setup | | 172 | + run-service: verify | | 173 | + - setup: alpine-x86_64-gcompat | | 174 | + os: ubuntu-24.04 | | 175 | + jars: build-centos6-x86_64-jars | | 176 | + variant: gcompat | | 177 | + extra-pkgs: gcompat | | 178 | + build-service: runtime-setup | | 179 | + run-service: verify | | 180 | + - setup: alpine-aarch64-gcompat | | 181 | + os: ubuntu-24.04-arm | | 182 | + jars: build-centos7-aarch64-jars | | 183 | + variant: gcompat | | 184 | + extra-pkgs: gcompat | | 185 | + build-service: runtime-setup | | 186 | + run-service: verify | | 187 | + - setup: glibc-control-x86_64 | | 188 | + os: ubuntu-24.04 | | 189 | + jars: build-centos6-x86_64-jars | | 190 | + variant: glibc-control | | 191 | + extra-pkgs: "" | | 192 | + build-service: control-runtime-setup | | 193 | + run-service: control-verify | | 194 | + | | 195 | + runs-on: ${{ matrix.os }} | | 196 | + name: musl-verify ${{ matrix.setup }} | | 197 | + | | 198 | + steps: | | 199 | + - uses: actions/checkout@v4 | | 200 | + | | 201 | + - uses: actions/download-artifact@v4 | | 202 | + with: | | 203 | + name: ${{ matrix.jars }} | | 204 | + path: musl-verify-jars | | 205 | + | | 206 | + - name: Build verification image | | 207 | + env: | | 208 | + MUSL_VARIANT: ${{ matrix.variant }} | | 209 | + MUSL_EXTRA_PKGS: ${{ matrix.extra-pkgs }} | | 210 | + run: docker compose -f docker/docker-compose.alpine.yaml build ${{ matrix.build-service }} | | 211 | + | | 212 | + - name: Verify the artifact under ${{ matrix.variant }} | | 213 | + env: | | 214 | + MUSL_VARIANT: ${{ matrix.variant }} | | 215 | + MUSL_EXTRA_PKGS: ${{ matrix.extra-pkgs }} | | 216 | + MUSL_JARS_DIR: musl-verify-jars | | 217 | + run: docker compose -f docker/docker-compose.alpine.yaml run --rm ${{ matrix.run-service }} |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/ci-pr.yml +64Lines changed: 64 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -192,3 +192,67 @@ jobs: | 192 | 192 | path: | | 193 | 193 | **/target/surefire-reports/ | 194 | 194 | **/hs_err*.log | | 195 | +
| | 196 | + # Verify that the glibc-built Linux artifacts really load under musl. This consumes the jars | | 197 | + # the build jobs above already upload, so nothing is rebuilt. The static half of this invariant | | 198 | + # is enforced inside the build by scripts/check_musl_compat.sh; what only a real musl system can | | 199 | + # show is whether the library loads, because on aarch64 the historical failure was a JVM SIGSEGV | | 200 | + # during dlopen rather than an UnsatisfiedLinkError. See docs/musl-compatibility.md. | | 201 | + # | | 202 | + # `needs` cannot depend on a single matrix leg, so this waits for all of build-pr. | | 203 | + musl-verify: | | 204 | + needs: build-pr | | 205 | + strategy: | | 206 | + fail-fast: false | | 207 | + matrix: | | 208 | + include: | | 209 | + # Both runners are pinned: there is no ubuntu-latest-arm, so pairing ubuntu-latest with | | 210 | + # a pinned arm label would drift apart as soon as ubuntu-latest moves on. The host only | | 211 | + # supplies Docker here, so pinning costs nothing. | | 212 | + - setup: alpine-x86_64 | | 213 | + os: ubuntu-24.04 | | 214 | + jars: build-pr-centos6-x86_64-jars | | 215 | + variant: bare | | 216 | + extra-pkgs: "" | | 217 | + build-service: runtime-setup | | 218 | + run-service: verify | | 219 | + - setup: alpine-aarch64 | | 220 | + os: ubuntu-24.04-arm | | 221 | + jars: build-pr-centos7-aarch64-jars | | 222 | + variant: bare | | 223 | + extra-pkgs: "" | | 224 | + build-service: runtime-setup | | 225 | + run-service: verify | | 226 | + # Control: anything failing on Alpine must pass here, or the check is at fault rather | | 227 | + # than the artifact. | | 228 | + - setup: glibc-control-x86_64 | | 229 | + os: ubuntu-24.04 | | 230 | + jars: build-pr-centos6-x86_64-jars | | 231 | + variant: glibc-control | | 232 | + extra-pkgs: "" | | 233 | + build-service: control-runtime-setup | | 234 | + run-service: control-verify | | 235 | + | | 236 | + runs-on: ${{ matrix.os }} | | 237 | + name: musl-verify ${{ matrix.setup }} | | 238 | + | | 239 | + steps: | | 240 | + - uses: actions/checkout@v4 | | 241 | + | | 242 | + - uses: actions/download-artifact@v4 | | 243 | + with: | | 244 | + name: ${{ matrix.jars }} | | 245 | + path: musl-verify-jars | | 246 | + | | 247 | + - name: Build verification image | | 248 | + env: | | 249 | + MUSL_VARIANT: ${{ matrix.variant }} | | 250 | + MUSL_EXTRA_PKGS: ${{ matrix.extra-pkgs }} | | 251 | + run: docker compose -f docker/docker-compose.alpine.yaml build ${{ matrix.build-service }} | | 252 | + | | 253 | + - name: Verify the artifact under ${{ matrix.variant }} | | 254 | + env: | | 255 | + MUSL_VARIANT: ${{ matrix.variant }} | | 256 | + MUSL_EXTRA_PKGS: ${{ matrix.extra-pkgs }} | | 257 | + MUSL_JARS_DIR: musl-verify-jars | | 258 | + run: docker compose -f docker/docker-compose.alpine.yaml run --rm ${{ matrix.run-service }} |
Collapse file Copy file name to clipboardExpand all lines: .gitignore +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,3 +43,5 @@ cmake-* | 43 | 43 |
| 44 | 44 | # exclude file created by the flatten plugin | 45 | 45 | .flattened-pom.xml | | 46 | + | | 47 | +/musl-verify-jars/ |
Collapse file Copy file name to clipboard +27Lines changed: 27 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# Runtime image for verifying that a built Linux artifact loads under musl. | | 2 | +# | | 3 | +# This image does NOT build netty-tcnative -- it consumes an artifact built elsewhere by one of | | 4 | +# the glibc images, which is the whole point: the released jar is glibc-built and is expected to | | 5 | +# work on musl. Nothing here runs Maven, so the os.detected.classifier enforcer rules never come | | 6 | +# into play. | | 7 | +# | | 8 | +# The base is deliberately a stock JDK image with no compatibility shim: it carries musl, libgcc | | 9 | +# and libstdc++ and no gcompat or libc6-compat, so /lib/libc.so.6 does not exist. That is what | | 10 | +# "bare" below means, and invariant 1 in docs/musl-compatibility.md permits libgcc_s.so.1 | | 11 | +# precisely because Alpine's libgcc package provides it. If a future base image starts shipping | | 12 | +# gcompat, the bare variant silently stops testing anything -- verify.sh prints the installed | | 13 | +# compat packages on every run so that shows up in the log. | | 14 | +ARG jdk_image=eclipse-temurin:21-jdk-alpine | | 15 | +FROM ${jdk_image} | | 16 | + | | 17 | +# binutils for readelf/nm. It provides no libc symbols, so it cannot mask a missing one. | | 18 | +RUN apk add --no-cache binutils | | 19 | + | | 20 | +# Set per variant rather than baked in, so each package set is measured independently. | | 21 | +# Empty is the invariant; "gcompat" exists to make a bare failure diagnostic, because a fix that | | 22 | +# accidentally depends on the shim passes there and fails bare. That is exactly how 2.0.65 | | 23 | +# appeared to work. | | 24 | +ARG EXTRA_PKGS="" | | 25 | +RUN if [ -n "$EXTRA_PKGS" ]; then apk add --no-cache $EXTRA_PKGS; fi | | 26 | + | | 27 | +WORKDIR /code |
Collapse file Copy file name to clipboard +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# glibc control for the musl verification. Same verify.sh, same artifact, different libc. | | 2 | +# | | 3 | +# Its job is to tell "the library is broken on musl" apart from "the check is broken": anything | | 4 | +# that fails on Alpine must pass here, or the harness is at fault rather than the artifact. | | 5 | +ARG jdk_image=eclipse-temurin:21-jdk-jammy | | 6 | +FROM ${jdk_image} | | 7 | + | | 8 | +RUN apt-get update \ | | 9 | + && apt-get install -y --no-install-recommends binutils \ | | 10 | + && rm -rf /var/lib/apt/lists/* | | 11 | + | | 12 | +WORKDIR /code |
Collapse file Copy file name to clipboardExpand all lines: docker/README.md +36Lines changed: 36 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -41,3 +41,39 @@ docker compose -f docker/docker-compose.centos-7.yaml run cross-compile-aarch64- | 41 | 41 |
| 42 | 42 | etc, etc | 43 | 43 |
| | 44 | + | | 45 | +## Alpine/musl verification of an already-built artifact | | 46 | + | | 47 | +Unlike the images above, this one does not build netty-tcnative. It checks that a Linux artifact | | 48 | +built by one of the glibc images still loads under musl, which is the contract the released jars | | 49 | +have: there is no `-musl` classifier. Build first, then: | | 50 | + | | 51 | +``` | | 52 | +docker compose -f docker/docker-compose.alpine.yaml build runtime-setup | | 53 | +docker compose -f docker/docker-compose.alpine.yaml run --rm verify | | 54 | +``` | | 55 | + | | 56 | +`MUSL_JARS_DIR` selects where to search for the jars (default: the whole tree), so the same | | 57 | +command works against a directory of downloaded release jars. | | 58 | + | | 59 | +To confirm a fix does not secretly depend on the compatibility shim, run the same check with | | 60 | +gcompat installed. It must give the same answer as the bare run — `libc.so.6` is one of the | | 61 | +names musl's loader satisfies internally, so gcompat's `/lib/libc.so.6 -> libgcompat.so.0` | | 62 | +symlink is never read: | | 63 | + | | 64 | +``` | | 65 | +MUSL_VARIANT=gcompat MUSL_EXTRA_PKGS=gcompat \ | | 66 | + docker compose -f docker/docker-compose.alpine.yaml build runtime-setup | | 67 | +MUSL_VARIANT=gcompat MUSL_EXTRA_PKGS=gcompat \ | | 68 | + docker compose -f docker/docker-compose.alpine.yaml run --rm verify | | 69 | +``` | | 70 | + | | 71 | +The glibc control. Anything that fails on Alpine must pass here, otherwise the check is at fault | | 72 | +rather than the artifact: | | 73 | + | | 74 | +``` | | 75 | +docker compose -f docker/docker-compose.alpine.yaml build control-runtime-setup | | 76 | +docker compose -f docker/docker-compose.alpine.yaml run --rm control-verify | | 77 | +``` | | 78 | + | | 79 | +See `docs/musl-compatibility.md`. |
Collapse file Copy file name to clipboard +50Lines changed: 50 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +version: "3" | | 2 | + | | 3 | +# Verifies an already-built Linux artifact under musl. Unlike the other compose files here this | | 4 | +# one does not build netty-tcnative: it needs both the boringssl-static classifier jar and the | | 5 | +# netty-tcnative-classes jar, which live in different module target directories, so MUSL_JARS_DIR | | 6 | +# is searched recursively and defaults to the whole tree. | | 7 | +# See docker/README.md and docs/musl-compatibility.md. | | 8 | + | | 9 | +services: | | 10 | + | | 11 | + runtime-setup: | | 12 | + image: netty-tcnative-alpine:${MUSL_VARIANT:-bare} | | 13 | + build: | | 14 | + context: ../ | | 15 | + dockerfile: docker/Dockerfile.alpine | | 16 | + args: | | 17 | + EXTRA_PKGS: "${MUSL_EXTRA_PKGS:-}" | | 18 | + | | 19 | + common: &common | | 20 | + image: netty-tcnative-alpine:${MUSL_VARIANT:-bare} | | 21 | + depends_on: [runtime-setup] | | 22 | + environment: | | 23 | + - MUSL_VARIANT=${MUSL_VARIANT:-bare} | | 24 | + volumes: | | 25 | + - ..:/code:delegated | | 26 | + working_dir: /code | | 27 | + | | 28 | + verify: | | 29 | + <<: *common | | 30 | + command: /bin/sh -c "docker/musl-verify/verify.sh ${MUSL_JARS_DIR:-.}" | | 31 | + | | 32 | + shell: | | 33 | + <<: *common | | 34 | + entrypoint: /bin/sh | | 35 | + | | 36 | + control-runtime-setup: | | 37 | + image: netty-tcnative-musl-control:glibc | | 38 | + build: | | 39 | + context: ../ | | 40 | + dockerfile: docker/Dockerfile.musl-control | | 41 | + | | 42 | + control-verify: | | 43 | + image: netty-tcnative-musl-control:glibc | | 44 | + depends_on: [control-runtime-setup] | | 45 | + environment: | | 46 | + - MUSL_VARIANT=glibc-control | | 47 | + volumes: | | 48 | + - ..:/code:delegated | | 49 | + working_dir: /code | | 50 | + command: /bin/sh -c "docker/musl-verify/verify.sh ${MUSL_JARS_DIR:-.}" |
|