GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Verify the Linux artifacts on real Alpine in CI · netty/netty-tcnative@85c63c0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • ci-build.yml
    • ci-pr.yml
  • .gitignore
  • docker
    • Dockerfile.alpine
    • Dockerfile.musl-control
    • README.md
    • docker-compose.alpine.yaml
    • musl-verify
      • MuslLoadCheck.java
      • verify.sh
  • docs
    • musl-compatibility.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/ci-build.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/ci-build.yml
+102Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,105 @@ jobs:
142142
path: |
143143
**/target/surefire-reports/
144144
**/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+
drop-elftools: "1"
165+
build-service: runtime-setup
166+
run-service: verify
167+
- setup: alpine-aarch64
168+
os: ubuntu-24.04-arm
169+
jars: build-centos7-aarch64-jars
170+
variant: bare
171+
extra-pkgs: ""
172+
drop-elftools: "1"
173+
build-service: runtime-setup
174+
run-service: verify
175+
# The invariant leg: an Alpine JDK that ships no `libgcc` package of its own, so
176+
# `apk del .elftools` really does leave libgcc absent. eclipse-temurin's JDK depends on
177+
# libgcc, so the bare legs above cannot prove the artifact loads without it.
178+
- setup: alpine-x86_64-nolibgcc
179+
os: ubuntu-24.04
180+
jars: build-centos6-x86_64-jars
181+
variant: nolibgcc
182+
extra-pkgs: ""
183+
drop-elftools: "1"
184+
jdk-image: amazoncorretto:21-alpine
185+
build-service: runtime-setup
186+
run-service: verify
187+
- setup: alpine-aarch64-nolibgcc
188+
os: ubuntu-24.04-arm
189+
jars: build-centos7-aarch64-jars
190+
variant: nolibgcc
191+
extra-pkgs: ""
192+
drop-elftools: "1"
193+
jdk-image: amazoncorretto:21-alpine
194+
build-service: runtime-setup
195+
run-service: verify
196+
- setup: alpine-x86_64-gcompat
197+
os: ubuntu-24.04
198+
jars: build-centos6-x86_64-jars
199+
variant: gcompat
200+
extra-pkgs: gcompat
201+
drop-elftools: "0"
202+
build-service: runtime-setup
203+
run-service: verify
204+
- setup: alpine-aarch64-gcompat
205+
os: ubuntu-24.04-arm
206+
jars: build-centos7-aarch64-jars
207+
variant: gcompat
208+
extra-pkgs: gcompat
209+
drop-elftools: "0"
210+
build-service: runtime-setup
211+
run-service: verify
212+
- setup: glibc-control-x86_64
213+
os: ubuntu-24.04
214+
jars: build-centos6-x86_64-jars
215+
variant: glibc-control
216+
extra-pkgs: ""
217+
drop-elftools: "0"
218+
build-service: control-runtime-setup
219+
run-service: control-verify
220+
221+
runs-on: ${{ matrix.os }}
222+
name: musl-verify ${{ matrix.setup }}
223+
224+
steps:
225+
- uses: actions/checkout@v4
226+
227+
- uses: actions/download-artifact@v4
228+
with:
229+
name: ${{ matrix.jars }}
230+
path: musl-verify-jars
231+
232+
- name: Build verification image
233+
env:
234+
MUSL_VARIANT: ${{ matrix.variant }}
235+
MUSL_EXTRA_PKGS: ${{ matrix.extra-pkgs }}
236+
MUSL_JDK_IMAGE: ${{ matrix.jdk-image }}
237+
run: docker compose -f docker/docker-compose.alpine.yaml build ${{ matrix.build-service }}
238+
239+
- name: Verify the artifact under ${{ matrix.variant }}
240+
env:
241+
MUSL_VARIANT: ${{ matrix.variant }}
242+
MUSL_EXTRA_PKGS: ${{ matrix.extra-pkgs }}
243+
MUSL_DROP_ELFTOOLS: ${{ matrix.drop-elftools }}
244+
MUSL_JDK_IMAGE: ${{ matrix.jdk-image }}
245+
MUSL_JARS_DIR: musl-verify-jars
246+
run: docker compose -f docker/docker-compose.alpine.yaml run --rm ${{ matrix.run-service }}
Collapse file

‎.github/workflows/ci-pr.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/ci-pr.yml
+91Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,94 @@ jobs:
192192
path: |
193193
**/target/surefire-reports/
194194
**/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+
drop-elftools: "1"
218+
build-service: runtime-setup
219+
run-service: verify
220+
- setup: alpine-aarch64
221+
os: ubuntu-24.04-arm
222+
jars: build-pr-centos7-aarch64-jars
223+
variant: bare
224+
extra-pkgs: ""
225+
drop-elftools: "1"
226+
build-service: runtime-setup
227+
run-service: verify
228+
# The invariant leg: an Alpine JDK that ships no `libgcc` package of its own, so
229+
# `apk del .elftools` really does leave libgcc absent. eclipse-temurin's JDK depends on
230+
# libgcc, so the bare legs above cannot prove the artifact loads without it.
231+
- setup: alpine-x86_64-nolibgcc
232+
os: ubuntu-24.04
233+
jars: build-pr-centos6-x86_64-jars
234+
variant: nolibgcc
235+
extra-pkgs: ""
236+
drop-elftools: "1"
237+
jdk-image: amazoncorretto:21-alpine
238+
build-service: runtime-setup
239+
run-service: verify
240+
- setup: alpine-aarch64-nolibgcc
241+
os: ubuntu-24.04-arm
242+
jars: build-pr-centos7-aarch64-jars
243+
variant: nolibgcc
244+
extra-pkgs: ""
245+
drop-elftools: "1"
246+
jdk-image: amazoncorretto:21-alpine
247+
build-service: runtime-setup
248+
run-service: verify
249+
# Control: anything failing on Alpine must pass here, or the check is at fault rather
250+
# than the artifact.
251+
- setup: glibc-control-x86_64
252+
os: ubuntu-24.04
253+
jars: build-pr-centos6-x86_64-jars
254+
variant: glibc-control
255+
extra-pkgs: ""
256+
drop-elftools: "0"
257+
build-service: control-runtime-setup
258+
run-service: control-verify
259+
260+
runs-on: ${{ matrix.os }}
261+
name: musl-verify ${{ matrix.setup }}
262+
263+
steps:
264+
- uses: actions/checkout@v4
265+
266+
- uses: actions/download-artifact@v4
267+
with:
268+
name: ${{ matrix.jars }}
269+
path: musl-verify-jars
270+
271+
- name: Build verification image
272+
env:
273+
MUSL_VARIANT: ${{ matrix.variant }}
274+
MUSL_EXTRA_PKGS: ${{ matrix.extra-pkgs }}
275+
MUSL_JDK_IMAGE: ${{ matrix.jdk-image }}
276+
run: docker compose -f docker/docker-compose.alpine.yaml build ${{ matrix.build-service }}
277+
278+
- name: Verify the artifact under ${{ matrix.variant }}
279+
env:
280+
MUSL_VARIANT: ${{ matrix.variant }}
281+
MUSL_EXTRA_PKGS: ${{ matrix.extra-pkgs }}
282+
MUSL_DROP_ELFTOOLS: ${{ matrix.drop-elftools }}
283+
MUSL_JDK_IMAGE: ${{ matrix.jdk-image }}
284+
MUSL_JARS_DIR: musl-verify-jars
285+
run: docker compose -f docker/docker-compose.alpine.yaml run --rm ${{ matrix.run-service }}
Collapse file

‎.gitignore‎

Copy file name to clipboardExpand all lines: .gitignore
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ cmake-*
4343

4444
# exclude file created by the flatten plugin
4545
.flattened-pom.xml
46+
47+
/musl-verify-jars/
Collapse file

‎docker/Dockerfile.alpine‎

Copy file name to clipboard
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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: no gcompat and no
9+
# libc6-compat, so /lib/libc.so.6 does not exist. That is what "bare" below means. If a future base
10+
# image starts shipping gcompat, the bare variant silently stops testing anything -- verify.sh
11+
# prints the installed compat packages on every run so that shows up in the log.
12+
#
13+
# The default base does ship libgcc and libstdc++, and that is NOT representative: Alpine JDK
14+
# images differ on it (Amazon Corretto and various vendor images carry no `libgcc` package), which
15+
# is precisely how a libgcc_s.so.1 DT_NEEDED shipped unnoticed for eight releases.
16+
#
17+
# Two knobs are needed to test that honestly, because there are two ways libgcc sneaks in:
18+
# - MUSL_DROP_ELFTOOLS=1 makes verify.sh uninstall the binutils below, which depend on libgcc;
19+
# - jdk_image must name a JDK that does not itself depend on libgcc. eclipse-temurin does, so on
20+
# that base `apk del` cannot remove it and the leg proves nothing about this invariant.
21+
# amazoncorretto:21-alpine does not, and still provides javac and jar.
22+
# See docs/musl-compatibility.md §4b.
23+
ARG jdk_image=eclipse-temurin:21-jdk-alpine
24+
FROM ${jdk_image}
25+
26+
# binutils for readelf/nm. It provides no libc symbols, so it cannot mask a missing one -- but it
27+
# does pull `libgcc` in as a dependency, which would mask exactly the failure this image exists to
28+
# detect. Installed as a virtual package so verify.sh can remove it, and libgcc with it, once the
29+
# ELF inspection is done and only the runtime checks remain.
30+
RUN apk add --no-cache --virtual .elftools binutils
31+
32+
# Set per variant rather than baked in, so each package set is measured independently.
33+
# Empty is the invariant; "gcompat" exists to make a bare failure diagnostic, because a fix that
34+
# accidentally depends on the shim passes there and fails bare. That is exactly how 2.0.65
35+
# appeared to work.
36+
ARG EXTRA_PKGS=""
37+
RUN if [ -n "$EXTRA_PKGS" ]; then apk add --no-cache $EXTRA_PKGS; fi
38+
39+
WORKDIR /code
Collapse file

‎docker/Dockerfile.musl-control‎

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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

‎docker/README.md‎

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 numberDiff line numberDiff line change
@@ -41,3 +41,39 @@ docker compose -f docker/docker-compose.centos-7.yaml run cross-compile-aarch64-
4141

4242
etc, etc
4343

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

‎docker/docker-compose.alpine.yaml‎

Copy file name to clipboard
+57Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
# eclipse-temurin's JDK depends on libgcc, so `apk del` cannot take it away there and that
19+
# base can never prove the artifact loads without it. Point this at an Alpine JDK that
20+
# carries no libgcc (amazoncorretto:21-alpine) for the leg that tests exactly that.
21+
jdk_image: "${MUSL_JDK_IMAGE:-eclipse-temurin:21-jdk-alpine}"
22+
23+
common: &common
24+
image: netty-tcnative-alpine:${MUSL_VARIANT:-bare}
25+
depends_on: [runtime-setup]
26+
environment:
27+
- MUSL_VARIANT=${MUSL_VARIANT:-bare}
28+
# Set to 1 on the bare legs: uninstalls binutils, and libgcc with it, before the runtime
29+
# checks. Leave unset for the gcompat legs, whose point is to load with the shim present.
30+
- MUSL_DROP_ELFTOOLS=${MUSL_DROP_ELFTOOLS:-0}
31+
volumes:
32+
- ..:/code:delegated
33+
working_dir: /code
34+
35+
verify:
36+
<<: *common
37+
command: /bin/sh -c "docker/musl-verify/verify.sh ${MUSL_JARS_DIR:-.}"
38+
39+
shell:
40+
<<: *common
41+
entrypoint: /bin/sh
42+
43+
control-runtime-setup:
44+
image: netty-tcnative-musl-control:glibc
45+
build:
46+
context: ../
47+
dockerfile: docker/Dockerfile.musl-control
48+
49+
control-verify:
50+
image: netty-tcnative-musl-control:glibc
51+
depends_on: [control-runtime-setup]
52+
environment:
53+
- MUSL_VARIANT=glibc-control
54+
volumes:
55+
- ..:/code:delegated
56+
working_dir: /code
57+
command: /bin/sh -c "docker/musl-verify/verify.sh ${MUSL_JARS_DIR:-.}"

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.