1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00
commons/scripts/keeper.sh

32 lines
1007 B
Bash
Raw Normal View History

2019-07-17 16:30:43 +02:00
#!/bin/bash
# Wait for contracts migration and extract Keeper artifacts
RETRY_COUNT=0
COMMAND_STATUS=1
2019-07-22 13:32:26 +02:00
printf '\n\e[33m◯ Waiting for contracts to be generated...\e[0m\n'
2019-07-22 12:32:22 +02:00
2019-07-17 16:30:43 +02:00
mkdir -p artifacts
until [ $COMMAND_STATUS -eq 0 ] || [ $RETRY_COUNT -eq 120 ]; do
keeper_contracts_docker_id=$(docker container ls | grep keeper-contracts | awk '{print $1}')
2019-07-22 12:32:22 +02:00
docker cp "${keeper_contracts_docker_id}":/keeper-contracts/artifacts/ready ./artifacts/ > /dev/null 2>&1
2019-07-17 16:30:43 +02:00
COMMAND_STATUS=$?
sleep 5
2019-07-22 12:32:22 +02:00
(( RETRY_COUNT=RETRY_COUNT+1 ))
2019-07-17 16:30:43 +02:00
done
2019-07-22 13:32:26 +02:00
printf '\e[32m✔ Found new contract artifacts.\e[0m\n'
2019-07-22 12:32:22 +02:00
rm -rf ./artifacts/
2019-07-17 16:30:43 +02:00
if [ $COMMAND_STATUS -ne 0 ]; then
echo "Waited for more than two minutes, but keeper contracts have not been migrated yet. Did you run an Ethereum RPC client and the migration script?"
exit 1
fi
2019-07-22 12:32:22 +02:00
docker cp "${keeper_contracts_docker_id}":/keeper-contracts/artifacts/. ./client/node_modules/@oceanprotocol/keeper-contracts/artifacts/
2019-07-22 13:32:26 +02:00
printf '\e[32m✔ Copied new contract artifacts.\e[0m\n'