mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 13:56:10 +00:00
Jakub Sokołowski
9f076ed70c
Please do not run 20 different things in a single stage. It makes debugging much harder than it needs to be, since now you can see at a glance the startup of which container fails easily. Changes: - Starting of Ganache and Nim-Waku containers extracted to separate stages - Cleanup of containers moved to `cleanup` step after tests are executed - Many variables moved to `enrivonment` section for job and some stages - The `throttle` effect narrowed down just to the `Tests` stage and not whole job - RPC API is used to get the Multiaddress of Nim-Waku node instead of hardcoding key - Removed no longer necessary `status-go` history node related files - `Jenkinsfile.uitests` was renamed to `Jenkinsfile.e2e` to match CI job names Signed-off-by: Jakub Sokołowski <jakub@status.im>
40 lines
921 B
Bash
Executable File
40 lines
921 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# vim: set ft=sh:
|
|
|
|
RPC_PORT="${RPC_PORT:-8545}"
|
|
RPC_HOST="${RPC_HOST:-127.0.0.1}"
|
|
|
|
METHOD="$1"
|
|
shift
|
|
PARAMS=("$@")
|
|
|
|
if [[ -z "${METHOD}" ]]; then
|
|
echo "No method specified!" >&2
|
|
exit 1
|
|
fi
|
|
if [[ -n "${PARAMS}" ]]; then
|
|
PARAMS_STR=$(printf '%s\",\"' "${PARAMS[@]}")
|
|
# Params are a nested array because of a bug in nim-json-rpc.
|
|
# https://github.com/status-im/nim-json-rpc/issues/90
|
|
PARAMS_STR="[\"${PARAMS_STR%%\",\"}\"]"
|
|
else
|
|
PARAMS_STR=''
|
|
fi
|
|
|
|
PAYLOAD="{
|
|
\"id\": 1,
|
|
\"jsonrpc\": \"2.0\",
|
|
\"method\": \"${METHOD}\",
|
|
\"params\": [${PARAMS_STR}]
|
|
}"
|
|
|
|
# The jq script checks if error exists and adjusts exit code.
|
|
curl --request POST \
|
|
--silent \
|
|
--show-error \
|
|
--fail-with-body \
|
|
--header 'Content-type:application/json' \
|
|
--data "${PAYLOAD}" \
|
|
"${RPC_HOST}:${RPC_PORT}" | \
|
|
jq -e '., if .error != null then null|halt_error(2) else halt end'
|