Quellcode durchsuchen

chore(CI): check kuiperd started for rpm/deb packages

Rory-Z vor 3 Jahren
Ursprung
Commit
efcbd8a194
3 geänderte Dateien mit 30 neuen und 15 gelöschten Zeilen
  1. 3 8
      .ci/Dockerfile
  2. 2 7
      .ci/Dockerfile-centos
  3. 25 0
      .ci/test.sh

+ 3 - 8
.ci/Dockerfile

@@ -5,12 +5,7 @@ COPY . /go/kuiper
 WORKDIR /go/kuiper
 WORKDIR /go/kuiper
 
 
 RUN apt update \
 RUN apt update \
-    && apt install -y zip upx pkg-config libczmq-dev build-essential debhelper \
-    && make -C /go/kuiper pkg
+    && apt install -y zip upx pkg-config libczmq-dev build-essential debhelper
 
 
-RUN dpkg -i _packages/*.deb \
-    && [ "$(dpkg -l |grep kuiper |awk '{print $1}')" = "ii" ] \
-    &&  dpkg -r kuiper \
-    &&  [ "$(dpkg -l |grep kuiper |awk '{print $1}')" = "rc" ] \
-    && dpkg -P kuiper \
-    && [ -z "$(dpkg -l |grep kuiper)" ]
+RUN make pkg
+RUN .ci/test.sh

+ 2 - 7
.ci/Dockerfile-centos

@@ -28,7 +28,7 @@ RUN case $(arch) in \
             ARCH=s390x \
             ARCH=s390x \
         ;; \
         ;; \
     esac \
     esac \
-    && wget https://golang.org/dl/go$GO_VERSION.linux-$ARCH.tar.gz \
+    && 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
     && tar -C /usr/local -xzf go$GO_VERSION.linux-$ARCH.tar.gz
 
 
 ENV PATH=$PATH:/usr/local/go/bin
 ENV PATH=$PATH:/usr/local/go/bin
@@ -40,9 +40,4 @@ WORKDIR /go/kuiper
 ENV KUIPER_SOURCE=/go/kuiper
 ENV KUIPER_SOURCE=/go/kuiper
 
 
 RUN make -C deploy/packages
 RUN make -C deploy/packages
-
-RUN rpm -ivh _packages/*.rpm \
-    && [ ! -z $(rpm -q emqx | grep -o emqx) ] \
-    && rpm -e kuiper \
-    && [ "$(rpm -q emqx)" == "package emqx is not installed" ]
-
+RUN .ci/test.sh

+ 25 - 0
.ci/test.sh

@@ -0,0 +1,25 @@
+#!/bin/bash
+set -e -x -u
+export PKG_PATH=${PKG_PATH:-"_packages"}
+
+if dpkg --help >/dev/null 2>&1; then
+    dpkg -i $PKG_PATH/*.deb
+    [ "$(dpkg -l |grep kuiper |awk '{print $1}')" = "ii" ]
+    kuiperd &
+    sleep 1
+    if ! curl 127.0.0.1:9081  >/dev/null 2>&1; then echo "kuiper start failed"; exit 1; fi
+    dpkg -r kuiper
+    [ "$(dpkg -l |grep kuiper |awk '{print $1}')" = "rc" ]
+    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