Skip to content

Commit

Permalink
install: specify version to install script (#6693)
Browse files Browse the repository at this point in the history
* install: add support for specifying version

Signed-off-by: Patrick Stephens <[email protected]>

* install: add option for dry run or other prefix

Signed-off-by: Patrick Stephens <[email protected]>

* packaging: add config to tests

Signed-off-by: Patrick Stephens <[email protected]>

Signed-off-by: Patrick Stephens <[email protected]>
  • Loading branch information
patrick-stephens authored Jan 16, 2023
1 parent 76d2d08 commit 27f490c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 16 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ set -e
RELEASE_URL=${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}
RELEASE_KEY=${FLUENT_BIT_PACKAGES_KEY:-$RELEASE_URL/fluentbit.key}

# Optionally specify the version to install
RELEASE_VERSION=${FLUENT_BIT_RELEASE_VERSION:-}
# Optionally prefix install commands, e.g. use 'echo ' here to prevent installation after repo set up.
INSTALL_CMD_PREFIX=${FLUENT_BIT_INSTALL_COMMAND_PREFIX:-}

echo "================================"
echo " Fluent Bit Installation Script "
echo "================================"
Expand Down Expand Up @@ -35,6 +40,14 @@ else
sudo -k
fi

# Set up version pinning
APT_VERSION=''
YUM_VERSION=''
if [[ -n "${RELEASE_VERSION}" ]]; then
APT_VERSION="=$RELEASE_VERSION"
YUM_VERSION="-$RELEASE_VERSION"
fi

# Now set up repos and install dependent on OS, version, etc.
# Will require sudo
case ${OS} in
Expand All @@ -55,7 +68,7 @@ enabled=1
EOF
sed -i 's|VERSION_ARCH_SUBSTR|\$releasever/\$basearch/|g' /etc/yum.repos.d/fluent-bit.repo
cat /etc/yum.repos.d/fluent-bit.repo
yum -y install fluent-bit
$INSTALL_CMD_PREFIX yum -y install fluent-bit$YUM_VERSION
SCRIPT
;;
centos|centoslinux|rhel|redhatenterpriselinuxserver|fedora|rocky|almalinux)
Expand All @@ -73,7 +86,7 @@ enabled=1
EOF
sed -i 's|VERSION_ARCH_SUBSTR|\$releasever/\$basearch/|g' /etc/yum.repos.d/fluent-bit.repo
cat /etc/yum.repos.d/fluent-bit.repo
yum -y install fluent-bit
$INSTALL_CMD_PREFIX yum -y install fluent-bit$YUM_VERSION
SCRIPT
;;
ubuntu|debian)
Expand All @@ -88,7 +101,7 @@ deb [signed-by=/usr/share/keyrings/fluentbit-keyring.gpg] $RELEASE_URL/${OS}/${C
EOF
cat /etc/apt/sources.list.d/fluent-bit.list
apt-get -y update
apt-get -y install fluent-bit
$INSTALL_CMD_PREFIX apt-get -y install fluent-bit$APT_VERSION
SCRIPT
;;
*)
Expand Down
4 changes: 4 additions & 0 deletions packaging/test-release-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ do
$CONTAINER_RUNTIME run --rm -t \
-e FLUENT_BIT_PACKAGES_URL="${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}" \
-e FLUENT_BIT_PACKAGES_KEY="${FLUENT_BIT_PACKAGES_KEY:-https://packages.fluentbit.io/fluentbit.key}" \
-e FLUENT_BIT_RELEASE_VERSION="${FLUENT_BIT_RELEASE_VERSION:-}" \
-e FLUENT_BIT_INSTALL_COMMAND_PREFIX="${FLUENT_BIT_INSTALL_COMMAND_PREFIX:-}" \
$EXTRA_MOUNTS \
"$IMAGE" \
sh -c "$INSTALL_CMD && /opt/fluent-bit/bin/fluent-bit --version" | tee "$LOG_FILE"
Expand All @@ -68,6 +70,8 @@ do
$CONTAINER_RUNTIME run --rm -t \
-e FLUENT_BIT_PACKAGES_URL="${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}" \
-e FLUENT_BIT_PACKAGES_KEY="${FLUENT_BIT_PACKAGES_KEY:-https://packages.fluentbit.io/fluentbit.key}" \
-e FLUENT_BIT_RELEASE_VERSION="${FLUENT_BIT_RELEASE_VERSION:-}" \
-e FLUENT_BIT_INSTALL_COMMAND_PREFIX="${FLUENT_BIT_INSTALL_COMMAND_PREFIX:-}" \
$EXTRA_MOUNTS \
"$IMAGE" \
sh -c "apt-get update && apt-get install -y gpg curl;$INSTALL_CMD && /opt/fluent-bit/bin/fluent-bit --version" | tee "$LOG_FILE"
Expand Down

0 comments on commit 27f490c

Please sign in to comment.