Skip to content

Commit

Permalink
ci with rqlite based logdevice
Browse files Browse the repository at this point in the history
  • Loading branch information
4eUeP committed Oct 28, 2022
1 parent 03b3f82 commit 15b7b94
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

env:
NEW_HSTREAM_IMAGE: new_hstream_image
HS_IMAGE_TAG_PREFIX: "rqlite_"

jobs:
pre-build:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions script/dev-tools
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
)
Expand All @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion script/start-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 15b7b94

Please sign in to comment.