Skip to content

Commit

Permalink
add oceanbase-ce ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
whhe committed Jun 5, 2024
1 parent a344cdf commit afbf6cb
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/ci-oceanbase-ce.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI - oceanbase-ce

on:
push:
paths:
- '.github/workflows/ci-oceanbase-ce.yml'
- 'oceanbase-ce/**'
pull_request:
paths:
- '.github/workflows/ci-oceanbase-ce.yml'
- 'oceanbase-ce/**'

jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Build docker image
run: ./oceanbase-ce/docker_build.sh
- name: Start oceanbase-ce container
timeout-minutes: 5
run: |
docker run --name ob-slim -p 2881:2881 -e MODE=slim -d oceanbase-ce
eval 'while ! docker logs ob-slim | grep -q "boot success!"; do echo "booting..."; sleep 10; done'
echo "boot success!"
- name: Test oceanbase-ce container
run: docker exec ob-slim obclient -h127.0.0.1 -P2881 -uroot -e 'select version()'
20 changes: 19 additions & 1 deletion oceanbase-ce/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ ACTUAL_INIT_STORE_PY_SCRIPT="init_store_for_fast_start.py"
CWD=$(cd `dirname $0`;pwd)
cd "${CWD}"

function boot_raw_observer() {
log_file="raw_observer.log"

docker run --name raw_observer -v ${CWD}/boot:/root/dest -d raw_observer
docker logs -f raw_observer > "$log_file" 2>&1 &

while true; do
while IFS= read -r line; do
echo "$line"
if [[ "$line" == *"prepare fast boot finish"* ]]; then
return 0
elif [[ "$line" == *"prepare fast boot failed"* ]]; then
return -1
fi
done < <(tail -f "$log_file")
done
}

function fast_boot_docker_build() {
rm -rf boot
cp -r step_1_boot boot
Expand All @@ -27,7 +45,7 @@ function fast_boot_docker_build() {
rm -rf boot

cd "${CWD}" && mkdir -p ${CWD}/boot/etc
docker run -it -v ${CWD}/boot:/root/dest raw_observer
boot_raw_observer
if [ $? == 0 ]; then
echo "================== prepare docker run ok ==============="
else
Expand Down

0 comments on commit afbf6cb

Please sign in to comment.