From 15b7b9442e30a58552cd33d2c48fada042d53750 Mon Sep 17 00:00:00 2001 From: mu <59917266+4eUeP@users.noreply.github.com> Date: Thu, 27 Oct 2022 14:24:49 +0800 Subject: [PATCH] ci with rqlite based logdevice --- .github/workflows/ci.yml | 19 ++++++++++++------- script/dev-tools | 10 ++++++---- script/start-server.sh | 4 +++- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 772a3f451..b23b4ec7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: env: NEW_HSTREAM_IMAGE: new_hstream_image + HS_IMAGE_TAG_PREFIX: "rqlite_" jobs: pre-build: @@ -62,12 +63,14 @@ jobs: - name: set env run: | - docker pull docker.io/hstreamdb/haskell:${{ matrix.ghc }} - echo "CABAL=python3 script/dev-tools cabal --check --no-interactive -i docker.io/hstreamdb/haskell:${{ matrix.ghc }}" >> $GITHUB_ENV - echo "SHELL=python3 script/dev-tools shell --check --no-interactive -i docker.io/hstreamdb/haskell:${{ matrix.ghc }}" >> $GITHUB_ENV + docker pull docker.io/hstreamdb/haskell:${HS_IMAGE_TAG_PREFIX}${{ matrix.ghc }} + echo "CABAL=python3 script/dev-tools cabal --check --no-interactive -i docker.io/hstreamdb/haskell:${HS_IMAGE_TAG_PREFIX}${{ matrix.ghc }}" >> $GITHUB_ENV + echo "SHELL=python3 script/dev-tools shell --check --no-interactive -i docker.io/hstreamdb/haskell:${HS_IMAGE_TAG_PREFIX}${{ matrix.ghc }}" >> $GITHUB_ENV - name: start required services - run: python3 script/dev-tools start-services + run: | + export DB_IMAGE=docker.io/hstreamdb/logdevice:rqlite + python3 script/dev-tools start-services - name: cabal update run: ${{ env.CABAL }} update @@ -103,13 +106,15 @@ jobs: - name: start hstream server run: | export CONTAINER_NAME="test-hstream-server" - export IMAGE="docker.io/hstreamdb/haskell:${{ matrix.ghc }}" - export EXTRA_OPTS="--check --no-interactive --detach" + export IMAGE="docker.io/hstreamdb/haskell:${HS_IMAGE_TAG_PREFIX}${{ matrix.ghc }}" + export EXTRA_OPTS="--check --no-interactive --no-rm --detach" export COMMAND=" " export EXE=$(find dist-newstyle -name "hstream-server" -type f) ./script/start-server.sh sleep 5 docker logs --tail 100 $CONTAINER_NAME + # TODO + # [ ! "$(docker ps --filter name=${CONTAINER_NAME} --filter status=running --format '{{.Names}}')" ] && exit 1 - name: test run: | @@ -147,7 +152,7 @@ jobs: mkdir -p ~/data python3 script/dev-tools quick-build-dev-image \ - --builder-image docker.io/hstreamdb/haskell:${{ matrix.ghc }} \ + --builder-image docker.io/hstreamdb/haskell:${HS_IMAGE_TAG_PREFIX}${{ matrix.ghc }} \ -t $NEW_HSTREAM_IMAGE docker save -o ~/data/new_hstream_image.tar $NEW_HSTREAM_IMAGE diff --git a/script/dev-tools b/script/dev-tools index a737f34ef..cb4616853 100755 --- a/script/dev-tools +++ b/script/dev-tools @@ -71,7 +71,7 @@ with open(BASH_HISTORY_FILE, "a"): IMAGES = { "HS_IMAGE": os.getenv("DEV_IMAGE", "docker.io/hstreamdb/haskell"), "LD_IMAGE": "docker.io/hstreamdb/logdevice", - "DB_IMAGE": "docker.io/hstreamdb/hstream", + "DB_IMAGE": os.getenv("DB_IMAGE", "docker.io/hstreamdb/hstream"), "SWAGGER_IMAGE": "swaggerapi/swagger-ui", "ZOOKEEPER_IMAGE": "zookeeper:3.6", "RQLITE_IMAGE": "rqlite/rqlite", @@ -696,6 +696,7 @@ class ShellCommand: parser_haskell.add_argument("--command", default=None) parser_haskell.add_argument("--no-interactive", action="store_true") parser_haskell.add_argument("--no-tty", action="store_true") + parser_haskell.add_argument("--no-rm", action="store_true") parser_haskell.add_argument( "--no-services-required", action="store_true" ) @@ -711,16 +712,17 @@ class ShellCommand: def run(self, **args): args["interactive"] = not args.pop("no_interactive") args["tty"] = not args.pop("no_tty") + args["rm"] = not args.pop("no_rm") if args["command"] is None: if args["interactive"]: args["command"] = "bash" args["cmd_args"] = "" - dev_env(rm=True, **args) + dev_env(**args) else: args["command"] = "bash -c" - dev_env(rm=True, **args) + dev_env(**args) else: - dev_env(rm=True, **args) + dev_env(**args) class CabalCommand: diff --git a/script/start-server.sh b/script/start-server.sh index 1f496b50e..341d8b6e2 100755 --- a/script/start-server.sh +++ b/script/start-server.sh @@ -17,4 +17,6 @@ META_STORE="zk://127.0.0.1:$ZOOKEEPER_PORT" python3 script/dev-tools shell $EXTRA_OPTS --command "$COMMAND" \ --container-name $CONTAINER_NAME -i $IMAGE -- \ - $EXE --config-path "conf/hstream.yaml" --port $SERVER_PORT --log-with-color --store-admin-port $LD_ADMIN_PORT --metastore-uri $META_STORE --server-id $SERVER_ID --address 127.0.0.1 + $EXE --config-path "conf/hstream.yaml" --port $SERVER_PORT --log-with-color \ + --store-admin-port $LD_ADMIN_PORT --metastore-uri $META_STORE \ + --server-id $SERVER_ID --address 127.0.0.1