Repository: lf-edge/ekuiper
Pull request #2982 (2024-07-04 06:51:54)

chore: remove centos support

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/lf-edge/ekuiper/pull/2982?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=lf-edge) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Please [upload](https://docs.codecov.com/docs/codecov-uploader) report for BASE (`master-v2@2a52897`). [Learn more](https://docs.codecov.io/docs/error-reference?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=lf-edge#section-missing-base-commit) about missing BASE report.

<details><summary>Additional details and impacted files</summary>


```diff
@@             Coverage Diff              @@
##             master-v2    #2982   +/-   ##
============================================
  Coverage             ?   68.86%           
============================================
  Files                ?      335           
  Lines                ?    31980           
  Branches             ?        0           
============================================
  Hits                 ?    22023           
  Misses               ?     8005           
  Partials             ?     1952           
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/lf-edge/ekuiper/pull/2982?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=lf-edge).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=lf-edge).


Patch:
diff --git a/.github/dockerfile/Dockerfile.centos b/.github/dockerfile/Dockerfile.centos
deleted file mode 100644
index 02fab3ff..00000000
--- a/.github/dockerfile/Dockerfile.centos
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 2021 EMQ Technologies Co., Ltd.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-FROM centos:7
-
-RUN yum install -y make wget git which rpm-build gcc
-
-ARG GO_VERSION
-
-RUN case $(arch) in \
-        x86_64) \
-            case $(getconf LONG_BIT) in \
-                64) \
-                    ARCH=amd64; \
-                    yum install -y epel-release; \
-                    yum install -y upx \
-                ;; \
-                32) ARCH=386;; \
-            esac \
-        ;; \
-        aarch64) \
-            ARCH=arm64 \
-        ;; \
-        arm) \
-            ARCH=armv6l \
-        ;; \
-        ppc64le) \
-            ARCH=ppc64le\
-        ;; \
-        s390x) \
-            ARCH=s390x \
-        ;; \
-    esac \
-    && wget --no-verbose https://golang.org/dl/go$GO_VERSION.linux-$ARCH.tar.gz \
-    && tar -C /usr/local -xzf go$GO_VERSION.linux-$ARCH.tar.gz
-
-ENV PATH=$PATH:/usr/local/go/bin
diff --git a/.github/workflows/build_base_image.yaml b/.github/workflows/build_base_image.yaml
index 7008b533..7b697233 100644
--- a/.github/workflows/build_base_image.yaml
+++ b/.github/workflows/build_base_image.yaml
@@ -19,7 +19,6 @@ jobs:
       matrix:
         os:
           - debian
-          - centos
           - alpine
         golang:
           - 1.22.1
@@ -41,17 +40,6 @@ jobs:
           registry: ghcr.io
           username: ${{ github.actor }}
           password: ${{ github.token }}
-      - uses: docker/build-push-action@v4
-        if: matrix.os == 'centos'
-        with:
-          push: true
-          pull: true
-          cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max
-          cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max
-          platforms: linux/amd64,linux/arm64
-          build-args: GO_VERSION=${{ matrix.golang }}
-          tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }}
-          file: .github/dockerfile/Dockerfile.${{ matrix.os }}
       - uses: docker/build-push-action@v4
         if: matrix.os == 'debian'
         with:
diff --git a/.github/workflows/build_packages.yaml b/.github/workflows/build_packages.yaml
index f505ede8..9cc635ed 100644
--- a/.github/workflows/build_packages.yaml
+++ b/.github/workflows/build_packages.yaml
@@ -37,10 +37,6 @@ jobs:
         arch: ${{fromJson(needs.prepare.outputs.arch)}}
         os:
           - debian
-          - centos
-        exclude:
-          - os: centos
-            arch: linux/arm/v7
 
     steps:
     - uses: actions/checkout@v3
@@ -58,16 +54,6 @@ jobs:
         --platform ${{ matrix.arch }} \
         ghcr.io/lf-edge/ekuiper/base:${{ matrix.golang }}-${{ matrix.os }} \
         bash -euc "git config --global --add safe.directory /ekuiper && make pkg && make pkg_core && make pkg_full"
-    - name: build
-      if: matrix.os == 'centos'
-      run: |
-        docker run -i --rm \
-        -v $(pwd):/ekuiper \
-        --workdir /ekuiper \
-        --env KUIPER_SOURCE='/ekuiper' \
-        --platform ${{ matrix.arch }} \
-        ghcr.io/lf-edge/ekuiper/base:${{ matrix.golang }}-${{ matrix.os }} \
-        bash -euc "make -C deploy/packages"
     - name: create sha file
       run: |
         cd _packages && for var in $(ls); do sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"; done && cd -
diff --git a/deploy/packages/Makefile b/deploy/packages/Makefile
index bbaf86ee..83d4fbdd 100644
--- a/deploy/packages/Makefile
+++ b/deploy/packages/Makefile
@@ -7,16 +7,11 @@ endif
 # The version-release used for package
 export PKG_VSN := $(shell git describe --tags --always | sed 's/^v//g')
 
-ifneq ($(shell cat /etc/*-release |grep -o -i centos),)
-	ID := centos
-	VERSION_ID := $(shell rpm --eval '%{centos_ver}')
-else
-	ID := $(shell sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g' )
-	VERSION_ID := $(shell sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')
-endif
+ID := $(shell sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g' )
+VERSION_ID := $(shell sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')
 SYSTEM := $(shell echo $(ID)$(VERSION_ID) | sed -r "s/([a-zA-Z]*)-.*/\1/g")
 ##
-## Support RPM and Debian based linux systems
+## Support Debian based linux systems
 ##
 ifeq ($(ID),ubuntu)
 	PKGERDIR := deb
@@ -24,8 +19,6 @@ else ifeq ($(ID),debian)
 	PKGERDIR := deb
 else ifeq ($(ID),raspbian)
 	PKGERDIR := deb
-else
-	PKGERDIR := rpm
 endif
 
 .PHONY: all
@@ -35,14 +28,8 @@ all: clean
 
 clean:
 	rm -rf package
-	make -C rpm clean
 	make -C deb clean
 
 .PHONY: deb
 deb:
 	make -C deb
-
-.PHONY: rpm
-rpm:
-	make -C rpm
-
diff --git a/deploy/packages/rpm/Makefile b/deploy/packages/rpm/Makefile
deleted file mode 100644
index 52ab64ae..00000000
--- a/deploy/packages/rpm/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-# Keep this short to avoid bloating beam files with long file path info
-TOPDIR := /tmp/kuiper
-SRCDIR := $(TOPDIR)/$(PKG_VSN)
-BUILT := $(SRCDIR)/BUILT
-dash := -
-none :=
-space := $(none) $(none)
-RPM_VSN ?= $(shell echo $(PKG_VSN) | grep -oE "[0-9]+\.[0-9]+(\.[0-9]+)?")
-RPM_REL ?= $(shell echo $(PKG_VSN) | grep -oE "(alpha|beta|rc)\.[0-9]")
-
-ifeq ($(RPM_REL),)
-    # no tail
-    RPM_REL := 1
-endif
-
-ARCH := $(shell uname -m)
-
-ifeq ($(ARCH),mips64)
-ARCH := mips64el
-endif
-
-TARGET_PKG := kuiper-$(PKG_VSN)-linux-$(shell go env GOARCH).rpm
-
-.PHONY: all
-all: | $(BUILT)
-	rpmbuild -v -bb \
-		--define "_package_name kuiper" \
-		--define "_name kuiper" \
-		--define "_topdir $(TOPDIR)" \
-		--define "_code_source $(SRCDIR)" \
-		--define "_version $(RPM_VSN)" \
-		--define "_release $(RPM_REL)" \
-		--define "_service_src $(KUIPER_SOURCE)/deploy/packages/rpm/kuiper.service" \
-		--define "_service_dst %{_unitdir}/kuiper.service" \
-		--define "_post_addition %systemd_post %{_name}.service" \
-		--define "_preun_addition %systemd_preun %{_name}.service" \
-		--define "_sharedstatedir /var/lib" \
-		kuiper.spec
-	mkdir -p $(KUIPER_SOURCE)/_packages
-	cp $(TOPDIR)/RPMS/$(ARCH)/*.rpm $(KUIPER_SOURCE)/_packages/$(TARGET_PKG)
-
-$(BUILT):
-	mkdir -p $(TOPDIR) $(SRCDIR)
-	cp -r $(KUIPER_SOURCE)/. $(SRCDIR) 
-	cd $(SRCDIR) && mkdir BUILT 
-
-clean:
-	rm -rf $(SRCDIR)
diff --git a/deploy/packages/rpm/kuiper.service b/deploy/packages/rpm/kuiper.service
deleted file mode 100644
index 7848ee37..00000000
--- a/deploy/packages/rpm/kuiper.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=kuiper daemon
-After=network.target
-
-[Service]
-user=kuiper
-Group=kuiper
-Type=forking
-Environment=HOME=/var/lib/kuiper
-ExecStart=/bin/sh /usr/lib/kuiper/bin/service_helper.sh start
-LimitNOFILE=1048576
-ExecStop=/bin/sh /usr/lib/kuiper/bin/service_helper.sh stop
-
-[Install]
-WantedBy=multi-user.target
diff --git a/deploy/packages/rpm/kuiper.spec b/deploy/packages/rpm/kuiper.spec
deleted file mode 100644
index e6032139..00000000
--- a/deploy/packages/rpm/kuiper.spec
+++ /dev/null
@@ -1,103 +0,0 @@
-%define debug_package %{nil}
-%define _user %{_name}
-%define _group %{_name}
-%define _conf_dir %{_sysconfdir}/%{_name}
-%define _log_dir %{_var}/log/%{_name}
-%define _lib_home /usr/lib/%{_name}
-%define _var_home %{_sharedstatedir}/%{_name}
-%define _build_id_links none
-
-Name: %{_package_name}
-Version: %{_version}
-Release: %{_release}%{?dist}
-Summary: kuiper
-Group: System Environment/Daemons
-License: Apache License Version 2.0
-URL: https://www.emqx.io
-BuildRoot: %{_tmppath}/%{_name}-%{_version}-root
-Provides: %{_name}
-AutoReq: 0
-
-%description
-A lightweight IoT edge analytics software
-
-%prep
-
-%build
-cd %{_code_source}
-GO111MODULE=on CGO_ENABLED=1 go build -ldflags="-s -w -X github.com/lf-edge/ekuiper/cmd.Version=%{_version}-%{_release} -X github.com/lf-edge/ekuiper/cmd.LoadFileType=absolute" -o %{_code_source}/kuiper %{_code_source}/cmd/kuiper/main.go
-GO111MODULE=on CGO_ENABLED=1 go build -trimpath -ldflags="-s -w -X github.com/lf-edge/ekuiper/cmd.Version=%{_version}-%{_release} -X github.com/lf-edge/ekuiper/cmd.LoadFileType=absolute" -o %{_code_source}/kuiperd %{_code_source}/cmd/kuiperd/main.go
-cd -
-
-%install
-mkdir -p %{buildroot}%{_lib_home}/bin
-mkdir -p %{buildroot}%{_log_dir}
-mkdir -p %{buildroot}%{_unitdir}
-mkdir -p %{buildroot}%{_conf_dir}
-mkdir -p %{buildroot}%{_bindir}
-mkdir -p %{buildroot}%{_var_home}
-mkdir -p %{buildroot}%{_var_home}/data
-mkdir -p %{buildroot}%{_var_home}/plugins
-mkdir -p %{buildroot}%{_var_home}/plugins/sources
-mkdir -p %{buildroot}%{_var_home}/plugins/sinks
-mkdir -p %{buildroot}%{_var_home}/plugins/functions
-mkdir -p %{buildroot}%{_var_home}/plugins/portable
-mkdir -p %{buildroot}%{_initddir}
-
-
-cp %{_code_source}/deploy/packages/service_helper.sh %{buildroot}%{_lib_home}/bin/
-cp %{_code_source}/kuiper %{buildroot}%{_lib_home}/bin/
-cp %{_code_source}/kuiperd %{buildroot}%{_lib_home}/bin/
-cp -R %{_code_source}/etc/* %{buildroot}%{_conf_dir}/
-install -m644 %{_service_src} %{buildroot}%{_service_dst}
-
-%pre
-if [ $1 = 1 ]; then
-  # Initial installation
-  /usr/bin/getent group %{_group} >/dev/null || /usr/sbin/groupadd -r %{_group}
-  if ! /usr/bin/getent passwd %{_user} >/dev/null ; then
-      /usr/sbin/useradd -r -g %{_group} -m -d %{_sharedstatedir}/%{_name} -c "%{_name}" %{_user}
-  fi
-fi
-
-%post
-if [ $1 = 1 ]; then
-    ln -s %{_lib_home}/bin/kuiperd %{_bindir}/kuiperd
-    ln -s %{_lib_home}/bin/kuiper %{_bindir}/kuiper
-fi
-%{_post_addition}
-if [ -e %{_initddir}/%{_name} ] ; then
-    /sbin/chkconfig --add %{_name}
-else
-    systemctl enable %{_name}.service
-fi
-
-%preun
-%{_preun_addition}
-# Only on uninstall, not upgrades
-if [ $1 = 0 ]; then
-    if [ -e %{_initddir}/%{_name} ] ; then
-        /sbin/service %{_name} stop > /dev/null 2>&1
-        /sbin/chkconfig --del %{_name}
-    else
-        systemctl disable %{_name}.service
-    fi
-    rm -f %{_bindir}/kuiperd
-    rm -f %{_bindir}/kuiper
-fi
-exit 0
-
-%files
-%defattr(-,root,root)
-%{_service_dst}
-%{_lib_home}
-%attr(0700,%{_user},%{_group}) %dir %{_var_home}
-%attr(0755,%{_user},%{_group}) %config(noreplace) %{_var_home}/*
-%attr(0755,%{_user},%{_group}) %dir %{_log_dir}
-%attr(0755,%{_user},%{_group}) %config(noreplace) %{_conf_dir}/*
-
-%clean
-rm -rf %{buildroot}
-
-%changelog
-
diff --git a/docs/en_US/getting_started/getting_started.md b/docs/en_US/getting_started/getting_started.md
index bfdce34a..e0b6e72f 100644
--- a/docs/en_US/getting_started/getting_started.md
+++ b/docs/en_US/getting_started/getting_started.md
@@ -26,7 +26,8 @@ For Kubernetes, eKuiper offers helm chart. Please refer to [install via helm](..
 
 eKuiper can be deployed directly to bare metal servers or virtual machines.
 
-eKuiper has prebuilt packages downloadable for Linux such as CentOS, Debian and Ubuntu and macOS. You can [install from zip](../installation.md#install-from-zip) or [from packages](../installation.md#install-from-package).
+eKuiper has prebuilt packages downloadable for Linux such as Debian and Ubuntu and macOS. You
+can [install from zip](../installation.md#install-from-zip) or [from packages](../installation.md#install-from-package).
 
 For other platforms, you may [build the runnable from source code](../installation.md#compile-from-source-code).
 
diff --git a/docs/en_US/installation.md b/docs/en_US/installation.md
index c1c6261d..5f850367 100644
--- a/docs/en_US/installation.md
+++ b/docs/en_US/installation.md
@@ -82,8 +82,6 @@ Please check [use of eKuiper management console](./operation/manager-ui/overview
 
 eKuiper binary packages are released on below operating systems with AMD64, ARM and ARM64 support:
 
-- CentOS 7 (EL7)
-- CentOS 8 (EL8)
 - Raspbian 10
 - Debian 9
 - Debian 10
@@ -122,13 +120,6 @@ After installation, all the files are inside the unzipped directory. Please chec
      $ sudo apt install ./kuiper-x.x.x-linux-amd64.deb
      ```
 
-   - RPM package:
-
-     ```shell
-     # for CentOS
-     $ sudo rpm -ivh kuiper-x.x.x-linux-amd64.rpm
-     ```
-
 3. Start eKuiper.
    - quick start
 
@@ -149,12 +140,6 @@ After installation, all the files are inside the unzipped directory. Please chec
      sudo apt remove --purge kuiper
      ```
 
-   - RPM:
-
-     ```shell
-     sudo yum remove kuiper
-     ```
-
 When installing by package, the eKuiper folders are not in the same directory. The installation structure is as below:
 
 ```text
diff --git a/docs/zh_CN/getting_started/getting_started.md b/docs/zh_CN/getting_started/getting_started.md
index e909f6da..c38f1727 100644
--- a/docs/zh_CN/getting_started/getting_started.md
+++ b/docs/zh_CN/getting_started/getting_started.md
@@ -26,7 +26,9 @@ docker run -p 9081:9081 -d --name kuiper -e MQTT_SOURCE__DEFAULT__SERVER="tcp://
 
 eKuiper 可以直接部署在裸机服务器或虚拟机上。
 
-eKuiper 有预先构建的软件包，可供 Linux, 如CentOS、Debian 和 Ubuntu 以及 macOS 的安装包下载下载。你可以[从压缩包安装](../installation.md#通过-zip-包安装)或[从软件包安装](../installation.md#通过软件包安装)。
+eKuiper 有预先构建的软件包，可供 Linux, 如 Debian 和 Ubuntu 以及 macOS
+的安装包下载下载。你可以[从压缩包安装](../installation.md#通过-zip-包安装)
+或[从软件包安装](../installation.md#通过软件包安装)。
 
 对于其他平台，你可以[从源代码构建可运行程序](../installation.md#从源码编译)。
 
diff --git a/docs/zh_CN/installation.md b/docs/zh_CN/installation.md
index 82c92453..af898344 100644
--- a/docs/zh_CN/installation.md
+++ b/docs/zh_CN/installation.md
@@ -82,8 +82,6 @@ eKuiper manager 是一个免费的 eKuiper 管理控制台，以 Docker 镜像
 
 eKuiper 发布了以下操作系统的二进制包，支持 AMD64、ARM 和 ARM64 等 CPU 架构。
 
-- CentOS 7 (EL7)
-- CentOS 8 (EL8)
 - Raspbian 10
 - Debian 9
 - Debian 10
@@ -122,13 +120,6 @@ eKuiper 发布了以下操作系统的二进制包，支持 AMD64、ARM 和 ARM6
      $ sudo apt install ./kuiper-x.x.x-linux-amd64.deb
      ```
 
-   - RPM 包：
-
-     ```shell
-     # for CentOS
-     $ sudo rpm -ivh kuiper-x.x.x-linux-amd64.rpm
-     ```
-
 3. 启动 eKuiper.
    - 快速启动
 
@@ -149,12 +140,6 @@ eKuiper 发布了以下操作系统的二进制包，支持 AMD64、ARM 和 ARM6
      sudo apt remove --purge kuiper
      ```
 
-   - RPM:
-
-     ```shell
-     sudo yum remove kuiper
-     ```
-
 当按软件包安装时，eKuiper 的文件夹不在同一个目录中。安装后的目录结构如下。
 
 ```text


Test patch:
diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh
index 8e0ed353..fe9c24d5 100755
--- a/.github/scripts/test.sh
+++ b/.github/scripts/test.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright 2021 EMQ Technologies Co., Ltd.
+# Copyright 2021-2024 EMQ Technologies Co., Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -29,13 +29,3 @@ if dpkg --help >/dev/null 2>&1; then
     dpkg -P kuiper
     [ -z "$(dpkg -l |grep kuiper)" ]
 fi
-
-if rpm --help >/dev/null 2>&1; then
-    rpm -ivh $PKG_PATH/*.rpm
-    [ ! -z $(rpm -q emqx | grep -o emqx) ]
-    kuiperd &
-    sleep 1
-    if ! curl 127.0.0.1:9081  >/dev/null 2>&1; then echo "kuiper start failed"; exit 1; fi
-    rpm -e kuiper
-    [ "$(rpm -q emqx)" == "package emqx is not installed" ]
-fi