Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,37 @@ blocks:
- packaging/tools/build-release-artifacts.sh --disable-gssapi alpine:3.16.9 artifacts/librdkafka.tgz


- name: 'Linux s390x: release artifact docker builds'
dependencies: []
run:
when: "tag =~ '^v[0-9]\\.'"
task:
agent:
machine:
type: s1-prod-ubuntu24-04-amd64-1
prologue:
commands:
- '[[ -z $DOCKERHUB_APIKEY ]] || docker login --username $DOCKERHUB_USER --password $DOCKERHUB_APIKEY'
- docker run --privileged --rm tonistiigi/binfmt --install s390x
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The binfmt helper container is referenced without a tag or digest (tonistiigi/binfmt). This makes the CI setup non-reproducible and increases supply-chain risk if the upstream image changes. Pin this image to a specific version tag (or, ideally, an immutable digest).

Suggested change
- docker run --privileged --rm tonistiigi/binfmt --install s390x
- docker run --privileged --rm tonistiigi/binfmt:qemu-v8.1.5 --install s390x

Copilot uses AI. Check for mistakes.
epilogue:
commands:
- '[[ -z $SEMAPHORE_GIT_TAG_NAME ]] || artifact push workflow artifacts/ --destination artifacts/${ARTIFACT_KEY}/'
jobs:
- name: 'Build: centos8 glibc +gssapi'
env_vars:
- name: ARTIFACT_KEY
value: p-librdkafka__plat-linux__dist-centos8__arch-s390x__lnk-std__extra-gssapi
commands:
- packaging/tools/build-release-artifacts.sh --platform linux/s390x quay.io/pypa/manylinux_2_28_s390x:2024.07.01-1 artifacts/librdkafka.tgz

- name: 'Build: centos8 glibc'
env_vars:
- name: ARTIFACT_KEY
value: p-librdkafka__plat-linux__dist-centos8__arch-s390x__lnk-all
commands:
- packaging/tools/build-release-artifacts.sh --disable-gssapi --platform linux/s390x quay.io/pypa/manylinux_2_28_s390x:2024.07.01-1 artifacts/librdkafka.tgz


- name: 'Windows x64: MinGW-w64'
dependencies: []
run:
Expand Down Expand Up @@ -313,6 +344,7 @@ blocks:
- 'OSX x64'
- 'Linux x64: release artifact docker builds'
- 'Linux arm64: release artifact docker builds'
- 'Linux s390x: release artifact docker builds'
- 'Windows x64: MinGW-w64'
- 'Windows x64: Windows SDK 10.0 / MSVC v142 / VS 2019'
run:
Expand Down
9 changes: 9 additions & 0 deletions packaging/nuget/nugetpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ class NugetPackage (Package):
'./usr/local/lib/librdkafka.so.1',
'runtimes/linux-arm64/native/alpine-librdkafka.so'),

# Linux glibc centos8 s390x without GSSAPI (no external deps)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check with Emanuele Sabellico (@emasab) on whether we need similar one for with GSSAPI

Mapping({'arch': 's390x',
'plat': 'linux',
'dist': 'centos8',
'lnk': 'all'},
'librdkafka.tgz',
'./usr/local/lib/librdkafka.so.1',
'runtimes/linux-s390x/native/librdkafka.so'),

# Common Win runtime
Mapping({'arch': 'x64',
'plat': 'win'},
Expand Down
1 change: 1 addition & 0 deletions packaging/nuget/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def unquote(path):
('win', 'x86', '.lib'): re.compile('current ar archive'),
('linux', 'x64', '.so'): re.compile('ELF 64.* x86-64'),
('linux', 'arm64', '.so'): re.compile('ELF 64.* ARM aarch64'),
('linux', 's390x', '.so'): re.compile('ELF 64.* IBM S/390'),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we run file librdkafka.so then it does print the below string
artifacts-s390x-qemu/usr/local/lib/librdkafka.so.1: ELF 64-bit MSB shared object, IBM S/390, version 1 (SYSV), dynamically linked, BuildID[sha1]=

The format looks correct but lets reconfirm once if we need this change.

('osx', 'x64', '.dylib'): re.compile('Mach-O 64.* x86_64'),
('osx', 'arm64', '.dylib'): re.compile('Mach-O 64.*arm64')}

Expand Down
18 changes: 18 additions & 0 deletions packaging/nuget/staticpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ class StaticPackage (Package):
'./usr/local/lib/pkgconfig/rdkafka-static.pc',
'librdkafka_musl_linux_arm64.pc'),

# glibc linux s390x static lib and pkg-config file
Mapping({'arch': 's390x',
'plat': 'linux',
'dist': 'centos8',
'lnk': 'all',
'!extra': 'gssapi'},
'librdkafka.tgz',
'./usr/local/lib/librdkafka-static.a',
'librdkafka_glibc_linux_s390x.a'),
Mapping({'arch': 's390x',
'plat': 'linux',
'dist': 'centos8',
'lnk': 'all',
'!extra': 'gssapi'},
'librdkafka.tgz',
'./usr/local/lib/pkgconfig/rdkafka-static.pc',
'librdkafka_glibc_linux_s390x.pc'),

# osx x64 static lib and pkg-config file
Mapping({'arch': 'x64',
'plat': 'osx',
Expand Down
15 changes: 11 additions & 4 deletions packaging/tools/build-release-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
# alpine:3.16
# quay.io/pypa/manylinux_2_28_aarch64 (centos8)
# quay.io/pypa/manylinux_2_28_x86_64 (centos8)
# quay.io/pypa/manylinux_2_28_s390x (centos8, requires QEMU binfmt)
#
# Usage:
# packaging/tools/build-release-artifacts.sh [--disable-gssapi] <docker-image> <relative-output-tarball-path.tgz>
# packaging/tools/build-release-artifacts.sh [--disable-gssapi] [--platform <docker-platform>] <docker-image> <relative-output-tarball-path.tgz>
#
# The output path must be a relative path and inside the librdkafka directory
# structure.
Expand Down Expand Up @@ -42,20 +43,26 @@ else
disable_gssapi=""
fi

docker_platform=""
if [ "$1" = "--platform" ]; then
docker_platform="--platform=$2"
shift 2
fi
Comment on lines +46 to +50
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --platform option is parsed without validating that a value is provided. If the script is invoked as ... --platform (missing the platform argument), $2 will be empty and shift 2 will fail under set -e, producing a confusing error. Add an explicit argument-count check (and a clear usage message) before reading $2/shifting.

Copilot uses AI. Check for mistakes.

# Check if we're running on the host or the (docker) build target.
if [ "$1" = "--in-docker" -a $# -eq 2 ]; then
output="$2"
elif [ $# -eq 2 ]; then
docker_image="$1"
output="$2"
else
echo "Usage: $0 [--disable-gssapi] <manylinux-docker-image> <output-path.tgz>"
echo "Usage: $0 [--disable-gssapi] [--platform <docker-platform>] <manylinux-docker-image> <output-path.tgz>"
exit 1
fi

if [ -n "$docker_image" ]; then
# Running on the host, spin up the docker builder.
exec docker run -v "$PWD:/v" $docker_image /v/packaging/tools/build-release-artifacts.sh $disable_gssapi --in-docker "/v/$output"
exec docker run $docker_platform -v "$PWD:/v" $docker_image /v/packaging/tools/build-release-artifacts.sh $disable_gssapi --in-docker "/v/$output"
# Only reached on exec error
exit $?
fi
Expand All @@ -76,7 +83,7 @@ if grep -q alpine /etc/os-release 2>/dev/null ; then

else
# CentOS
yum install -y libstdc++-devel gcc gcc-c++ python3 git perl-IPC-Cmd perl-Pod-Html $extra_pkgs_rpm
yum install -y libstdc++-devel gcc gcc-c++ python3 git perl-IPC-Cmd perl-Pod-Html perl-bignum $extra_pkgs_rpm
fi


Expand Down