Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-03 Thread via GitHub


Baoyuantop merged PR #12949:
URL: https://github.com/apache/apisix/pull/12949


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-03 Thread via GitHub


shreemaan-abhishek commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2758097416


##
t/cli/test_standalone_docker.sh:
##
@@ -0,0 +1,216 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+. ./t/cli/common.sh
+
+standalone() {
+clean_up
+docker rm -f apisix-test-standalone 2>/dev/null || true
+git checkout conf/apisix.yaml
+}
+
+DOCKER_IMAGE="${DOCKER_IMAGE:-apache/apisix:master-debian-dev}"
+trap standalone EXIT
+
+make build-on-debian-dev
+
+echo 'routes: []
+#END' > conf/apisix.yaml
+
+run_docker_test() {
+local standalone_flag=$1
+local config_mode=${2:-ro}
+
+if [ "$standalone_flag" = "true" ]; then
+docker run -d --name apisix-test-standalone \
+-e APISIX_STAND_ALONE=true \
+-v 
$(pwd)/conf/config.yaml:/usr/local/apisix/conf/config.yaml:${config_mode} \
+-v $(pwd)/conf/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro \
+${DOCKER_IMAGE} > /dev/null 2>&1
+else
+docker run -d --name apisix-test-standalone \
+-v 
$(pwd)/conf/config.yaml:/usr/local/apisix/conf/config.yaml:${config_mode} \
+-v $(pwd)/conf/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro \
+${DOCKER_IMAGE} > /dev/null 2>&1
+fi
+
+sleep 5
+
+if ! docker ps | grep -q apisix-test-standalone; then
+echo "Container failed to start. Logs:"
+docker logs apisix-test-standalone
+docker rm -f apisix-test-standalone > /dev/null 2>&1
+return 1
+fi
+
+docker rm -f apisix-test-standalone > /dev/null 2>&1
+return 0
+}
+
+# normal YAML format
+echo '
+deployment:
+role: data_plane
+role_data_plane:
+config_provider: yaml
+apisix:
+node_listen: 9080
+' > conf/config.yaml
+
+if ! run_docker_test "true"; then
+echo "failed: normal YAML format 'role: data_plane' was rejected"
+exit 1
+fi
+
+echo "passed: normal YAML format accepted"
+
+# double-quoted format
+echo '
+deployment:
+role: "data_plane"
+role_data_plane:
+config_provider: yaml
+apisix:
+node_listen: 9080
+' > conf/config.yaml
+
+if ! run_docker_test "true"; then
+echo "failed: double-quoted 'role: \"data_plane\"' was rejected"
+exit 1
+fi
+
+echo "passed: double-quoted format accepted"
+
+# single-quoted format
+echo "
+deployment:
+role: 'data_plane'
+role_data_plane:
+config_provider: yaml
+apisix:
+node_listen: 9080
+" > conf/config.yaml
+
+if ! run_docker_test "true"; then
+echo "failed: single quoted \"role: 'data_plane'\" was rejected"
+exit 1
+fi
+
+echo "passed: single-quoted format accepted"
+
+# flow syntax
+echo '
+deployment: {"role": "data_plane", "role_data_plane": {"config_provider": 
"yaml"}}

Review Comment:
   interesting..



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-02 Thread via GitHub


janiussyafiq commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2757585468


##
t/cli/test_standalone_docker.sh:
##
@@ -0,0 +1,216 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+. ./t/cli/common.sh
+
+standalone() {
+clean_up
+docker rm -f apisix-test-standalone 2>/dev/null || true
+git checkout conf/apisix.yaml
+}
+
+DOCKER_IMAGE="${DOCKER_IMAGE:-apache/apisix:master-debian-dev}"
+trap standalone EXIT
+
+make build-on-debian-dev

Review Comment:
   will try implementing 3rd option thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-02 Thread via GitHub


janiussyafiq commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2757581319


##
t/cli/test_standalone_docker.sh:
##
@@ -0,0 +1,216 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+. ./t/cli/common.sh
+
+standalone() {
+clean_up
+docker rm -f apisix-test-standalone 2>/dev/null || true
+git checkout conf/apisix.yaml
+}
+
+DOCKER_IMAGE="${DOCKER_IMAGE:-apache/apisix:master-debian-dev}"
+trap standalone EXIT
+
+make build-on-debian-dev

Review Comment:
   opt 1: won't work, i've discussed with @nic-6443, since the older image 
still rely on the script that is decided to be removed 
`check_standalone_config.sh`, so test will fail
   as for opt 2 and 3, can try those solution, i'm more leaning towards opt 3 
wdyt?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-02 Thread via GitHub


janiussyafiq commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2757566277


##
t/cli/test_standalone_docker.sh:
##
@@ -0,0 +1,216 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+. ./t/cli/common.sh
+
+standalone() {
+clean_up
+docker rm -f apisix-test-standalone 2>/dev/null || true
+git checkout conf/apisix.yaml
+}
+
+DOCKER_IMAGE="${DOCKER_IMAGE:-apache/apisix:master-debian-dev}"
+trap standalone EXIT
+
+make build-on-debian-dev
+
+echo 'routes: []
+#END' > conf/apisix.yaml
+
+run_docker_test() {
+local standalone_flag=$1
+local config_mode=${2:-ro}
+
+if [ "$standalone_flag" = "true" ]; then
+docker run -d --name apisix-test-standalone \
+-e APISIX_STAND_ALONE=true \
+-v 
$(pwd)/conf/config.yaml:/usr/local/apisix/conf/config.yaml:${config_mode} \
+-v $(pwd)/conf/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro \
+${DOCKER_IMAGE} > /dev/null 2>&1
+else
+docker run -d --name apisix-test-standalone \
+-v 
$(pwd)/conf/config.yaml:/usr/local/apisix/conf/config.yaml:${config_mode} \
+-v $(pwd)/conf/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro \
+${DOCKER_IMAGE} > /dev/null 2>&1
+fi
+
+sleep 5
+
+if ! docker ps | grep -q apisix-test-standalone; then
+echo "Container failed to start. Logs:"
+docker logs apisix-test-standalone
+docker rm -f apisix-test-standalone > /dev/null 2>&1
+return 1
+fi
+
+docker rm -f apisix-test-standalone > /dev/null 2>&1
+return 0
+}
+
+# normal YAML format
+echo '
+deployment:
+role: data_plane
+role_data_plane:
+config_provider: yaml
+apisix:
+node_listen: 9080
+' > conf/config.yaml
+
+if ! run_docker_test "true"; then
+echo "failed: normal YAML format 'role: data_plane' was rejected"
+exit 1
+fi
+
+echo "passed: normal YAML format accepted"
+
+# double-quoted format
+echo '
+deployment:
+role: "data_plane"
+role_data_plane:
+config_provider: yaml
+apisix:
+node_listen: 9080
+' > conf/config.yaml
+
+if ! run_docker_test "true"; then
+echo "failed: double-quoted 'role: \"data_plane\"' was rejected"
+exit 1
+fi
+
+echo "passed: double-quoted format accepted"
+
+# single-quoted format
+echo "
+deployment:
+role: 'data_plane'
+role_data_plane:
+config_provider: yaml
+apisix:
+node_listen: 9080
+" > conf/config.yaml
+
+if ! run_docker_test "true"; then
+echo "failed: single quoted \"role: 'data_plane'\" was rejected"
+exit 1
+fi
+
+echo "passed: single-quoted format accepted"
+
+# flow syntax
+echo '
+deployment: {"role": "data_plane", "role_data_plane": {"config_provider": 
"yaml"}}

Review Comment:
   https://www.yamllint.com/ tried the syntax here, and it works - copy this 
code block
   `deployment: {"role": "data_plane", "role_data_plane": {"config_provider": 
"yaml"}}
   apisix:
   node_listen: 9080`
   i think this also addressed here: 
https://github.com/apache/apisix/issues/12427



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-02 Thread via GitHub


shreemaan-abhishek commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2757563413


##
t/cli/test_standalone_docker.sh:
##
@@ -0,0 +1,216 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+. ./t/cli/common.sh
+
+standalone() {
+clean_up
+docker rm -f apisix-test-standalone 2>/dev/null || true
+git checkout conf/apisix.yaml
+}
+
+DOCKER_IMAGE="${DOCKER_IMAGE:-apache/apisix:master-debian-dev}"
+trap standalone EXIT
+
+make build-on-debian-dev

Review Comment:
   3rd option sounds good to me



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-02 Thread via GitHub


shreemaan-abhishek commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2757562755


##
t/cli/test_standalone_docker.sh:
##
@@ -0,0 +1,216 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+. ./t/cli/common.sh
+
+standalone() {
+clean_up
+docker rm -f apisix-test-standalone 2>/dev/null || true
+git checkout conf/apisix.yaml
+}
+
+DOCKER_IMAGE="${DOCKER_IMAGE:-apache/apisix:master-debian-dev}"
+trap standalone EXIT
+
+make build-on-debian-dev

Review Comment:
   This is going to significantly increase the duration of the CI. We can take 
one of the following actions to avoid this:
   
   - use prebuilt image (image built from previous push) instead of building 
image while running the test.
   - run this test only on master branch
 - but this will require further more changes (e.g: a separate GitHub 
actions workflow)
 - and we won't be able to detect regressions before commit
   - run this test on a different GitHub actions workflow and only run them if 
any of the files related to this feature (ops.lua, docker-entrypoint.sh, etc) 
change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-02 Thread via GitHub


shreemaan-abhishek commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2757541894


##
t/cli/test_standalone_docker.sh:
##
@@ -0,0 +1,216 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+. ./t/cli/common.sh
+
+standalone() {
+clean_up
+docker rm -f apisix-test-standalone 2>/dev/null || true
+git checkout conf/apisix.yaml
+}
+
+DOCKER_IMAGE="${DOCKER_IMAGE:-apache/apisix:master-debian-dev}"
+trap standalone EXIT
+
+make build-on-debian-dev
+
+echo 'routes: []
+#END' > conf/apisix.yaml
+
+run_docker_test() {
+local standalone_flag=$1
+local config_mode=${2:-ro}
+
+if [ "$standalone_flag" = "true" ]; then
+docker run -d --name apisix-test-standalone \
+-e APISIX_STAND_ALONE=true \
+-v 
$(pwd)/conf/config.yaml:/usr/local/apisix/conf/config.yaml:${config_mode} \
+-v $(pwd)/conf/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro \
+${DOCKER_IMAGE} > /dev/null 2>&1
+else
+docker run -d --name apisix-test-standalone \
+-v 
$(pwd)/conf/config.yaml:/usr/local/apisix/conf/config.yaml:${config_mode} \
+-v $(pwd)/conf/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro \
+${DOCKER_IMAGE} > /dev/null 2>&1
+fi
+
+sleep 5
+
+if ! docker ps | grep -q apisix-test-standalone; then
+echo "Container failed to start. Logs:"
+docker logs apisix-test-standalone
+docker rm -f apisix-test-standalone > /dev/null 2>&1
+return 1
+fi
+
+docker rm -f apisix-test-standalone > /dev/null 2>&1
+return 0
+}
+
+# normal YAML format
+echo '
+deployment:
+role: data_plane
+role_data_plane:
+config_provider: yaml
+apisix:
+node_listen: 9080
+' > conf/config.yaml
+
+if ! run_docker_test "true"; then
+echo "failed: normal YAML format 'role: data_plane' was rejected"
+exit 1
+fi
+
+echo "passed: normal YAML format accepted"
+
+# double-quoted format
+echo '
+deployment:
+role: "data_plane"
+role_data_plane:
+config_provider: yaml
+apisix:
+node_listen: 9080
+' > conf/config.yaml
+
+if ! run_docker_test "true"; then
+echo "failed: double-quoted 'role: \"data_plane\"' was rejected"
+exit 1
+fi
+
+echo "passed: double-quoted format accepted"
+
+# single-quoted format
+echo "
+deployment:
+role: 'data_plane'
+role_data_plane:
+config_provider: yaml
+apisix:
+node_listen: 9080
+" > conf/config.yaml
+
+if ! run_docker_test "true"; then
+echo "failed: single quoted \"role: 'data_plane'\" was rejected"
+exit 1
+fi
+
+echo "passed: single-quoted format accepted"
+
+# flow syntax
+echo '
+deployment: {"role": "data_plane", "role_data_plane": {"config_provider": 
"yaml"}}

Review Comment:
   this is neither a valid json nor a valid yaml, why would using this config 
not fail?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-02 Thread via GitHub


janiussyafiq commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2757538639


##
docker/debian-dev/docker-entrypoint.sh:
##


Review Comment:
   might've changed it when i did local testing, will revert it back



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-02-02 Thread via GitHub


shreemaan-abhishek commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2757512998


##
docker/debian-dev/docker-entrypoint.sh:
##


Review Comment:
   https://github.com/user-attachments/assets/5d5795bd-fe04-4fc9-a823-9e9fde133f02";
 />
   
   you have changed the mode of this file, why?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-01-29 Thread via GitHub


nic-6443 commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2744854736


##
docker/utils/check_standalone_config.sh:
##
@@ -16,20 +16,30 @@
 # limitations under the License.
 #
 
-if ! grep -q 'role: data_plane' "${PREFIX}/conf/config.yaml"; then
-echo "Error: ${PREFIX}/conf/config.yaml does not contain 'role: 
data_plane'. Deployment role must be set to 'data_plane' for standalone mode."
+CONF_FILE="${PREFIX}/conf/config.yaml"

Review Comment:
   I suggest that we should not validate `config.yaml` through the shell, as it 
is prone to errors. We can move the checking logic to ops.lua, so that we can 
validate `config.yaml` in a semantic way:
   
https://github.com/apache/apisix/blob/adf2ea1573a17dee97ff8a4ad2df835f3ba8a862/apisix/cli/ops.lua#L179-L186
   Here, check the environment variables and fields in the `yaml_conf` object.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-01-29 Thread via GitHub


janiussyafiq commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2742476358


##
docker/utils/check_standalone_config.sh:
##
@@ -16,20 +16,30 @@
 # limitations under the License.
 #
 
-if ! grep -q 'role: data_plane' "${PREFIX}/conf/config.yaml"; then
-echo "Error: ${PREFIX}/conf/config.yaml does not contain 'role: 
data_plane'. Deployment role must be set to 'data_plane' for standalone mode."
+CONF_FILE="${PREFIX}/conf/config.yaml"
+if [ -n "$APISIX_PROFILE" ]; then
+CONF_FILE="${PREFIX}/conf/config-${APISIX_PROFILE}.yaml"
+fi
+
+if [ ! -f "$CONF_FILE" ]; then
+echo "Error: Configuration file not found: $CONF_FILE"
+exit 1
+fi
+
+if ! grep -E -q '["'\'']?role["'\'']?:\s*["'\'']?data_plane["'\'']?' 
"$CONF_FILE"; then
+echo "Error: $CONF_FILE does not contain 'role: data_plane'. Deployment 
role must be set to 'data_plane' for standalone mode."
 echo "Please refer to the APISIX documentation for deployment modes: 
https://apisix.apache.org/docs/apisix/deployment-modes/";
 exit 1
 fi
 
-if ! grep -q 'role_data_plane:' "${PREFIX}/conf/config.yaml"; then
-echo "Error: ${PREFIX}/conf/config.yaml does not contain 
'role_data_plane:'."
+if ! grep -E -q '["'\'']?role_data_plane["'\'']?:' "$CONF_FILE"; then
+echo "Error: $CONF_FILE does not contain 'role_data_plane:'."
 echo "Please refer to the APISIX documentation for deployment modes: 
https://apisix.apache.org/docs/apisix/deployment-modes/";
 exit 1
 fi
 
-if ! grep -q 'config_provider: yaml' "${PREFIX}/conf/config.yaml"; then
-echo "Error: ${PREFIX}/conf/config.yaml does not contain 'config_provider: 
yaml'. Config provider must be set to 'yaml' for standalone mode."
+if ! grep -E -q '["'\'']?config_provider["'\'']?:\s*["'\'']?yaml["'\'']?' 
"$CONF_FILE"; then
+echo "Error: $CONF_FILE does not contain 'config_provider: yaml'. Config 
provider must be set to 'yaml' for standalone mode."

Review Comment:
   could you provide more context on what tests are needed since i've written a 
few? do you mean the $CONF_FILE returning the correct file name?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] fix(docker): support valid YAML variations in standalone mode [apisix]

2026-01-29 Thread via GitHub


shreemaan-abhishek commented on code in PR #12949:
URL: https://github.com/apache/apisix/pull/12949#discussion_r2740892440


##
docker/utils/check_standalone_config.sh:
##
@@ -16,20 +16,30 @@
 # limitations under the License.
 #
 
-if ! grep -q 'role: data_plane' "${PREFIX}/conf/config.yaml"; then
-echo "Error: ${PREFIX}/conf/config.yaml does not contain 'role: 
data_plane'. Deployment role must be set to 'data_plane' for standalone mode."
+CONF_FILE="${PREFIX}/conf/config.yaml"
+if [ -n "$APISIX_PROFILE" ]; then
+CONF_FILE="${PREFIX}/conf/config-${APISIX_PROFILE}.yaml"
+fi
+
+if [ ! -f "$CONF_FILE" ]; then
+echo "Error: Configuration file not found: $CONF_FILE"
+exit 1
+fi
+
+if ! grep -E -q '["'\'']?role["'\'']?:\s*["'\'']?data_plane["'\'']?' 
"$CONF_FILE"; then
+echo "Error: $CONF_FILE does not contain 'role: data_plane'. Deployment 
role must be set to 'data_plane' for standalone mode."
 echo "Please refer to the APISIX documentation for deployment modes: 
https://apisix.apache.org/docs/apisix/deployment-modes/";
 exit 1
 fi
 
-if ! grep -q 'role_data_plane:' "${PREFIX}/conf/config.yaml"; then
-echo "Error: ${PREFIX}/conf/config.yaml does not contain 
'role_data_plane:'."
+if ! grep -E -q '["'\'']?role_data_plane["'\'']?:' "$CONF_FILE"; then
+echo "Error: $CONF_FILE does not contain 'role_data_plane:'."
 echo "Please refer to the APISIX documentation for deployment modes: 
https://apisix.apache.org/docs/apisix/deployment-modes/";
 exit 1
 fi
 
-if ! grep -q 'config_provider: yaml' "${PREFIX}/conf/config.yaml"; then
-echo "Error: ${PREFIX}/conf/config.yaml does not contain 'config_provider: 
yaml'. Config provider must be set to 'yaml' for standalone mode."
+if ! grep -E -q '["'\'']?config_provider["'\'']?:\s*["'\'']?yaml["'\'']?' 
"$CONF_FILE"; then
+echo "Error: $CONF_FILE does not contain 'config_provider: yaml'. Config 
provider must be set to 'yaml' for standalone mode."

Review Comment:
   please add tests that cover the changes you made in this file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]