-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Description
The mesheryctl.sh script crashes with a bash error when the service_mesh input is not provided, even though it's marked as optional in action.yml.
Error
mesheryctl.sh: line 61: adapters: bad array subscript
Root Cause
In mesheryctl.sh, when using a config file (the else branch starting at line 58), the script immediately accesses:
shortName=$(echo ${adapters[$service_mesh]} | cut -d ':' -f1)If service_mesh is empty (not provided by the caller), bash throws "bad array subscript" because you cannot access an associative array with an empty key.
Steps to Reproduce
- Call the action with
profile_filenamebut withoutservice_mesh:
- uses: layer5io/meshery-smp-action@master
with:
provider_token: ${{ secrets.PROVIDER_TOKEN }}
platform: docker
profile_name: test-profile
profile_filename: test-config.yaml
# service_mesh not provided- The script enters the
elsebranch (line 58) becauseperf_filenameis set - Line 61 crashes because
$service_meshis empty
Impact
This bug is causing the meshery/meshery scheduled e2e tests to fail continuously. The workflow at .github/workflows/mesheryctl-e2e.yaml calls this action without providing service_mesh, triggering this crash.
See: https://github.com/meshery/meshery/actions/workflows/mesheryctl-e2e.yaml
Proposed Fix
Wrap the adapter array access in a conditional check:
if [[ -n "$service_mesh" ]]; then
shortName=$(echo ${adapters[$service_mesh]} | cut -d ':' -f1)
shortName=${shortName#meshery-}
if [[ -n "$shortName" ]]; then
docker network connect bridge meshery_meshery-"$shortName"_1 2>/dev/null || true
docker network connect minikube meshery_meshery-"$shortName"_1 2>/dev/null || true
fi
fiI have a PR ready to submit with this fix.
Environment
- Action version: master branch
- Triggered from: meshery/meshery scheduled e2e workflow