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

snazy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 890b33a96 Guides: fix setup scripts to yield correct exit code (#3612)
890b33a96 is described below

commit 890b33a96b7bc2957b2f713ef6db2e9513b591dd
Author: Robert Stupp <[email protected]>
AuthorDate: Tue Feb 3 14:59:21 2026 +0100

    Guides: fix setup scripts to yield correct exit code (#3612)
    
    The statements in the shell scripts for the setup services are often 
concatenated using `;`, which means that a previous' command exit code is _not_ 
propagated and the service, although it failed, is determined to be successful.
    
    This change updates those scripts to use `&&` for the statement 
concatenation.
    
    "Final" setup services (aka "polaris-setup") now have a final `sleep 120`. 
This is due to the behavior of `docker compose up --detach --wait`, which 
considers _any_ service (without dependants) that exits with exit code 0 as a 
failure, leading to that docker-compose command yielding an error code. That 
would break the guides testing code (#3553). That `sleep 120` in 
"polaris-setup" services does **not** cause a delay of the compose starting up 
- it is purely a "hack around" Docker Com [...]
    
    To avoid merge conflicts, this change also:
    * updates affected `curl` invocations (as #3610)
    * removes superfluous `restart: "no"`
---
 getting-started/ceph/docker-compose.yml       | 44 ++++++++++++++++-----------
 getting-started/keycloak/docker-compose.yml   | 12 ++++++--
 getting-started/minio/docker-compose.yml      | 42 ++++++++++++++-----------
 getting-started/ozone/docker-compose.yml      | 42 ++++++++++++++++---------
 getting-started/quickstart/docker-compose.yml | 16 +++++++---
 getting-started/rustfs/docker-compose.yml     | 38 ++++++++++++++---------
 getting-started/telemetry/docker-compose.yml  | 11 +++++--
 7 files changed, 131 insertions(+), 74 deletions(-)

diff --git a/getting-started/ceph/docker-compose.yml 
b/getting-started/ceph/docker-compose.yml
index 19b13f7f9..5dbd411a9 100644
--- a/getting-started/ceph/docker-compose.yml
+++ b/getting-started/ceph/docker-compose.yml
@@ -151,10 +151,10 @@ services:
     command:
       - "-c"
       - >-
-        echo Creating Ceph bucket...;
-        aws s3 mb s3://${S3_POLARIS_BUCKET};
-        aws s3 ls;
-        echo Bucket setup complete.;
+        echo Creating Ceph bucket... &&
+        aws s3 mb s3://${S3_POLARIS_BUCKET} &&
+        aws s3 ls &&
+        echo Bucket setup complete.
 
   polaris:
     image: apache/polaris:latest
@@ -196,23 +196,33 @@ services:
     command:
       - "-c"
       - >-
-        chmod +x /polaris/create-catalog.sh;
-        chmod +x /polaris/obtain-token.sh;
-        source /polaris/obtain-token.sh;
-        echo Creating catalog...;
+        source /polaris/obtain-token.sh &&
+        echo Creating catalog... &&
         export STORAGE_CONFIG_INFO='{"storageType":"S3",
           "endpoint":"http://localhost:7480";,
           "endpointInternal":"http://rgw1:7480";,
           "stsUnavailable":"true",
-          "pathStyleAccess":true}';
-        export STORAGE_LOCATION='s3://polaris-storage';
-        /polaris/create-catalog.sh POLARIS $$TOKEN;
-        echo Extra grants...;
-        curl -H "Authorization: Bearer $$TOKEN" -H 'Content-Type: 
application/json' \
+          "pathStyleAccess":true}' &&
+        export STORAGE_LOCATION='s3://polaris-storage' &&
+        /polaris/create-catalog.sh POLARIS $$TOKEN &&
+        echo Extra grants... &&
+        curl \
+          --fail-with-body \
+          -H "Authorization: Bearer $$TOKEN" \
+          -H 'Content-Type: application/json' \
           -X PUT \
           
http://polaris:8181/api/management/v1/catalogs/quickstart_catalog/catalog-roles/catalog_admin/grants
 \
-          -d '{"type":"catalog", "privilege":"CATALOG_MANAGE_CONTENT"}';
-        echo Done.;
-        curl -H "Authorization: Bearer $$TOKEN" -H 'Content-Type: 
application/json' \
+          -d '{"type":"catalog", "privilege":"CATALOG_MANAGE_CONTENT"}' &&
+        echo Done. &&
+        curl \
+          --fail-with-body \
+          -H "Authorization: Bearer $$TOKEN" \
           -X GET \
-          http://polaris:8181/api/management/v1/catalogs;
+          http://polaris:8181/api/management/v1/catalogs &&
+        touch /tmp/polaris-setup-done &&
+        tail -f /dev/null
+    healthcheck:
+      interval: 1s
+      timeout: 10s
+      retries: 240
+      test: ["CMD", "test", "-f", "/tmp/polaris-setup-done"]
diff --git a/getting-started/keycloak/docker-compose.yml 
b/getting-started/keycloak/docker-compose.yml
index 1b01cb1cd..a804d39e0 100644
--- a/getting-started/keycloak/docker-compose.yml
+++ b/getting-started/keycloak/docker-compose.yml
@@ -71,12 +71,18 @@ services:
     command:
       - "-c"
       - >-
-        apk add --no-cache jq && 
-        chmod +x /polaris/create-catalog.sh && 
+        apk add --no-cache jq &&
         token=$$(curl 
http://keycloak:8080/realms/iceberg/protocol/openid-connect/token --user 
client1:s3cr3t -d 'grant_type=client_credentials' | jq -r .access_token) && 
         /polaris/create-catalog.sh realm-internal && 
         /polaris/create-catalog.sh realm-external $$token && 
-        /polaris/create-catalog.sh realm-mixed $$token
+        /polaris/create-catalog.sh realm-mixed $$token &&
+        touch /tmp/polaris-setup-done &&
+        tail -f /dev/null
+    healthcheck:
+      interval: 1s
+      timeout: 10s
+      retries: 240
+      test: ["CMD", "test", "-f", "/tmp/polaris-setup-done"]
 
   keycloak:
     image: quay.io/keycloak/keycloak:26.5.2
diff --git a/getting-started/minio/docker-compose.yml 
b/getting-started/minio/docker-compose.yml
index c14699f73..364bf3f97 100644
--- a/getting-started/minio/docker-compose.yml
+++ b/getting-started/minio/docker-compose.yml
@@ -69,7 +69,6 @@ services:
 
   setup_bucket:
     image: quay.io/minio/mc:RELEASE.2025-08-13T08-35-41Z
-    restart: "no"
     depends_on:
       minio:
         condition: service_healthy
@@ -77,15 +76,14 @@ services:
     command:
       - "-c"
       - >-
-        echo Creating MinIO bucket...;
-        mc alias set pol http://minio:9000 minio_root m1n1opwd;
-        mc mb pol/bucket123;
-        mc ls pol;
-        echo Bucket setup complete.;
+        echo Creating MinIO bucket... &&
+        mc alias set pol http://minio:9000 minio_root m1n1opwd &&
+        mc mb pol/bucket123 &&
+        mc ls pol &&
+        echo Bucket setup complete.
 
   polaris-setup:
     image: alpine/curl:8.17.0
-    restart: "no"
     depends_on:
       polaris:
         condition: service_healthy
@@ -100,19 +98,27 @@ services:
     command:
       - "-c"
       - >-
-        chmod +x /polaris/create-catalog.sh;
-        chmod +x /polaris/obtain-token.sh;
-        source /polaris/obtain-token.sh;
-        echo Creating catalog...;
+        source /polaris/obtain-token.sh &&
+        echo Creating catalog... &&
         export STORAGE_CONFIG_INFO='{"storageType":"S3",
           "endpoint":"http://localhost:9000";,
           "endpointInternal":"http://minio:9000";,
-          "pathStyleAccess":true}';
-        export STORAGE_LOCATION='s3://bucket123';
-        /polaris/create-catalog.sh POLARIS $$TOKEN;
-        echo Extra grants...;
-        curl -H "Authorization: Bearer $$TOKEN" -H 'Content-Type: 
application/json' \
+          "pathStyleAccess":true}' &&
+        export STORAGE_LOCATION='s3://bucket123' &&
+        /polaris/create-catalog.sh POLARIS $$TOKEN &&
+        echo Extra grants... &&
+        curl \
+          --fail-with-body \
+          -H "Authorization: Bearer $$TOKEN" \
+          -H 'Content-Type: application/json' \
           -X PUT \
           
http://polaris:8181/api/management/v1/catalogs/quickstart_catalog/catalog-roles/catalog_admin/grants
 \
-          -d '{"type":"catalog", "privilege":"CATALOG_MANAGE_CONTENT"}';
-        echo Done.;
+          -d '{"type":"catalog", "privilege":"CATALOG_MANAGE_CONTENT"}' &&
+        echo Done. &&
+        touch /tmp/polaris-setup-done &&
+        tail -f /dev/null
+    healthcheck:
+      interval: 1s
+      timeout: 10s
+      retries: 240
+      test: ["CMD", "test", "-f", "/tmp/polaris-setup-done"]
diff --git a/getting-started/ozone/docker-compose.yml 
b/getting-started/ozone/docker-compose.yml
index 6ec7d52eb..56ca1c457 100644
--- a/getting-started/ozone/docker-compose.yml
+++ b/getting-started/ozone/docker-compose.yml
@@ -128,7 +128,6 @@ services:
 
   polaris-setup:
     image: alpine/curl:8.17.0
-    restart: "no"
     depends_on:
       polaris:
         condition: service_healthy
@@ -141,23 +140,36 @@ services:
     command:
       - "-c"
       - >-
-        /assets/cloud_providers/await-s3.sh http://ozone-s3g:9878/ ;
-        source /assets/polaris/obtain-token.sh;
-        echo Creating bucket...;
-        curl -X PUT --user "polaris_root:polaris_pass" --aws-sigv4 
"aws:amz:us-west-2:s3" \
-          http://ozone-s3g:9878/bucket123 ;
-        echo Creating catalog...;
+        /assets/cloud_providers/await-s3.sh http://ozone-s3g:9878/ &&
+        source /assets/polaris/obtain-token.sh &&
+        echo Creating bucket... &&
+        curl \
+          --fail-with-body \
+          -X PUT \
+          --user "polaris_root:polaris_pass" \
+          --aws-sigv4 "aws:amz:us-west-2:s3" \
+          http://ozone-s3g:9878/bucket123  &&
+        echo Creating catalog... &&
         export STORAGE_CONFIG_INFO='{"storageType":"S3",
           "endpoint":"http://localhost:9878";,
           "endpointInternal":"http://ozone-s3g:9878";,
           "stsUnavailable":true,
-          "pathStyleAccess":true}';
-        export STORAGE_LOCATION='s3://bucket123';
-        /assets/polaris/create-catalog.sh POLARIS $$TOKEN;
-        echo Extra grants...;
-        curl -H "Authorization: Bearer $$TOKEN" -H 'Content-Type: 
application/json' \
+          "pathStyleAccess":true}' &&
+        export STORAGE_LOCATION='s3://bucket123' &&
+        /assets/polaris/create-catalog.sh POLARIS $$TOKEN &&
+        echo Extra grants... &&
+        curl \
+          --fail-with-body \
+          -H "Authorization: Bearer $$TOKEN" \
+          -H 'Content-Type: application/json' \
           -X PUT \
           
http://polaris:8181/api/management/v1/catalogs/quickstart_catalog/catalog-roles/catalog_admin/grants
 \
-          -d '{"type":"catalog", "privilege":"CATALOG_MANAGE_CONTENT"}';
-        echo Done.;
-
+          -d '{"type":"catalog", "privilege":"CATALOG_MANAGE_CONTENT"}' &&
+        echo Done. &&
+        touch /tmp/polaris-setup-done &&
+        tail -f /dev/null
+    healthcheck:
+      interval: 1s
+      timeout: 10s
+      retries: 240
+      test: ["CMD", "test", "-f", "/tmp/polaris-setup-done"]
diff --git a/getting-started/quickstart/docker-compose.yml 
b/getting-started/quickstart/docker-compose.yml
index 864f05319..021941dc8 100644
--- a/getting-started/quickstart/docker-compose.yml
+++ b/getting-started/quickstart/docker-compose.yml
@@ -83,10 +83,10 @@ services:
     command:
       - "-c"
       - >-
-        echo Creating RustFS bucket...;
-        aws s3 mb s3://bucket123;
-        aws s3 ls;
-        echo Bucket setup complete.;
+        echo Creating RustFS bucket... &&
+        aws s3 mb s3://bucket123 &&
+        aws s3 ls &&
+        echo Bucket setup complete.
 
   polaris-setup:
     image: alpine/curl:8.17.0
@@ -298,3 +298,11 @@ services:
         echo "    -H \"Authorization: Bearer \$$TOKEN\""
         echo ""
         echo "=========================================="
+ 
+        touch /tmp/polaris-setup-done
+        tail -f /dev/null
+    healthcheck:
+      interval: 1s
+      timeout: 10s
+      retries: 240
+      test: ["CMD", "test", "-f", "/tmp/polaris-setup-done"]
diff --git a/getting-started/rustfs/docker-compose.yml 
b/getting-started/rustfs/docker-compose.yml
index 432f49e9d..acbb029be 100644
--- a/getting-started/rustfs/docker-compose.yml
+++ b/getting-started/rustfs/docker-compose.yml
@@ -79,10 +79,10 @@ services:
     command:
       - "-c"
       - >-
-        echo Creating RustFS bucket...;
-        aws s3 mb s3://bucket123;
-        aws s3 ls;
-        echo Bucket setup complete.;
+        echo Creating RustFS bucket... &&
+        aws s3 mb s3://bucket123 &&
+        aws s3 ls &&
+        echo Bucket setup complete.
 
   polaris-setup:
     image: alpine/curl:8.17.0
@@ -98,19 +98,27 @@ services:
     command:
       - "-c"
       - >-
-        chmod +x /polaris/create-catalog.sh;
-        chmod +x /polaris/obtain-token.sh;
-        source /polaris/obtain-token.sh;
-        echo Creating catalog...;
+        source /polaris/obtain-token.sh &&
+        echo Creating catalog... &&
         export STORAGE_CONFIG_INFO='{"storageType":"S3",
           "endpoint":"http://localhost:9000";,
           "endpointInternal":"http://rustfs:9000";,
-          "pathStyleAccess":true}';
-        export STORAGE_LOCATION='s3://bucket123';
-        /polaris/create-catalog.sh POLARIS $$TOKEN;
-        echo Extra grants...;
-        curl -H "Authorization: Bearer $$TOKEN" -H 'Content-Type: 
application/json' \
+          "pathStyleAccess":true}' &&
+        export STORAGE_LOCATION='s3://bucket123' &&
+        /polaris/create-catalog.sh POLARIS $$TOKEN &&
+        echo Extra grants... &&
+        curl \
+          --fail-with-body \
+          -H "Authorization: Bearer $$TOKEN" \
+          -H 'Content-Type: application/json' \
           -X PUT \
           
http://polaris:8181/api/management/v1/catalogs/quickstart_catalog/catalog-roles/catalog_admin/grants
 \
-          -d '{"type":"catalog", "privilege":"CATALOG_MANAGE_CONTENT"}';
-        echo Done.;
+          -d '{"type":"catalog", "privilege":"CATALOG_MANAGE_CONTENT"}' &&
+        echo Done. &&
+        touch /tmp/polaris-setup-done &&
+        tail -f /dev/null
+    healthcheck:
+      interval: 1s
+      timeout: 10s
+      retries: 240
+      test: ["CMD", "test", "-f", "/tmp/polaris-setup-done"]
diff --git a/getting-started/telemetry/docker-compose.yml 
b/getting-started/telemetry/docker-compose.yml
index 432d9a567..498d66061 100644
--- a/getting-started/telemetry/docker-compose.yml
+++ b/getting-started/telemetry/docker-compose.yml
@@ -69,7 +69,14 @@ services:
     command:
       - "-c"
       - >-
-        /polaris/create-catalog.sh;
+        /polaris/create-catalog.sh &&
+        touch /tmp/polaris-setup-done &&
+        tail -f /dev/null
+    healthcheck:
+      interval: 1s
+      timeout: 10s
+      retries: 240
+      test: ["CMD", "test", "-f", "/tmp/polaris-setup-done"]
 
   prometheus:
     image: docker.io/prom/prometheus:v3.9.1
@@ -79,7 +86,7 @@ services:
       polaris:
         condition: service_healthy
       polaris-setup:
-        condition: service_completed_successfully
+        condition: service_healthy
     volumes:
       - ../assets/prometheus/:/etc/prometheus/
     command:

Reply via email to