Skip to content

Commit 04fd8bc

Browse files
committed
packaging: fix the need of multiple Dockerfiles for opensuse, clean some coderabbit concerns
Signed-off-by: Dan Illescas <[email protected]>
1 parent b8d8fb5 commit 04fd8bc

File tree

7 files changed

+76
-165
lines changed

7 files changed

+76
-165
lines changed

install.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,33 @@ apt-get -y update
148148
$INSTALL_CMD_PREFIX apt-get -y $APT_PARAMETERS install $INSTALL_PACKAGE_NAME$APT_VERSION
149149
SCRIPT
150150
;;
151-
opensuse-leap|sles)
151+
opensuse-leap)
152+
# Leap has a VERSION_ID like "15.6"
152153
$SUDO sh <<SCRIPT
153154
rpm --import $RELEASE_KEY
154155
cat << EOF > /etc/zypp/repos.d/fluent-bit.repo
155156
[fluent-bit]
156157
name = Fluent Bit
157-
baseurl = $RELEASE_URL/suse/\$releasever
158+
baseurl = $RELEASE_URL/opensuse/leap/$VERSION_ID
159+
gpgcheck=1
160+
repo_gpgcheck=1
161+
gpgkey=$RELEASE_KEY
162+
enabled=1
163+
type=rpm-md
164+
autorefresh=1
165+
EOF
166+
cat /etc/zypp/repos.d/fluent-bit.repo
167+
zypper --non-interactive --gpg-auto-import-keys refresh
168+
$INSTALL_CMD_PREFIX zypper --non-interactive --gpg-auto-import-keys $ZYPPER_PARAMETERS install $INSTALL_PACKAGE_NAME$ZYPPER_VERSION
169+
SCRIPT
170+
;;
171+
sles)
172+
$SUDO sh <<SCRIPT
173+
rpm --import $RELEASE_KEY
174+
cat << EOF > /etc/zypp/repos.d/fluent-bit.repo
175+
[fluent-bit]
176+
name = Fluent Bit
177+
baseurl = $RELEASE_URL/sles/\$releasever
158178
gpgcheck=1
159179
repo_gpgcheck=1
160180
gpgkey=$RELEASE_KEY

packaging/distros/opensuse/15.6.arm64v8/Dockerfile

Lines changed: 0 additions & 74 deletions
This file was deleted.

packaging/distros/opensuse/15.6/Dockerfile

Lines changed: 0 additions & 69 deletions
This file was deleted.

packaging/distros/opensuse/Dockerfile

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,47 @@ ARG BASE_BUILDER
99
FROM multiarch/qemu-user-static:x86_64-aarch64 AS multiarch-aarch64
1010

1111
# opensuse/leap base image
12+
# hadolint ignore=DL3006
1213
FROM opensuse/leap AS opensuse-leap-base
1314

14-
# hadolint ignore=DL3033
15+
# hadolint ignore=DL3037,DL3033
1516
RUN zypper up -y && \
1617
zypper install -y --no-recommends \
1718
rpm-build \
1819
curl ca-certificates wget unzip flex bison \
1920
gcc gcc-c++ \
20-
cmake3-full \
21+
cmake-full \
2122
make \
2223
bash \
2324
systemd-devel \
2425
postgresql postgresql-devel postgresql-server \
2526
cyrus-sasl cyrus-sasl-devel \
26-
libopenssl3 libopenssl-3-devel \
27+
libopenssl3 libopenssl-devel \
2728
libyaml-devel && \
2829
zypper clean -a && rm -rf /var/cache/zypp/*
2930

31+
# opensuse/leap base image
32+
FROM opensuse/leap:15.6 AS opensuse-15.6-base
33+
34+
# hadolint ignore=DL3037,DL3033
35+
RUN zypper up -y && \
36+
zypper install -y --no-recommends \
37+
rpm-build \
38+
curl ca-certificates wget unzip flex bison \
39+
gcc gcc-c++ \
40+
cmake-full \
41+
make \
42+
bash \
43+
systemd-devel \
44+
postgresql postgresql-devel postgresql-server \
45+
cyrus-sasl cyrus-sasl-devel \
46+
libopenssl3 libopenssl-devel \
47+
libyaml-devel && \
48+
zypper clean -a && rm -rf /var/cache/zypp/*
3049

3150
# opensuse/leap.arm64v8 base image
32-
# hadolint ignore=DL3029
33-
FROM --platform=arm64 opensuse/leap:15.6 AS opensuse-leap.arm64v8-base
51+
# hadolint ignore=DL3037,DL3029
52+
FROM --platform=arm64 opensuse/leap:15.6 AS opensuse-15.6.arm64v8-base
3453

3554
COPY --from=multiarch-aarch64 /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
3655

@@ -40,13 +59,13 @@ RUN zypper up -y && \
4059
rpm-build \
4160
curl ca-certificates wget unzip flex bison \
4261
gcc gcc-c++ \
43-
cmake3-full \
62+
cmake-full \
4463
make \
4564
bash \
4665
systemd-devel \
4766
postgresql postgresql-devel postgresql-server \
4867
cyrus-sasl cyrus-sasl-devel \
49-
libopenssl3 libopenssl-3-devel \
68+
libopenssl3 libopenssl-devel \
5069
libyaml-devel && \
5170
zypper clean -a && rm -rf /var/cache/zypp/*
5271

packaging/distros/sles/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,34 @@ ARG BASE_BUILDER
55
# Multiarch support
66
FROM multiarch/qemu-user-static:x86_64-aarch64 AS multiarch-aarch64
77

8-
# opensuse/leap base image
8+
# sles base image
99
FROM registry.suse.com/bci/bci-base:15.7 AS sles-15.7-base
1010

11-
# hadolint ignore=DL3033
11+
# hadolint ignore=DL3037,DL3033
1212
RUN zypper up -y && \
1313
zypper install -y --no-recommends \
1414
rpm-build curl ca-certificates gcc gcc-c++ cmake-full make bash \
1515
wget unzip systemd-devel flex bison \
1616
postgresql-server postgresql-devel cyrus-sasl-devel \
1717
libopenssl-devel libyaml-devel && \
1818
rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2} && \
19+
rm -rf /var/log/lastlog /var/log/tallylog /var/log/zypper.log /var/log/zypp/history /var/log/YaST2 && \
1920
zypper clean -a
2021

21-
# opensuse/leap.arm64v8 base image
22+
# sles base image is the same name for all architectures
2223
# hadolint ignore=DL3029
2324
FROM --platform=arm64 registry.suse.com/bci/bci-base:15.7 AS sles-15.7.arm64v8-base
2425

2526
COPY --from=multiarch-aarch64 /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
2627

27-
# hadolint ignore=DL3033
28+
# hadolint ignore=DL3037,DL3033
2829
RUN zypper up -y && \
2930
zypper install -y --no-recommends \
3031
rpm-build curl ca-certificates gcc gcc-c++ cmake-full make bash \
3132
wget unzip systemd-devel flex bison \
3233
postgresql-server postgresql-devel cyrus-sasl-devel \
3334
libopenssl-devel libyaml-devel && \
34-
rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2} && \
35+
rm -rf /var/log/lastlog /var/log/tallylog /var/log/zypper.log /var/log/zypp/history /var/log/YaST2 && \
3536
zypper clean -a
3637

3738
# Need larger page size

packaging/update-repos.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RPM_REPO_PATHS=( "amazonlinux/2"
4343
"almalinux/8"
4444
"almalinux/9"
4545
"almalinux/10"
46-
"opensuse/15.6"
46+
"opensuse/leap/15.6"
4747
"sles/15.7"
4848
)
4949

@@ -58,7 +58,14 @@ for RPM_REPO in "${RPM_REPO_PATHS[@]}"; do
5858
aws s3 sync s3://"${AWS_S3_BUCKET_STAGING:?}/$RPM_REPO" "${BASE_PATH:?}/$RPM_REPO"
5959
fi
6060

61-
/bin/bash -eux "$SCRIPT_DIR/update-yum-repo.sh"
61+
case "$RPM_REPO" in
62+
"opensuse/"* | "sles/"*)
63+
/bin/bash -eux "$SCRIPT_DIR/update-zypper-repo.sh"
64+
;;
65+
*)
66+
/bin/bash -eux "$SCRIPT_DIR/update-yum-repo.sh"
67+
;;
68+
esac
6269
done
6370

6471
DEB_REPO_PATHS=( "debian/bookworm"

packaging/update-zypper-repo.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -eux
33

44
# Used to update a SUSE repository, e.g. during a staging build or release process
55

6-
# SUSE/openSUSE version and arch, e.g. "opensuse/leap/15.6" or "sles/15-sp5"
6+
# SUSE/openSUSE version and arch, e.g. "opensuse/leap/15.6" or "sles/15.7"
77
RPM_REPO=${RPM_REPO:?}
88

99
# Where the base of all the repos is
@@ -16,14 +16,21 @@ fi
1616
# Set true to prevent signing
1717
DISABLE_SIGNING=${DISABLE_SIGNING:-false}
1818
if [[ "$DISABLE_SIGNING" != "true" ]]; then
19-
echo "INFO: RPM signing configuration"
20-
rpm --showrc | grep gpg
21-
rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'
19+
if [[ -z "${GPG_KEY:-}" ]]; then
20+
echo "ERROR: GPG_KEY is required when signing is enabled (set DISABLE_SIGNING=true to skip)."
21+
exit 1
22+
fi
23+
echo "INFO: RPM signing configuration (best-effort)"
24+
rpm --showrc | grep -i gpg || true
25+
rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n' || true
2226
fi
2327

2428
# createrepo is available on SUSE
2529
CREATE_REPO_CMD="createrepo"
26-
CREATE_REPO_ARGS=${CREATE_REPO_ARGS:--dvp}
30+
# Default combined short options; allow space-separated overrides via env
31+
CREATE_REPO_ARGS=${CREATE_REPO_ARGS:--d -v -p}
32+
# shellcheck disable=SC2206 # intentional word splitting into array
33+
CREATE_REPO_ARGS_ARR=(${CREATE_REPO_ARGS})
2734

2835
# Check for createrepo
2936
if ! command -v createrepo &> /dev/null; then
@@ -45,7 +52,7 @@ if [[ "$DISABLE_SIGNING" != "true" ]]; then
4552
fi
4653

4754
# Create full metadata for all RPMs in the directory
48-
"$CREATE_REPO_CMD" "$CREATE_REPO_ARGS" "$REPO_DIR"
55+
"$CREATE_REPO_CMD" "${CREATE_REPO_ARGS_ARR[@]}" "$REPO_DIR"
4956

5057
# Set up repo info in SUSE format
5158
if [[ -n "${AWS_S3_BUCKET:-}" ]]; then

0 commit comments

Comments
 (0)