You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2023/04/24 23:13:12 UTC

[arrow-adbc] branch main updated: ci: spin up dremio using docker compose (#606)

This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new a1dd00f  ci: spin up dremio using docker compose (#606)
a1dd00f is described below

commit a1dd00f88d76beaccfce000098d4cdb3944c015d
Author: Tornike Gurgenidze <to...@freeuni.edu.ge>
AuthorDate: Tue Apr 25 03:13:07 2023 +0400

    ci: spin up dremio using docker compose (#606)
    
    Fixes #558.
---
 .github/workflows/integration.yml          | 29 +++++-------------------
 ci/docker/dremio-init.dockerfile           | 20 +++++++++++++++++
 ci/scripts/integration/dremio/bootstrap.sh |  6 ++---
 docker-compose.yml                         | 36 +++++++++++++++++++++++++++++-
 4 files changed, 63 insertions(+), 28 deletions(-)

diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index 285e682..41213cc 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -49,24 +49,9 @@ env:
   CACHE_NUMBER: "0"
 
 jobs:
-  dremio:
-    name: "Dremio Integration Tests"
+  flightsql:
+    name: "FlightSQL Integration Tests (Dremio and SQLite)"
     runs-on: ubuntu-latest
-    services:
-      dremio:
-        image: dremio/dremio-oss:latest
-        env:
-          DREMIO_JAVA_EXTRA_OPTS: "-Ddebug.addDefaultUser=true -Ddremio.eula.disabled=true"
-        options: >-
-          --health-cmd "curl --fail http://localhost:9047/ || exit 1"
-          --health-interval 10s
-          --health-timeout 5s
-          --health-retries 5
-        ports:
-          - 9047:9047
-          - 32010:32010
-          - 31010:31010
-          - 45678:45678
     steps:
       - uses: actions/checkout@v3
         with:
@@ -100,14 +85,10 @@ jobs:
           check-latest: true
           cache: true
           cache-dependency-path: go/adbc/go.sum
-      - name: Bootstrap Dremio
-        shell: bash -l {0}
-        run: |
-          ./ci/scripts/integration/dremio/bootstrap.sh
-      - name: Start SQLite server
+      - name: Start SQLite server and Dremio
         shell: bash -l {0}
         run: |
-          docker-compose up -d golang-sqlite-flightsql
+          docker-compose up -d golang-sqlite-flightsql dremio dremio-init
 
       - name: Build FlightSQL Driver
         shell: bash -l {0}
@@ -146,7 +127,7 @@ jobs:
           ADBC_DREMIO_FLIGHTSQL_PASS: "dremio123"
         run: |
           ./ci/scripts/python_test.sh "$(pwd)" "$(pwd)/build"
-      - name: Stop SQLite server
+      - name: Stop SQLite server and Dremio
         shell: bash -l {0}
         run: |
           docker-compose down
diff --git a/ci/docker/dremio-init.dockerfile b/ci/docker/dremio-init.dockerfile
new file mode 100644
index 0000000..2880c5d
--- /dev/null
+++ b/ci/docker/dremio-init.dockerfile
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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 alpine:3.17
+
+RUN apk add --no-cache curl jq bash
diff --git a/ci/scripts/integration/dremio/bootstrap.sh b/ci/scripts/integration/dremio/bootstrap.sh
index 65b0893..667c34e 100755
--- a/ci/scripts/integration/dremio/bootstrap.sh
+++ b/ci/scripts/integration/dremio/bootstrap.sh
@@ -26,15 +26,15 @@ main() {
         curl \
             -X POST \
             -H "Content-Type: application/json" \
-            "http://localhost:9047/apiv2/login" \
+            "$dremio_url/apiv2/login" \
             -d '{"userName":"dremio","password":"dremio123"}')
-    local -r token="_dremio$(echo "${login}" | jq .token)"
+    local -r token="_dremio$(echo ${login} | jq -r .token)"
 
     curl \
         -X PUT \
         -H "content-type: application/json" \
         -H "authorization: ${token}" \
-        "http://localhost:9047/apiv2/source/Samples/" \
+        "$dremio_url/apiv2/source/Samples/" \
         -d '{"config":{"externalBucketList":["samples.dremio.com"], "credentialType":"NONE","secure":false,"propertyList":[]},"name":"Samples","accelerationRefreshPeriod":3600000, "accelerationGracePeriod":10800000,"accelerationNeverRefresh":true,"accelerationNeverExpire":true,"type":"S3"}'
 }
 
diff --git a/docker-compose.yml b/docker-compose.yml
index 77ca8ae..e65d935 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-version: '3.5'
+version: '3.9'
 
 services:
   # These reuse Arrow's images for simplicity. You won't be able to
@@ -128,3 +128,37 @@ services:
         POSTGRES_PASSWORD: password
       ports:
         - "5432:5432"
+
+  dremio:
+    container_name: adbc-dremio
+    image: dremio/dremio-oss:latest
+    environment:
+      DREMIO_JAVA_EXTRA_OPTS: "-Ddebug.addDefaultUser=true -Ddremio.eula.disabled=true"
+    healthcheck:
+      test: [ "CMD", "curl", "--fail", "http://localhost:9047" ]
+      interval: 10s
+      timeout: 10s
+      retries: 5
+      start_period: 40s
+    ports:
+      - "9047:9047"
+      - "32010:32010"
+      - "31010:31010"
+      - "45678:45678"
+
+  dremio-init:
+    container_name: adbc-dremio-init
+    image: ${REPO}:adbc-dremio-init
+    build:
+      context: .
+      cache_from:
+        - ${REPO}:adbc-dremio-init
+      dockerfile: ci/docker/dremio-init.dockerfile
+    environment:
+      dremio_url: http://dremio:9047
+    depends_on:
+      dremio:
+        condition: service_healthy
+    entrypoint: "/init/bootstrap.sh"
+    volumes:
+      - "./ci/scripts/integration/dremio:/init"