diff --git a/.github/workflows/apt.yml b/.github/workflows/apt.yml index 5862324b..d7732837 100644 --- a/.github/workflows/apt.yml +++ b/.github/workflows/apt.yml @@ -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: diff --git a/.github/workflows/yum.yml b/.github/workflows/yum.yml index fc9a22ab..67693d31 100644 --- a/.github/workflows/yum.yml +++ b/.github/workflows/yum.yml @@ -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: @@ -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: diff --git a/fluent-package/apt/systemd-test/update-to-next-major-version.sh b/fluent-package/apt/systemd-test/update-to-next-major-version.sh index f624e434..9add0d32 100755 --- a/fluent-package/apt/systemd-test/update-to-next-major-version.sh +++ b/fluent-package/apt/systemd-test/update-to-next-major-version.sh @@ -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 @@ -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 diff --git a/fluent-package/templates/package-scripts/fluent-package/deb/preinst b/fluent-package/templates/package-scripts/fluent-package/deb/preinst index 95097d6a..02d856f6 100755 --- a/fluent-package/templates/package-scripts/fluent-package/deb/preinst +++ b/fluent-package/templates/package-scripts/fluent-package/deb/preinst @@ -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 %> @@ -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 ;; diff --git a/fluent-package/yum/fluent-package.spec.in b/fluent-package/yum/fluent-package.spec.in index 9009c871..590dbb7d 100644 --- a/fluent-package/yum/fluent-package.spec.in +++ b/fluent-package/yum/fluent-package.spec.in @@ -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@ + 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 diff --git a/fluent-package/yum/systemd-test/update-to-next-major-version.sh b/fluent-package/yum/systemd-test/update-to-next-major-version.sh index ff88f70a..4aa1131f 100755 --- a/fluent-package/yum/systemd-test/update-to-next-major-version.sh +++ b/fluent-package/yum/systemd-test/update-to-next-major-version.sh @@ -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 @@ -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