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_filename but without service_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
else branch (line 58) because perf_filename is set
- Line 61 crashes because
$service_mesh is 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
fi
I have a PR ready to submit with this fix.
Environment
- Action version: master branch
- Triggered from: meshery/meshery scheduled e2e workflow
Description
The
mesheryctl.shscript crashes with a bash error when theservice_meshinput is not provided, even though it's marked as optional inaction.yml.Error
Root Cause
In
mesheryctl.sh, when using a config file (theelsebranch starting at line 58), the script immediately accesses:shortName=$(echo ${adapters[$service_mesh]} | cut -d ':' -f1)If
service_meshis 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
profile_filenamebut withoutservice_mesh:elsebranch (line 58) becauseperf_filenameis set$service_meshis emptyImpact
This bug is causing the
meshery/mesheryscheduled e2e tests to fail continuously. The workflow at.github/workflows/mesheryctl-e2e.yamlcalls this action without providingservice_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:
I have a PR ready to submit with this fix.
Environment