Skip to content

Commit 487a054

Browse files
author
Pat
authored
packaging: add options to parameterise server/key for testing (#5444)
* packaging: add options to parameterise server/key for testing Signed-off-by: Patrick Stephens <[email protected]> * codeowners: update for install script Signed-off-by: Patrick Stephens <[email protected]> * workflows: reduce noise from CI updates Signed-off-by: Patrick Stephens <[email protected]> * packaging: update test script to handle new URLs Signed-off-by: Patrick Stephens <[email protected]> * packaging: fix linting failure Signed-off-by: Patrick Stephens <[email protected]> * packaging: fix typo in test script Signed-off-by: Patrick Stephens <[email protected]> * packaging: switch to fluent-bit service Signed-off-by: Patrick Stephens <[email protected]> * packaging: fix linting issue Signed-off-by: Patrick Stephens <[email protected]>
1 parent b3d271e commit 487a054

File tree

12 files changed

+207
-58
lines changed

12 files changed

+207
-58
lines changed

.github/workflows/docs-generate.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
# Do not re-trigger when our own PRs are merged
99
paths-ignore:
1010
- codebase-structure.svg
11+
- .github/
1112
jobs:
1213
update_diagram:
1314
name: Update the codebase structure diagram

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
/dockerfiles/ @niedbalski @patrick-stephens
2424
/packaging/ @niedbalski @patrick-stephens
2525
/codebase-structure.svg @niedbalski @patrick-stephens
26+
/install.sh @niedbalski @patrick-stephens
2627

2728
# Core: Signv4
2829
# ------------

install.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/usr/bin/env bash
22
set -e
33

4+
# Provided primarily to simplify testing for staging, etc.
5+
RELEASE_URL=${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}
6+
RELEASE_KEY=${FLUENT_BIT_PACKAGES_KEY:-https://packages.fluentbit.io/fluentbit.key}
7+
48
echo "================================"
59
echo " Fluent Bit Installation Script "
610
echo "================================"
@@ -31,29 +35,29 @@ sudo -k
3135
case ${OS} in
3236
amzn|amazonlinux)
3337
sudo sh <<'SCRIPT'
34-
rpm --import https://packages.fluentbit.io/fluentbit.key
38+
rpm --import $RELEASE_KEY
3539
cat > /etc/yum.repos.d/fluent-bit.repo <<EOF
3640
[fluent-bit]
3741
name = Fluent Bit
38-
baseurl = https://packages.fluentbit.io/amazonlinux/\$releasever/\$basearch/
42+
baseurl = $RELEASE_URL/amazonlinux/\$releasever/\$basearch/
3943
gpgcheck=1
4044
repo_gpgcheck=1
41-
gpgkey=https://packages.fluentbit.io/fluentbit.key
45+
gpgkey=$RELEASE_KEY
4246
enabled=1
4347
EOF
4448
yum -y install fluent-bit || yum -y install td-agent-bit
4549
SCRIPT
4650
;;
4751
centos|centoslinux|rhel|redhatenterpriselinuxserver|fedora|rocky|almalinux)
4852
sudo sh <<'SCRIPT'
49-
rpm --import https://packages.fluentbit.io/fluentbit.key
53+
rpm --import $RELEASE_KEY
5054
cat > /etc/yum.repos.d/fluent-bit.repo <<EOF
5155
[fluent-bit]
5256
name = Fluent Bit
53-
baseurl = https://packages.fluentbit.io/centos/\$releasever/\$basearch/
57+
baseurl = $RELEASE_URL/centos/\$releasever/\$basearch/
5458
gpgcheck=1
5559
repo_gpgcheck=1
56-
gpgkey=https://packages.fluentbit.io/fluentbit.key
60+
gpgkey=$RELEASE_KEY
5761
enabled=1
5862
EOF
5963
yum -y install fluent-bit || yum -y install td-agent-bit
@@ -65,9 +69,9 @@ SCRIPT
6569
sudo sh <<SCRIPT
6670
export DEBIAN_FRONTEND=noninteractive
6771
mkdir -p /usr/share/keyrings/
68-
curl https://packages.fluentbit.io/fluentbit.key | gpg --dearmor > /usr/share/keyrings/fluentbit-keyring.gpg
72+
curl $RELEASE_KEY | gpg --dearmor > /usr/share/keyrings/fluentbit-keyring.gpg
6973
cat > /etc/apt/sources.list.d/fluent-bit.list <<EOF
70-
deb [signed-by=/usr/share/keyrings/fluentbit-keyring.gpg] https://packages.fluentbit.io/${OS}/${CODENAME} ${CODENAME} main
74+
deb [signed-by=/usr/share/keyrings/fluentbit-keyring.gpg] $RELEASE_URL/${OS}/${CODENAME} ${CODENAME} main
7175
EOF
7276
apt-get -y update
7377
apt-get -y install fluent-bit || apt-get -y install td-agent-bit

packaging/test-release-packages.sh

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,40 @@
11
#!/bin/bash
22
set -eux
3-
# Verify package install for a latest release version
4-
docker run --rm -it ubuntu:20.04 sh -c "apt-get update && apt-get install -y sudo gpg curl;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
5-
docker run --rm -it ubuntu:18.04 sh -c "apt-get update && apt-get install -y sudo gpg curl;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
6-
docker run --rm -it debian:10 sh -c "apt-get update && apt-get install -y sudo gpg curl;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
7-
docker run --rm -it debian:11 sh -c "apt-get update && apt-get install -y sudo gpg curl;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
8-
docker run --rm -it centos:7 sh -c "yum install -y curl sudo;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
9-
docker run --rm -it rockylinux:8 sh -c "yum install -y curl sudo;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
10-
docker run --rm -it amazonlinux:2 sh -c "yum install -y curl sudo;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
3+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4+
# Verify package install for a release version
5+
6+
if [[ -f "$SCRIPT_DIR/.env" ]]; then
7+
# shellcheck disable=SC1091
8+
source "$SCRIPT_DIR/.env"
9+
fi
10+
11+
CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-docker}
12+
13+
APT_TARGETS=("ubuntu:18.04"
14+
"ubuntu:20.04"
15+
"debian:10"
16+
"debian:11")
17+
18+
YUM_TARGETS=("centos:7"
19+
"rockylinux:8"
20+
"amazonlinux:2")
21+
22+
for IMAGE in "${APT_TARGETS[@]}"
23+
do
24+
echo "Testing $IMAGE"
25+
$CONTAINER_RUNTIME run --rm -it \
26+
-e FLUENT_BIT_PACKAGES_URL="${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}" \
27+
-e FLUENT_BIT_PACKAGES_KEY="${FLUENT_BIT_PACKAGES_KEY:-https://packages.fluentbit.io/fluentbit.key}" \
28+
"$IMAGE" \
29+
sh -c "apt-get update && apt-get install -y sudo gpg curl;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
30+
done
31+
32+
for IMAGE in "${YUM_TARGETS[@]}"
33+
do
34+
echo "Testing $IMAGE"
35+
$CONTAINER_RUNTIME run --rm -it \
36+
-e FLUENT_BIT_PACKAGES_URL="${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}" \
37+
-e FLUENT_BIT_PACKAGES_KEY="${FLUENT_BIT_PACKAGES_KEY:-https://packages.fluentbit.io/fluentbit.key}" \
38+
"$IMAGE" \
39+
sh -c "yum install -y curl sudo;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
40+
done

packaging/testing/smoke/packages/Dockerfile.amazonlinux2

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# For staging upgrade we use the 'staging-upgrade-prep' as the base
22
ARG STAGING_BASE=dokken/amazonlinux-2
33

4+
ARG RELEASE_URL=https://packages.fluentbit.io
5+
ARG RELEASE_KEY=https://packages.fluentbit.io/fluentbit.key
6+
47
FROM dokken/amazonlinux-2 as official-install
8+
59
ARG RELEASE_URL
10+
ENV FLUENT_BIT_PACKAGES_URL=${RELEASE_URL}
11+
12+
ARG RELEASE_KEY
13+
ENV FLUENT_BIT_PACKAGES_KEY=${RELEASE_KEY}
614

715
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
816
RUN curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
@@ -12,15 +20,21 @@ COPY ./test.sh /test.sh
1220
RUN chmod a+x /test.sh
1321

1422
FROM official-install as staging-upgrade-prep
15-
RUN rm -f /etc/yum.repos.d/td-agent-bit.repo
23+
RUN rm -f /etc/yum.repos.d/*-bit.repo
1624

1725
FROM ${STAGING_BASE} as staging-install
18-
ARG STAGING_URL
1926
ARG STAGING_VERSION
2027
ENV STAGING_VERSION=${STAGING_VERSION}
28+
29+
ARG STAGING_URL
30+
ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
31+
32+
ARG STAGING_KEY=${STAGING_URL}/fluentbit.key
33+
ENV FLUENT_BIT_PACKAGES_KEY=${STAGING_KEY}
34+
2135
# hadolint ignore=DL3032
22-
RUN rpm --import "$STAGING_URL/fluentbit.key" && \
23-
wget -q "$STAGING_URL/amazonlinux-2.repo" -O /etc/yum.repos.d/staging.repo && \
36+
RUN rpm --import "$FLUENT_BIT_PACKAGES_KEY" && \
37+
wget -q "$FLUENT_BIT_PACKAGES_URL/amazonlinux-2.repo" -O /etc/yum.repos.d/staging.repo && \
2438
yum update -y && yum install -y fluent-bit && \
2539
systemctl enable fluent-bit
2640

packaging/testing/smoke/packages/Dockerfile.centos7

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# For staging upgrade we use the 'staging-upgrade-prep' as the base
22
ARG STAGING_BASE=dokken/centos-7
33

4+
ARG RELEASE_URL=https://packages.fluentbit.io
5+
ARG RELEASE_KEY=https://packages.fluentbit.io/fluentbit.key
6+
47
FROM dokken/centos-7 as official-install
8+
9+
ARG RELEASE_URL
10+
ENV FLUENT_BIT_PACKAGES_URL=${RELEASE_URL}
11+
12+
ARG RELEASE_KEY
13+
ENV FLUENT_BIT_PACKAGES_KEY=${RELEASE_KEY}
14+
515
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
616
# Use the one-line install
717
RUN curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
@@ -14,11 +24,17 @@ FROM official-install as staging-upgrade-prep
1424
RUN rm -f /etc/yum.repos.d/*-bit.repo
1525

1626
FROM ${STAGING_BASE} as staging-install
17-
ARG STAGING_URL
1827
ARG STAGING_VERSION
1928
ENV STAGING_VERSION=${STAGING_VERSION}
20-
RUN rpm --import "$STAGING_URL/fluentbit.key" && \
21-
wget -nv "$STAGING_URL/centos-7.repo" -O /etc/yum.repos.d/staging.repo
29+
30+
ARG STAGING_URL
31+
ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
32+
33+
ARG STAGING_KEY=${STAGING_URL}/fluentbit.key
34+
ENV FLUENT_BIT_PACKAGES_KEY=${STAGING_KEY}
35+
36+
RUN rpm --import "$FLUENT_BIT_PACKAGES_KEY" && \
37+
wget -nv "$FLUENT_BIT_PACKAGES_URL/centos-7.repo" -O /etc/yum.repos.d/staging.repo
2238
# hadolint ignore=DL3032
2339
RUN yum update -y && yum install -y fluent-bit && \
2440
systemctl enable fluent-bit

packaging/testing/smoke/packages/Dockerfile.centos8

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
# For staging upgrade we use the 'staging-upgrade-prep' as the base
22
ARG STAGING_BASE=dokken/centos-8
33

4+
ARG RELEASE_URL=https://packages.fluentbit.io
5+
ARG RELEASE_KEY=https://packages.fluentbit.io/fluentbit.key
6+
47
FROM dokken/centos-8 as official-install
58
# CentOS is now EOL so have to use the vault repos
69
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
710
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
811

912
ARG RELEASE_URL
10-
RUN rpm --import $RELEASE_URL/fluentbit.key
13+
ENV FLUENT_BIT_PACKAGES_URL=${RELEASE_URL}
14+
15+
ARG RELEASE_KEY
16+
ENV FLUENT_BIT_PACKAGES_KEY=${RELEASE_KEY}
1117

1218
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
1319
RUN curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
@@ -17,18 +23,24 @@ COPY ./test.sh /test.sh
1723
RUN chmod a+x /test.sh
1824

1925
FROM official-install as staging-upgrade-prep
20-
RUN rm -f /etc/yum.repos.d/td-agent-bit.repo
26+
RUN rm -f /etc/yum.repos.d/*-bit.repo
2127

2228
FROM ${STAGING_BASE} as staging-install
2329
# CentOS is now EOL so have to use the vault repos
2430
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
2531
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
2632

27-
ARG STAGING_URL
2833
ARG STAGING_VERSION
2934
ENV STAGING_VERSION=${STAGING_VERSION}
30-
RUN rpm --import "$STAGING_URL/fluentbit.key" && \
31-
wget -nv "$STAGING_URL/centos-8.repo" -O /etc/yum.repos.d/staging.repo
35+
36+
ARG STAGING_URL
37+
ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
38+
39+
ARG STAGING_KEY=${STAGING_URL}/fluentbit.key
40+
ENV FLUENT_BIT_PACKAGES_KEY=${STAGING_KEY}
41+
42+
RUN rpm --import "$FLUENT_BIT_PACKAGES_KEY" && \
43+
wget -nv "$FLUENT_BIT_PACKAGES_URL/centos-8.repo" -O /etc/yum.repos.d/staging.repo
3244
# hadolint ignore=DL3032
3345
RUN yum update -y && yum install -y fluent-bit && \
3446
systemctl enable fluent-bit

packaging/testing/smoke/packages/Dockerfile.debian10

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,44 @@
11
# For staging upgrade we use the 'official-install' as the base
22
ARG STAGING_BASE=dokken/debian-10
33

4+
ARG RELEASE_URL=https://packages.fluentbit.io
5+
ARG RELEASE_KEY=https://packages.fluentbit.io/fluentbit.key
6+
47
FROM dokken/debian-10 as official-install
8+
59
ARG RELEASE_URL
6-
RUN wget -qO - $RELEASE_URL/fluentbit.key | apt-key add -
7-
RUN echo "deb $RELEASE_URL/debian/buster buster main" >> /etc/apt/sources.list
8-
RUN apt-get update && apt-get install -y td-agent-bit
9-
RUN systemctl enable td-agent-bit
10+
ENV FLUENT_BIT_PACKAGES_URL=${RELEASE_URL}
11+
12+
ARG RELEASE_KEY
13+
ENV FLUENT_BIT_PACKAGES_KEY=${RELEASE_KEY}
14+
15+
# Use the one-line install
16+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
17+
RUN curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
18+
RUN systemctl enable fluent-bit || systemctl enable td-agent-bit
1019

1120
COPY ./test.sh /test.sh
1221
RUN chmod a+x /test.sh
1322

1423
FROM official-install as staging-upgrade-prep
15-
RUN head -n -1 /etc/apt/sources.list > /tmp/sources.list && mv /tmp/sources.list /etc/apt/sources.list
24+
RUN rm -f /etc/apt/sources.list.d/fluent-bit.list
1625

1726
FROM ${STAGING_BASE} as staging-install
18-
ARG STAGING_URL
1927
ARG STAGING_VERSION
2028
ENV STAGING_VERSION=${STAGING_VERSION}
29+
30+
ARG STAGING_URL
31+
ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
32+
33+
ARG STAGING_KEY=${STAGING_URL}/fluentbit.key
34+
ENV FLUENT_BIT_PACKAGES_KEY=${STAGING_KEY}
35+
2136
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
22-
RUN wget -qO - $STAGING_URL/fluentbit.key | apt-key add -
23-
RUN echo "deb $STAGING_URL/debian/buster buster main" >> /etc/apt/sources.list
24-
RUN apt-get update && apt-get install -y td-agent-bit
25-
RUN systemctl enable td-agent-bit
37+
RUN wget -qO - $FLUENT_BIT_PACKAGES_KEY | apt-key add -
38+
RUN echo "deb $FLUENT_BIT_PACKAGES_URL/debian/buster buster main" >> /etc/apt/sources.list
39+
# hadolint ignore=DL3015,DL3008,DL3009
40+
RUN apt-get update && apt-get install -y fluent-bit
41+
RUN systemctl enable fluent-bit
2642

2743
COPY ./test.sh /test.sh
2844
RUN chmod a+x /test.sh

packaging/testing/smoke/packages/Dockerfile.debian11

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# For staging upgrade we use the 'official-install' as the base
22
ARG STAGING_BASE=dokken/debian-11
33

4+
ARG RELEASE_URL=https://packages.fluentbit.io
5+
ARG RELEASE_KEY=https://packages.fluentbit.io/fluentbit.key
6+
47
FROM dokken/debian-11 as official-install
8+
59
ARG RELEASE_URL
10+
ENV FLUENT_BIT_PACKAGES_URL=${RELEASE_URL}
11+
12+
ARG RELEASE_KEY
13+
ENV FLUENT_BIT_PACKAGES_KEY=${RELEASE_KEY}
14+
615
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
716
RUN curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
817
RUN systemctl enable fluent-bit || systemctl enable td-agent-bit
@@ -14,14 +23,21 @@ FROM official-install as staging-upgrade-prep
1423
RUN rm -f /etc/apt/sources.list.d/fluent-bit.list
1524

1625
FROM ${STAGING_BASE} as staging-install
17-
ARG STAGING_URL
1826
ARG STAGING_VERSION
1927
ENV STAGING_VERSION=${STAGING_VERSION}
28+
29+
ARG STAGING_URL
30+
ENV FLUENT_BIT_PACKAGES_URL=${STAGING_URL}
31+
32+
ARG STAGING_KEY=${STAGING_URL}/fluentbit.key
33+
ENV FLUENT_BIT_PACKAGES_KEY=${STAGING_KEY}
34+
2035
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
21-
RUN wget -qO - $STAGING_URL/fluentbit.key | apt-key add -
22-
RUN echo "deb $STAGING_URL/debian/bullseye bullseye main" >> /etc/apt/sources.list
23-
RUN apt-get update && apt-get install -y td-agent-bit
24-
RUN systemctl enable td-agent-bit
36+
RUN wget -qO - $FLUENT_BIT_PACKAGES_KEY | apt-key add -
37+
RUN echo "deb $FLUENT_BIT_PACKAGES_URL/debian/bullseye bullseye main" >> /etc/apt/sources.list
38+
# hadolint ignore=DL3015,DL3008,DL3009
39+
RUN apt-get update && apt-get install -y fluent-bit
40+
RUN systemctl enable fluent-bit
2541

2642
COPY ./test.sh /test.sh
2743
RUN chmod a+x /test.sh

0 commit comments

Comments
 (0)