Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(build): supports cleanup of rpm/deb residual files after uninstall #12162

Merged
merged 7 commits into from Dec 13, 2023

Conversation

tzssangglass
Copy link
Member

@tzssangglass tzssangglass commented Dec 6, 2023

Summary

when installing Kong via rpm/deb and then removing it, there may be residual files and directories left in the system from the installation. The current commit supports cleaning up these leftover files through postremove.

For reviewers:

current situation: after removing Kong, some installation files of Kong will remain:

  • /var/spool/mail/kong
  • /etc/kong
  • /home/kong
  • /usr/local/share/lua/5.1/
  • /usr/local/lib/luarocks/
  • /usr/local/lib/lua
  • /usr/local/openresty/
  • /usr/local/kong/include
  • /usr/local/kong/lib

because these files in the folder are not tracked by the package manager.

after this PR modification, the following folders will be tracked by the package manager. If Kong is removed, the files imported during the installation of Kong from these folders will also be deleted. Unrelated files to Kong will not be deleted, it is safe:

  • /usr/local/share/lua/5.1/
  • /usr/local/lib/luarocks/
  • /usr/local/lib/lua
  • /usr/local/openresty/
  • /usr/local/kong/include
  • /usr/local/kong/lib

after removing nginx, some files have been retained because:

  • the Nginx user still exists, so I choose to keep Kong user and /home/kong
  • nginx will also not remove the /etc/nginx directory, so we do not need to delete /etc/kong

Local manual verification

rhel

bazel build --verbose_failures --config release :kong_el7 

docker run --rm -v ${kong source}/bazel-bin/pkg/kong.el7.amd64.rpm:/kong.el7.amd64.rpm -v  ${kong source}/build/:/build --name kong  -it centos:centos7 /bin/bash

# in docker 

yum install -y kong.el7.amd64.rpm

# in terminal
export BUILD_LABEL="rhel" &&  build/tests/04-uninstall.sh

ubuntu

bazel build --verbose_failures --config release :kong_deb

docker run --rm -v ${kong source}/bazel-bin/pkg/kong.amd64.deb:/kong.amd64.deb -v ${kong source}/build/:/build --name kong -it ubuntu:22.04 /bin/bash

# in docker 
apt-get update
apt install -y ./kong.amd64.deb

# in terminal
export BUILD_LABEL="ubuntu" &&  build/tests/04-uninstall.sh

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix FTI-5553

when installing Kong via rpm/deb and then uninstalling it,
there may be residual files and directories left in the system
from the installation. The current commit supports
cleaning up these leftover files through postremove.

Fix: [FTI-5553](https://konghq.atlassian.net/browse/FTI-5553)
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
@github-actions github-actions bot added chore Not part of the core functionality of kong, but still needed build/bazel labels Dec 6, 2023
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
@tzssangglass tzssangglass marked this pull request as ready for review December 12, 2023 08:05
@fffonion fffonion merged commit f6fbe44 into master Dec 13, 2023
26 checks passed
@fffonion fffonion deleted the FTI-5553 branch December 13, 2023 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/bazel chore Not part of the core functionality of kong, but still needed size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants