You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by mo...@apache.org on 2023/09/28 05:43:56 UTC

[apisix-docker] branch master updated: fix: use sed replace yq (#508)

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

monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


The following commit(s) were added to refs/heads/master by this push:
     new e0ac41c  fix: use sed replace yq (#508)
e0ac41c is described below

commit e0ac41ca7d83b3632bfd42cc697e3fd6eec40903
Author: kamly <12...@qq.com>
AuthorDate: Thu Sep 28 13:43:52 2023 +0800

    fix: use sed replace yq (#508)
---
 .github/workflows/apisix-docker-example-test-standalone.yaml | 2 +-
 centos/docker-entrypoint.sh                                  | 9 ++++-----
 debian-dev/docker-entrypoint.sh                              | 9 ++++-----
 debian/docker-entrypoint.sh                                  | 9 ++++-----
 redhat/docker-entrypoint.sh                                  | 9 ++++-----
 5 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/.github/workflows/apisix-docker-example-test-standalone.yaml b/.github/workflows/apisix-docker-example-test-standalone.yaml
index 78b0ea7..f9823c9 100644
--- a/.github/workflows/apisix-docker-example-test-standalone.yaml
+++ b/.github/workflows/apisix-docker-example-test-standalone.yaml
@@ -60,7 +60,7 @@ jobs:
 
       - name: Test APISIX
         run: |
-          sleep 50 #startup time maybe a little longer as the yq binary is downloaded for use at runtime
+          sleep 30
 
           result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get`
           if [[ $result_code -ne 200 ]];then
diff --git a/centos/docker-entrypoint.sh b/centos/docker-entrypoint.sh
index cf5bd32..93565ef 100755
--- a/centos/docker-entrypoint.sh
+++ b/centos/docker-entrypoint.sh
@@ -31,11 +31,10 @@ deployment:
     config_provider: yaml
 _EOC_
       else
-          wget -qO /usr/local/apisix/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
-	        && chmod a+x /usr/local/apisix/yq
-          /usr/local/apisix/yq -i '.deployment.role = "data_plane"' ${PREFIX}/conf/config.yaml
-          /usr/local/apisix/yq -i '.deployment.role_data_plane.config_provider = "yaml"' ${PREFIX}/conf/config.yaml 
-          rm /usr/local/apisix/yq
+          # updating config.yaml for standalone mode
+          sed -i 's/role: traditional/role: data_plane/' ${PREFIX}/conf/config.yaml
+          sed -i 's/role_traditional:/role_data_plane:/' ${PREFIX}/conf/config.yaml
+          sed -i 's/config_provider: etcd/config_provider: yaml/' ${PREFIX}/conf/config.yaml
       fi
 
         if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
diff --git a/debian-dev/docker-entrypoint.sh b/debian-dev/docker-entrypoint.sh
index 70ae448..b9d54c4 100755
--- a/debian-dev/docker-entrypoint.sh
+++ b/debian-dev/docker-entrypoint.sh
@@ -31,11 +31,10 @@ deployment:
     config_provider: yaml
 _EOC_
       else
-          wget -qO /usr/local/apisix/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
-	        && chmod a+x /usr/local/apisix/yq
-          /usr/local/apisix/yq -i '.deployment.role = "data_plane"' ${PREFIX}/conf/config.yaml
-          /usr/local/apisix/yq -i '.deployment.role_data_plane.config_provider = "yaml"' ${PREFIX}/conf/config.yaml 
-          rm /usr/local/apisix/yq      
+          # updating config.yaml for standalone mode
+          sed -i 's/role: traditional/role: data_plane/' ${PREFIX}/conf/config.yaml
+          sed -i 's/role_traditional:/role_data_plane:/' ${PREFIX}/conf/config.yaml
+          sed -i 's/config_provider: etcd/config_provider: yaml/' ${PREFIX}/conf/config.yaml
       fi
 
         if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
diff --git a/debian/docker-entrypoint.sh b/debian/docker-entrypoint.sh
index cf5bd32..93565ef 100755
--- a/debian/docker-entrypoint.sh
+++ b/debian/docker-entrypoint.sh
@@ -31,11 +31,10 @@ deployment:
     config_provider: yaml
 _EOC_
       else
-          wget -qO /usr/local/apisix/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
-	        && chmod a+x /usr/local/apisix/yq
-          /usr/local/apisix/yq -i '.deployment.role = "data_plane"' ${PREFIX}/conf/config.yaml
-          /usr/local/apisix/yq -i '.deployment.role_data_plane.config_provider = "yaml"' ${PREFIX}/conf/config.yaml 
-          rm /usr/local/apisix/yq
+          # updating config.yaml for standalone mode
+          sed -i 's/role: traditional/role: data_plane/' ${PREFIX}/conf/config.yaml
+          sed -i 's/role_traditional:/role_data_plane:/' ${PREFIX}/conf/config.yaml
+          sed -i 's/config_provider: etcd/config_provider: yaml/' ${PREFIX}/conf/config.yaml
       fi
 
         if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then
diff --git a/redhat/docker-entrypoint.sh b/redhat/docker-entrypoint.sh
index cf5bd32..93565ef 100755
--- a/redhat/docker-entrypoint.sh
+++ b/redhat/docker-entrypoint.sh
@@ -31,11 +31,10 @@ deployment:
     config_provider: yaml
 _EOC_
       else
-          wget -qO /usr/local/apisix/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
-	        && chmod a+x /usr/local/apisix/yq
-          /usr/local/apisix/yq -i '.deployment.role = "data_plane"' ${PREFIX}/conf/config.yaml
-          /usr/local/apisix/yq -i '.deployment.role_data_plane.config_provider = "yaml"' ${PREFIX}/conf/config.yaml 
-          rm /usr/local/apisix/yq
+          # updating config.yaml for standalone mode
+          sed -i 's/role: traditional/role: data_plane/' ${PREFIX}/conf/config.yaml
+          sed -i 's/role_traditional:/role_data_plane:/' ${PREFIX}/conf/config.yaml
+          sed -i 's/config_provider: etcd/config_provider: yaml/' ${PREFIX}/conf/config.yaml
       fi
 
         if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then