Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ jobs:
- "update-to-next-version-service-status.sh disabled active"
- "update-to-next-version-service-status.sh disabled inactive"
- "update-to-next-version-with-auto-and-manual.sh"
- "update-to-next-major-version.sh"
- "update-to-next-major-version.sh auto"
- "update-to-next-major-version.sh manual"
- "update-to-next-major-version.sh etc"
- "update-without-data-lost.sh v5 v6"
- "update-without-data-lost.sh v6 v5"
include:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ jobs:
- "update-to-next-version-service-status.sh disabled active"
- "update-to-next-version-service-status.sh disabled inactive"
- "update-to-next-version-with-auto-and-manual.sh"
- "update-to-next-major-version.sh"
- "update-to-next-major-version.sh auto"
- "update-to-next-major-version.sh manual"
- "update-to-next-major-version.sh etc"
- "update-without-data-lost.sh v5 v6"
- "update-without-data-lost.sh v6 v5"
include:
Expand Down Expand Up @@ -223,7 +225,9 @@ jobs:
- "update-to-next-version-service-status.sh disabled active"
- "update-to-next-version-service-status.sh disabled inactive"
- "update-to-next-version-with-auto-and-manual.sh"
- "update-to-next-major-version.sh"
- "update-to-next-major-version.sh auto"
- "update-to-next-major-version.sh manual"
- "update-to-next-major-version.sh etc"
- "update-without-data-lost.sh v5 v6"
- "update-without-data-lost.sh v6 v5"
include:
Expand Down
17 changes: 14 additions & 3 deletions fluent-package/apt/systemd-test/update-to-next-major-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ set -exu

. $(dirname $0)/../commonvar.sh

service_restart=$1

# Install the current
sudo apt install -V -y \
/host/${distribution}/pool/${code_name}/${channel}/*/*/fluent-package_*_${architecture}.deb

# Set FLUENT_PACKAGE_SERVICE_RESTART
sed -i "s/=auto/=$service_restart/" /etc/default/fluentd

# Install plugin manually (plugin and gem)
sudo /opt/fluent/bin/fluent-gem install --no-document fluent-plugin-concat
sudo /opt/fluent/bin/fluent-gem install --no-document gqtp
Expand All @@ -30,7 +35,13 @@ if dpkg-query --show --showformat='${Version}' needrestart ; then
fi

# Test: Check whether plugin/gem were installed during upgrading
/opt/fluent/bin/fluent-gem list | grep fluent-plugin-concat
# Non fluent-plugin- prefix gem should not be installed automatically
(! /opt/fluent/bin/fluent-gem list | grep gqtp)
if [ "$service_restart" = auto ]; then
# plugin gem should be installed automatically
/opt/fluent/bin/fluent-gem list | grep fluent-plugin-concat
# Non fluent-plugin- prefix gem should not be installed automatically
(! /opt/fluent/bin/fluent-gem list | grep gqtp)
else
# plugin gem should not be installed automatically
(! /opt/fluent/bin/fluent-gem list | grep fluent-plugin-concat)
fi

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ set -e

local_base_plugins=/tmp/<%= package_dir %>/.local_base_plugins
migrate_local_plugins() {
if [ "$FLUENT_PACKAGE_SERVICE_RESTART" != auto ]; then
return
fi
if [ ! -d /run/systemd/system ]; then
# tmpfiles.d owns /tmp/<%= package_dir %>, but not created without systemd
mkdir -p /tmp/<%= package_dir %>
Expand All @@ -37,6 +40,8 @@ check_whether_zero_downtime_restart_supported() {

case "$1" in
upgrade)
. /etc/default/<%= service_name %>
echo "preinst FLUENT_PACKAGE_SERVICE_RESTART: $FLUENT_PACKAGE_SERVICE_RESTART"
migrate_local_plugins
check_whether_zero_downtime_restart_supported
;;
Expand Down
8 changes: 6 additions & 2 deletions fluent-package/yum/fluent-package.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,12 @@ else
fi
fi
if [ $1 -eq 2 ]; then
# collect installed gems during upgrading
/usr/sbin/fluent-gem list '^fluent-plugin-' --no-versions --no-verbose > %{local_base_plugins}
. %{_sysconfdir}/sysconfig/@SERVICE_NAME@

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this can fail when updating from v4.
For some reason, the current test is successful.
I will check these concerns together last.

echo "pre FLUENT_PACKAGE_SERVICE_RESTART: $FLUENT_PACKAGE_SERVICE_RESTART"
if [ "$FLUENT_PACKAGE_SERVICE_RESTART" = auto ]; then
# collect installed gems during upgrading
/usr/sbin/fluent-gem list '^fluent-plugin-' --no-versions --no-verbose > %{local_base_plugins}
fi
fi

%preun
Expand Down
17 changes: 14 additions & 3 deletions fluent-package/yum/systemd-test/update-to-next-major-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ set -exu

. $(dirname $0)/commonvar.sh

service_restart=$1

# Install the current
package="/host/${distribution}/${DISTRIBUTION_VERSION}/x86_64/Packages/fluent-package-*.rpm"
sudo $DNF install -y $package

# Set FLUENT_PACKAGE_SERVICE_RESTART
sed -i "s/=auto/=$service_restart/" /etc/sysconfig/fluentd

# Install plugin manually (plugin and gem)
sudo /opt/fluent/bin/fluent-gem install --no-document fluent-plugin-concat
sudo /opt/fluent/bin/fluent-gem install --no-document gqtp
Expand All @@ -17,6 +22,12 @@ package="/host/v6-test/${distribution}/${DISTRIBUTION_VERSION}/x86_64/Packages/f
sudo $DNF install -y $package

# Test: Check whether plugin/gem were installed during upgrading
/opt/fluent/bin/fluent-gem list | grep fluent-plugin-concat
# Non fluent-plugin- prefix gem should not be installed automatically
(! /opt/fluent/bin/fluent-gem list | grep gqtp)
if [ "$service_restart" = auto ]; then
# plugin gem should be installed automatically
/opt/fluent/bin/fluent-gem list | grep fluent-plugin-concat
# Non fluent-plugin- prefix gem should not be installed automatically
(! /opt/fluent/bin/fluent-gem list | grep gqtp)
else
# plugin gem should not be installed automatically
(! /opt/fluent/bin/fluent-gem list | grep fluent-plugin-concat)
fi